Lines
In Visualize, all lines are polylines, even if they consist of one segment. Like other geometry, the line object has a HPS::LineKey and HPS::LineKit. Lines can also be specified without a kit using a PointArray object as shown below:
Note that polylines are not assumed to be closed, so if a closed shape is desired, it must be explicitly specified.
Segment-level line attributes are set using the HPS::LineAttributeControl. These attributes include line weight and pattern. The line above was rendered with a weight of 2. (See the chapter on Line Patterns for more information about advanced options.)
Infinite lines
Infinite lines have no start or end point. They extend indefinitely into space. To draw an infinite line, call InsertInfiniteLine using your HPS::SegmentKey. Two points along the line are needed. Note that the type of infinite line (HPS::InfiniteLine or HPS::Ray) must be specified. The different colors are set at the segment level using the segment key's HPS::MaterialMappingControl. Continuing from the example above:
Note that infinite lines are considered unbounded geometry. Thus, they will be ignored in bounding calculations.
Rays
Rays are a type of infinite line. Just like the infinite line, two points are needed in order to insert it. However, in the case of the ray, the first point specified acts as the starting point of the ray. The other end extends indefinitely into space. The only other difference between the two is that the object type is set to HPS::InfiniteLine::Ray.
Note that rays are considered unbounded geometry. Thus, they will be ignored in bounding calculations.
Editing lines
Sometimes it is more desirable to edit a line in place instead of deleting and recreating it. Visualize allows editing of line points through the use of a kit or through direct action on the key. Legal edits include inserting a point into the line, deleting points, and modifying points. In the example below, the position of the first point from the original blue polyline has been modified, then the polygon is closed by inserting a new point at the end of the point list.
Infinite lines and rays can also be modified by calling SetFirst or SetSecond again.
End caps and joins
Often, it is desirable to show a symbol as a line endpoint. Any glyph can be used for this purpose. For example, to set the endpoints, use a HPS::LinePatternOptionsKit to set the start and end caps:
Visualize also supports joining of lines by styling the intersection of line segments. Three styles are offered: HPS::LinePattern::Join::Bevel, HPS::LinePattern::Join::Mitre (the default), and HPS::LinePattern::Join::Round. The image below shows each join, respectively.
Arrowheads
In engineering drawings, arrowheads are a common endpoint to a line segment. In Visualize, arrowheads are a type of line end cap. The HPS::Glyph::Default::SolidTriangleLeft and HPS::Glyph::Default::SolidTriangleRight glyphs are commonly used as arrowheads. All of the predefined glyphs can be found in the appendix.