Class PolyLine
A simple data structure representing a polyline.
public class PolyLine : NurbsBase, IGeometry<NurbsBase>, IEquatable<NurbsBase>, ITransformable<NurbsBase>, IGeometry<PolyLine>, IEquatable<PolyLine>, ITransformable<PolyLine>
ExamplePts = new[]
{
new Point3(5, 0, 0),
new Point3(15, 15, 0),
new Point3(20, 5, 0),
new Point3(30, 10, 0),
new Point3(45, 12.5, 0)
};
_polyLine = new PolyLine(ExamplePts);
Initializes a new polyline from a collection of points.
public PolyLine(IList<Point3> vertices)
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<Point3> | vertices | Points used to create the polyline. |
Gets the end point of the polyline.
public override Point3 EndPoint { get; }
Type | Description |
---|---|
Point3 |
Gets true if the polyline is closed. A polyline is considered closed, if its start and end point are identical.
public override bool IsClosed { get; }
Type | Description |
---|---|
System.Boolean |
Calculates the length of the polyline.
public override double Length { get; }
Type | Description |
---|---|
System.Double | The total length of the polyline. |
Gets the middle point of the polyline.
public override Point3 MidPoint { get; }
Type | Description |
---|---|
Point3 |
Constructs a collections of lines, which make the polyline.
public List<Line> Segments { get; }
Type | Description |
---|---|
System.Collections.Generic.List<Line> | A collection of lines. |
Gets the number of segments for this polyline;
public int SegmentsCount { get; }
Type | Description |
---|---|
System.Int32 |
Gets the starting point of the polyline.
public override Point3 StartPoint { get; }
Type | Description |
---|---|
Point3 |
Creates a closed polyline, where the first and last point are the same.
public PolyLine Close()
Type | Description |
---|---|
PolyLine | A closed polyline. |
Gets the parameter along the polyline which is closest to the test point.
public override double ClosestParameter(Point3 pt)
Type | Name | Description |
---|---|---|
Point3 | pt | The point to test. |
Type | Description |
---|---|
System.Double | The parameter closest to the test point. |
Computes the point which is the closest point to the given point.
public override Point3 ClosestPoint(Point3 pt)
Type | Name | Description |
---|---|---|
Point3 | pt | Point to test. |
Type | Description |
---|---|
Point3 | The point closest to the given point. |
Checks if a polyline is equal to the provided polyline.
Two polyline are equal if all the points are the same.
public bool Equals(PolyLine other)
Type | Name | Description |
---|---|---|
PolyLine | other | The polyline to compare. |
Type | Description |
---|---|
System.Boolean | True if the points are equal, otherwise false. |
Computes the bounding box of the list of points.
public override BoundingBox GetBoundingBox()
Type | Description |
---|---|
BoundingBox | The bounding box. |
Evaluated the length on the polyline at the given parameter.
public override double LengthAt(double t)
Type | Name | Description |
---|---|---|
System.Double | t | Evaluate parameter. Parameter should be between 0.0 and segments count. |
Type | Description |
---|---|
System.Double | The evaluated length at the curve parameter. |
Computes the offset of the polyline.
public PolyLine Offset(double distance, Plane pln)
Type | Name | Description |
---|---|---|
System.Double | distance | The distance of the offset. If negative the offset will be in the opposite side. |
Plane | pln | The plane for the offset operation. |
Type | Description |
---|---|
PolyLine | The offset polyline. |
Calculates the parameter of the polyline at the given length.
public override double ParameterAtLength(double length)
Type | Name | Description |
---|---|---|
System.Double | length | Length from start of polyline. |
Type | Description |
---|---|
System.Double | The parameter at the given length. |
Evaluates the point on the polyline at the given parameter. The integer part of the parameter indicates the index of the segment.
public override Point3 PointAt(double t)
Type | Name | Description |
---|---|---|
System.Double | t | Evaluate parameter. Parameter should be between 0.0 and segments count. |
Type | Description |
---|---|
Point3 | The evaluated point at the curve parameter. |
public override Point3 PointAtLength(double length)
Type | Name | Description |
---|---|---|
System.Double | length |
Type | Description |
---|---|
Point3 |
Evaluates a point at the normalized length.
public override Point3 PointAtNormalizedLength(double normalizedLength)
Type | Name | Description |
---|---|---|
System.Double | normalizedLength | The length factor is normalized between 0.0 and 1.0. |
Type | Description |
---|---|
Point3 | The point at the length. |
Reverses the order of the polyline.
public PolyLine Reverse()
Type | Description |
---|---|
PolyLine | A polyline reversed. |
Returns the index of the segment at a given length along the polyline.
public Line SegmentAtLength(double length)
Type | Name | Description |
---|---|---|
System.Double | length | Length from start of polyline. |
Type | Description |
---|---|
Line | Zero based index of polyline segment. |
Constructs the string representation of the polyline.
public override string ToString()
Type | Description |
---|---|
System.String | A text string. |
Applies a transformation to all the points.
public PolyLine Transform(TransformMatrix transform)
Type | Name | Description |
---|---|---|
TransformMatrix | transform | Transformation matrix to apply. |
Type | Description |
---|---|
PolyLine | A polyline transformed. |