Click or drag to resize

PolylinePrimitiveSet Method (IEnumerableCartesian, IEnumerableColor)

Defines the positions and colors of a polyline. The polyline is rendered in its ReferenceFrame.

Namespace:  AGI.Foundation.Graphics
Assembly:  AGI.Foundation.Graphics (in AGI.Foundation.Graphics.dll) Version: 24.1.418.0 (24.1.418.0)
public void Set(
	IEnumerable<Cartesian> positions,
	IEnumerable<Color> colors


Type: System.Collections.GenericIEnumerableCartesian
The new positions for the polyline.
Type: System.Collections.GenericIEnumerableColor
The new colors for the polyline. There must be one color for each position in positions. The first color is ignored, each additional color defines the color of the line segment ending at that position.
ArgumentNullExceptionpositions or colors is null.
ArgumentExceptionpositions and colors must have the same number of elements.
ArgumentException When the polyline's PolylineType is Lines, positions must have an even number of elements. Every two positions define a line segment.
InvalidOperationException Cannot define per-position colors when PositionInterpolator is not null.
CouldNotCreateVideoCardResourceException Could not allocate video memory for positions and colors.

This call overwrites the primitive's previous positions and per-position colors. To update a subset of positions and colors, use SetPartial.

If the polyline's PositionInterpolator is not null, positions are interpolated before they are rendered. If the polyline's PolylineType is LineStrip, for each position after the first position, a line segment is rendered that connects the position to the previous position. Otherwise, if Lines is used, a line segment is rendered for every two positions.

Each color in colors corresponds to a position in positions with the same location. For example, the first color in colors is applied to the first position in positions. These colors override the primitive's Color and Translucency properties. Accessing these properties will result in an InvalidOperationException.

To create translucent line segments, use the Color's alpha component. An alpha of 0 is completely transparent and an alpha of 255 is completely opaque.

If this method is called frequently, it is recommended to construct the primitive with Frequent, which is the default. If this method will be called only once or infrequently, construct the primitive with Infrequent. See the Set Hint topic for more information.

If the primitive's AutomaticallyComputeBoundingSphere property is , the primitive's BoundingSphere is computed based on positions. Otherwise, it is the caller's responsibility to update the primitive's BoundingSphere to a sphere that encompasses all the positions.

See Also