Polyline3D Type
A class holding a list of 3D points representing a mutable 3D Polyline. If the last point is the same as the first point, the Polyline3D is closed. The Default constructor uses the provided ResizeArray of points directly, so changes to the list will be reflected in the Polyline3D.
Constructors
| Constructor |
Description
|
|
Create a new empty Polyline3D with predefined capacity for the internal list of points.
|
|
Create a new empty Polyline3D
|
|
|
Instance members
| Instance member |
Description
|
Full Usage:
this.AsFSharpCode
Returns: string
|
Format this 3D polyline into an F# code string that can be used to recreate the point.
|
Full Usage:
this.AsString
Returns: string
|
Format Polyline3D into string including its length.
|
|
Returns the average normal vector of the Polyline3D. It is calculated by summing up the cross products of all segments around the center point. Does not check for bad input, may be zero length if points are colinear.
|
|
Gets the a bounding box of the Polyline3D
|
|
Returns the average center of all points of the Polyline3D.
|
|
Creates a copy of the Polyline3D. Same as polyline.Duplicate()
|
Full Usage:
this.CloseInPlace
Parameters:
float
|
Close the Polyline3D if it is not already closed. If the ends are closer than the tolerance. The last point is set to equal the first point. Else the start point is added to the end of the Polyline3D.
|
|
Returns the parameter on the Polyline3D that is the closest point to the given point. The integer part of the parameter is the index of the segment that the point is on. The fractional part of the parameter is the parameter form 0.0 to 1.0 on the segment. The domain Polyline3D starts at 0.0 and ends at points.Count - 1.0 .
|
|
|
|
Returns the index into the Polylines point list of the vertex that is closest to the given point.
|
|
Returns the distance of the test point to the closest point on the Polyline3D.
|
|
Creates a copy of the Polyline3D Same as polyline.Clone()
|
Full Usage:
this.End
|
Gets or sets last or end point of the Polyline3D This is the point at index Points.Count - 1. Same as Polyline3D.LastPoint |
|
Returns the point at a given parameter on the Polyline3D. The integer part of the parameter is the index of the segment that the point is on. The fractional part of the parameter is the parameter form 0.0 to 1.0 on the segment. The domain Polyline3D starts at 0.0 and ends at points.Count - 1.0 . If the parameter is within 1e-6 of an integer value, the integer value is used as parameter.
|
Full Usage:
this.FirstPoint
|
Gets or sets the first point of the Polyline3D. This is the point at index 0. Same as Polyline3D.Start |
|
Gets the first segment of the Polyline3D.
|
|
|
Full Usage:
this.IsAlmostClosed
Parameters:
float
Returns: bool
|
Tests if Polyline3D is closed within given tolerance. Returns False if the Polyline3D has less than 3 points.
|
Full Usage:
this.IsClockwiseIn2D
Returns: bool
|
Test if Polyline3D is Clockwise when projected in 2D. Z values are ignored. The Polyline3D does not need to be actually closed. The signed area of the Polyline3D is calculated. If it is positive the Polyline3D is CCW.
|
Full Usage:
this.IsClosed
Returns: bool
|
Tests if Polyline3D start and end points are exactly the same. Returns False if the Polyline3D has less than 3 points.
|
Full Usage:
this.IsCounterClockwiseIn2D
Returns: bool
|
Test if Polyline3D is CounterClockwise when projected in 2D. Z values are ignored. The Polyline3D does not need to be actually closed. The signed area of the Polyline3D is calculated. If it is positive the Polyline3D is CCW.
|
Full Usage:
this.LastPoint
|
Gets or sets the last point of the Polyline3D. This is the point at index Points.Count - 1. Same as Polyline3D.End |
Full Usage:
this.LastPointIndex
Returns: int
|
Gets the index of the last point in the Polyline3D. points.Count - 1
|
|
Gets the last segment of the Polyline3D.
|
Full Usage:
this.LastSegmentIndex
Returns: int
|
Gets the index of the last segment in the Polyline3D. This is poly.Points.Count - 2
|
Full Usage:
this.Length
Returns: float
|
Gets the length of the Polyline3D Returns 0.0 if there are less than 2 points.
|
|
|
|
|
|
|
|
|
Full Usage:
this.PointCount
Returns: int
|
Gets the count of points in the Polyline3D
|
|
Gets the internal list of all Points of the Polyline3D. This is not a copy, so changes to the list will be reflected in the Polyline3D.
|
|
Returns new Polyline3D in reversed Order.
|
Full Usage:
this.ReverseInPlace
|
Reverse order of the Polyline3D in place. |
|
Multiplies (or applies) a Quaternion to the Polyline3D. The polyline is rotated around the World Origin.
|
|
Multiplies (or applies) a Quaternion to the Polyline3D around a given center point.
|
|
Scales the 3D polyline by a given factor. Scale center is World Origin 0,0,0
|
|
Scales the 3D polyline by a given factor on a given center point
|
Full Usage:
this.SecondLastPoint
|
Gets or sets the second last point of the Polyline3D. |
Full Usage:
this.SecondPoint
|
Gets or sets the second point of the Polyline3D. This is the point at index 1. |
Full Usage:
this.SegmentCount
Returns: int
|
Gets the count of segments in the Polyline3D This is poly.Points.Count - 1
|
|
Returns the line vectors of all segments of the Polyline3D as a list of Vec.
|
|
Returns all segments of the Polyline3D as a list of Line3D.
|
|
Sets the vertex at given index to the given point. On a closed Polyline3D, setting the first or last point will set both to the same point.
|
Full Usage:
this.SignedAreaIn2D
Returns: float
|
Calculates the signed area of the Polyline3D when projected in 2D. Z values are ignored. The Polyline3D does not need to be actually closed. The signed area of the Polyline3D is calculated. If it is positive the Polyline3D is CCW.
|
Full Usage:
this.Start
|
Gets or sets first point of the Polyline3D This is the point at index 0. Same as Polyline3D.FirstPoint |
|
|
|
Static members
| Static member |
Description
|
|
Returns a new closed Polyline3D. If the first and last point are within 1e-6 of each other, the last point is set equal to the first point. Otherwise one point is added.
|
|
Closes the Polyline3D in place by adding a point. If the first and last point are within 1e-6 of each other, the last point is set equal to the first point instead.
|
Full Usage:
Polyline3D.closestParameter pl pt
Parameters:
Polyline3D
pt : Pnt
Returns: float
Modifiers: inline |
Returns the parameter on the Polyline3D that is the closest point to the given point. The integer part of the parameter is the index of the segment that the point is on. The fractional part of the parameter is the parameter form 0.0 to 1.0 on the segment. The domain Polyline3D starts at 0.0 and ends at point count.
|
Full Usage:
Polyline3D.closestPoint pl pt
Parameters:
Polyline3D
pt : Pnt
Returns: Pnt
Modifiers: inline |
Returns the point on the Polyline3D that is the closest point to the given point.
|
Full Usage:
Polyline3D.closestVertex pl pt
Parameters:
Polyline3D
pt : Pnt
Returns: int
Modifiers: inline |
Returns the index into the Polyline3D's point list of the vertex that is closest to the given point.
|
|
|
Full Usage:
Polyline3D.createDirectlyUnsafe points
Parameters:
ResizeArray<Pnt>
Returns: Polyline3D
|
Create a new Polyline3D by using the provided ResizeArray directly. All later changes to the ResizeArray will be reflected in the Polyline3D.
|
|
Create a new empty Polyline3D without any points. But predefined capacity.
|
Full Usage:
Polyline3D.distanceTo pl pt
Parameters:
Polyline3D
pt : Pnt
Returns: float
Modifiers: inline |
Returns the distance of the test point to the closest point on the Polyline3D.
|
|
|
Full Usage:
Polyline3D.equals tol a b
Parameters:
float
a : Polyline3D
b : Polyline3D
Returns: bool
|
Tests if two Polyline3D have the same number of points and points are equal within a given tolerance.
|
|
Returns the point at a given parameter on the Polyline3D. The integer part of the parameter is the index of the segment that the point is on. The fractional part of the parameter is the parameter form 0.0 to 1.0 on the segment. The domain Polyline3D starts at 0.0 and ends at point count.
|
|
Gets the length of the Polyline3D. The sum of the lengths of all segments.
|
Full Usage:
Polyline3D.map mapping pl
Parameters:
Pnt -> Pnt
pl : Polyline3D
Returns: Polyline3D
|
Apply a mapping function to each point in the 3D Polyline. Returns new Polyline3D.
|
|
Move a Polyline3D by a vector. (same as Polyline3D.translate)
|
Full Usage:
Polyline3D.moveX distance pl
Parameters:
float
pl : Polyline3D
Returns: Polyline3D
|
Returns a Polyline3D moved by a given distance in X direction.
|
Full Usage:
Polyline3D.moveY distance pl
Parameters:
float
pl : Polyline3D
Returns: Polyline3D
|
Returns a Polyline3D moved by a given distance in Y direction.
|
Full Usage:
Polyline3D.moveZ distance pl
Parameters:
float
pl : Polyline3D
Returns: Polyline3D
|
Returns a Polyline3D moved by a given distance in Z direction.
|
Full Usage:
Polyline3D.offset (polyLine, inPlaneOffsetDistance, perpendicularOffsetDistance, ?loop)
Parameters:
Polyline3D
-
A 3D Polyline, open or closed.
inPlaneOffsetDistance : float
-
The offset distance in the local plane defined by two segments.
A positive distance offsets to the inside of the polyline.
A negative distance offsets to the outside.
No matter how the polyline is oriented.
perpendicularOffsetDistance : float
-
The offset distance perpendicular to the local plane.
A positive distance offsets in the direction of the computed normal.
For a counterclockwise polyline in xy-plane this is Upwards.
A negative distance offsets in the opposite direction.
?loop : bool
-
Optional, defaults to false.
Set to true to treat an open polyline as a closed loop, even if first and last points are not at the same location.
When loop=true on an open polyline, both distance lists must contain the same number of items as the polyline has points.
Returns: Polyline3D
A new 3D polyline.
|
Offsets a Polyline in 3D space by finding the local plane in each corner. Auto-detects if given points are from a closed Polyline (first point = last point) and loops them. The reference normal is computed from the average normal of the polyline. This function raises an Exception on duplicate points, 180 degree U-turns, or colinear points.
|
Full Usage:
Polyline3D.offsetVar (polyLine, inPlaneOffsetDistance, perpendicularOffsetDistances, ?loop, ?varDistParallelBehaviour, ?considerColinearBelow, ?failAtUTurnAbove)
Parameters:
Polyline3D
-
A 3D Polyline, open or closed.
inPlaneOffsetDistance : ResizeArray<float>
-
The offset distances in the local plane defined by two segments. One distance per segment.
A positive distance offsets to the inside of the polyline.
A negative distance offsets to the outside.
No matter how the polyline is oriented.
perpendicularOffsetDistances : ResizeArray<float>
-
The offset distances perpendicular to the local plane. One distance per segment.
A positive distance offsets in the direction of the computed normal.
For a counterclockwise polyline in xy-plane this is Upwards.
A negative distance offsets in the opposite direction.
?loop : bool
-
Optional, defaults to false.
Set to true to treat an open polyline as a closed loop, even if first and last points are not at the same location.
?varDistParallelBehaviour : VarDistParallel
-
Optional, defaults to Fail.
The behavior to use when colinear segments with different offset distances are found.
?considerColinearBelow : MeasureProduct<cosine, MeasureOne>
-
Optional, defaults to 2.5 degrees in cosine measure.
The cosine of the angle below which segments are considered colinear.
?failAtUTurnAbove : MeasureProduct<cosine, MeasureOne>
-
Optional, defaults to 175 degrees in cosine measure.
The cosine of the angle above which a U-turn is considered to fail.
Returns: Polyline3D
A new 3D polyline.
|
Offsets a Polyline in 3D space by finding the local plane in each corner. Auto-detects if given points are from a closed Polyline (first point = last point) and loops them. The reference normal is computed from the average normal of the polyline. This function raises an Exception on duplicate points, 180 degree U-turns, or colinear points.
|
Full Usage:
Polyline3D.offsetVarWithRef (polyLine, inPlaneOffsetDistance, perpendicularOffsetDistances, refNormal, ?loop, ?varDistParallelBehaviour, ?considerColinearBelow, ?failAtUTurnAbove)
Parameters:
Polyline3D
-
A 3D Polyline, open or closed.
inPlaneOffsetDistance : IList<float>
-
The offset distances in the local plane defined by two segments. One distance per segment.
A positive distance offsets to the inside of the polyline (for counterclockwise polylines when refNormal points up).
A negative distance offsets to the outside.
perpendicularOffsetDistances : IList<float>
-
The offset distances perpendicular to the local plane. One distance per segment.
A positive distance offsets in the same orientation of refNormal. A negative distance offsets in the opposite direction.
refNormal : UnitVec
-
A unit vector defining an approximate normal direction for orienting the perpendicular offset and determining inside/outside.
?loop : bool
-
Optional, defaults to false.
Set to true to treat an open polyline as a closed loop, even if first and last points are not at the same location.
?varDistParallelBehaviour : VarDistParallel
-
Optional, defaults to Fail.
The behavior to use when colinear segments with different offset distances are found.
?considerColinearBelow : MeasureProduct<cosine, MeasureOne>
-
Optional, defaults to 2.5 degrees in cosine measure.
The cosine of the angle below which segments are considered colinear.
?failAtUTurnAbove : MeasureProduct<cosine, MeasureOne>
-
Optional, defaults to 175 degrees in cosine measure.
The cosine of the angle above which a U-turn is considered to fail.
Returns: Polyline3D
A new 3D polyline.
|
Offsets a Polyline in 3D space by finding the local plane in each corner. Takes a reference normal for orienting the perpendicular offset and determining inside/outside. Auto-detects if given points are from a closed Polyline (first point = last point) and loops them. This function raises an Exception on duplicate points and 180 degree U-turns.
|
Full Usage:
Polyline3D.offsetWithRef (polyLine, inPlaneOffsetDistance, perpendicularOffsetDistance, refNormal, ?loop)
Parameters:
Polyline3D
-
A 3D Polyline, open or closed.
inPlaneOffsetDistance : float
-
The offset distance in the local plane defined by two segments.
A positive distance offsets to the inside of the polyline (for counterclockwise polylines when refNormal points up).
A negative distance offsets to the outside.
perpendicularOffsetDistance : float
-
The offset distance perpendicular to the local plane.
A positive distance offsets in the same orientation of refNormal. A negative distance offsets in the opposite direction.
refNormal : UnitVec
-
A unit vector defining an approximate normal direction for orienting the perpendicular offset and determining inside/outside.
?loop : bool
-
Optional, defaults to false.
Set to true to treat an open polyline as a closed loop, even if first and last points are not at the same location.
When loop=true on an open polyline, both distance lists must contain the same number of items as the polyline has points.
Returns: Polyline3D
A new 3D polyline.
|
Offsets a Polyline in 3D space by finding the local plane in each corner. Takes a reference normal for orienting the perpendicular offset and determining inside/outside. Auto-detects if given points are from a closed Polyline (first point = last point) and loops them. This function raises an Exception on duplicate points and 180 degree U-turns.
|
|
|
|
Gets the internal list of all Points of the Polyline3D. This is not a copy, so changes to the list will be reflected in the Polyline3D.
|
Full Usage:
Polyline3D.removeColinearAndDuplicatePoints angleTolerance distanceTolerance pl
Parameters:
float<MeasureProduct<cosine, MeasureOne>>
distanceTolerance : float
pl : Polyline3D
Returns: Polyline3D
|
Removes consecutive duplicate points and colinear points from the Polyline3D within given tolerances. This algorithm allows the last and first point to be identical if the Polyline3D is closed. Colinear points are removed when the angle between segments is smaller than the cosine threshold (e.g. cosine of 0.5 degrees ). If the Polyline3D is closed and starts and ends with colinear segments, the first point is replaced with the last non-colinear point. So the joint of the loop is now moved to the last non-colinear point. So that there are no colinear segments even between start and end.
|
Full Usage:
Polyline3D.removeDuplicatePoints distanceTolerance pl
Parameters:
float
pl : Polyline3D
Returns: Polyline3D
|
Removes consecutive duplicate points from the Polyline3D within a given tolerance. This algorithm allows the last and first point to be identical if the Polyline3D is closed.
|
|
|
|
Reverse order of the Polyline3D in place.
|
|
|
Full Usage:
Polyline3D.rotate2DWithCenter cen r pl
Parameters:
Pnt
r : Rotation2D
pl : Polyline3D
Returns: Polyline3D
|
Rotation a Polyline3D round given Center point an a local Z-axis.
|
Full Usage:
Polyline3D.rotateByQuaternion q pl
Parameters:
Quaternion
pl : Polyline3D
Returns: Polyline3D
|
Multiplies (or applies) a Quaternion to the Polyline3D. The polyline is rotated around the World Origin.
|
Full Usage:
Polyline3D.rotateWithCenterByQuaternion cen q pl
Parameters:
Pnt
q : Quaternion
pl : Polyline3D
Returns: Polyline3D
|
Multiplies (or applies) a Quaternion to the Polyline3D around a given center point.
|
Full Usage:
Polyline3D.scale factor pl
Parameters:
float
pl : Polyline3D
Returns: Polyline3D
|
Scales the Polyline3D by a given factor. Scale center is World Origin 0,0,0 Returns a new Polyline3D.
|
|
|
|
|
Full Usage:
Polyline3D.subPolyline a b pl
Parameters:
float
b : float
pl : Polyline3D
Returns: Polyline3D
|
Returns new Polyline3D from point at Parameter a to point at Parameter b. if 'a' is bigger 'b' then the new Polyline3D is in opposite direction. If a parameter is within 1e-4 of an integer value, the integer value is used as parameter.
|
|
|
Full Usage:
Polyline3D.transformRigid m pl
Parameters:
RigidMatrix
pl : Polyline3D
Returns: Polyline3D
|
Multiplies (or applies) a RigidMatrix to the Polyline3D.
|
|
Move a Polyline3D by a vector. (same as Polyline3D.move)
|
Euclid