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 source-of-truth storage is an interleaved float buffer: x0, y0, z0, x1, y1, z1, ... The instance members for transformations, like Move, Scale or Rotate, and for clean up, like Reverse, Close or RemoveDuplicatePoints, mutate the Polyline3D in place and return unit. Their static counterparts, like Polyline3D.move, Polyline3D.reverse or Polyline3D.removeDuplicatePoints, return a new Polyline3D and leave the input unchanged. The indexed point setters and movers, setPoint, setPointPreservingClosure, setXYZ, setXYZPreservingClosure, movePoint, moveXYZ, movePointPreservingClosure and moveXYZPreservingClosure, and the append functions addPoint and addXYZ mutate in place and return unit, as instance and as static members. Taking a point index alone does not mean mutation: getPoint, getX, getY, getZ and getLine only read the Polyline3D. XYZs and xyzs expose the live coordinate buffer, changes to it change the Polyline3D.
Constructors
| Constructor |
Description
|
|
Create a new empty Polyline3D with predefined point count capacity.
|
Instance members
| Instance member |
Description
|
|
Adds a point to the end of the Polyline3D.
|
Full Usage:
this.AddXYZ
Parameters:
float
y : float
z : float
|
Adds a point from x, y, and z coordinates.
|
Full Usage:
this.AreaIn2D
Returns: float
|
Calculates the area of the Polyline3D when projected in 2D. Z values are ignored. The segment from the last point to the first point is included in the area calculation. For self-intersecting Polylines the result is invalid.
|
Full Usage:
this.AsFSharpCode
Returns: string
|
Format a 3D polyline into an F# code string that can be used to recreate the polyline.
|
|
Converts the float buffer of the Polyline3D into a list of Points. Use .XYZs to access the live internal buffer.
|
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. The returned vector is not unitized, its length is twice the area of the polygon projected onto that plane. Fails if the summed normal is shorter than 1e-6, because then no normal can be found. This happens if: the Polyline3D has less than 3 points, or all points are in one line, or the cross products cancel each other out on a self intersecting shape, or the Polyline3D is very small. Use TryAverageNormal to get ValueNone instead of an exception. For the last two cases Polyline3D.AveragePlane still finds a plane.
|
|
Returns the average plane of the Polyline3D, even if the points are not planar. As opposed to Polyline3D.TryPlane this does not check if all points are on that plane. The origin of the returned NPlane is the average of all points, see Polyline3D.Center. The normal is the unitized Polyline3D.AverageNormal, so it follows the order of the points. If they are counter-clockwise in the World X-Y plane, then the normal points in World Z direction. On self intersecting shapes, where these cross products cancel each other out, the orientation is arbitrary. The optional 'tolerance' is the maximum distance for considering all points to be on one point or on one line, it defaults to 1e-6. Fails if the Polyline3D has less than 3 points, or if all points are within the tolerance of one point or of one line, because then there is no unique plane.
|
|
Gets the 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.Close
Parameters:
float
-
Optional. 1e-6 by default
The tolerance used to decide whether to snap the last point to the first point.
|
Closes the Polyline3D in place if it is not already closed. If the ends are closer than the tolerance, the last point is set equal to the first point. Otherwise the start point is added to the end of the Polyline3D. Raises an error if the Polyline3D has fewer than 3 points.
|
|
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 from 0.0 to 1.0 on the segment. The domain Polyline3D starts at 0.0 and ends at points.Count - 1.0 .
|
Full Usage:
this.ClosestParameterXYZ
Parameters:
float
y : float
z : float
Returns: float
|
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 from 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 Polyline3D's point list of the point that is closest to the given point.
|
|
Returns the distance of the test point to the closest point on the Polyline3D.
|
Full Usage:
this.DistanceToXYZ
Parameters:
float
y : float
z : float
Returns: float
|
Returns the distance of the test point to the closest point on the Polyline3D.
|
|
Creates a copy of the Polyline3D Same as polyline.Clone()
|
Gets or sets the last or end point of the Polyline3D. This is the point at index Points.Count - 1. Same as Polyline3D.LastPoint Setting it mutates the Polyline3D in place and moves only this one point, so a closed Polyline3D gets opened. Use SetXYZPreservingClosure or MovePointPreservingClosure to keep it closed.
|
|
Full Usage:
this.EnsureClockwiseIn2D
|
Tests if the Polyline3D is Clockwise when projected in 2D (Z values are ignored). If not, reverses the Polyline3D in place. Raises an error if the area of the Polyline3D in 2D is zero. |
Full Usage:
this.EnsureCounterClockwiseIn2D
|
Tests if the Polyline3D is counter-clockwise when projected in 2D (Z values are ignored). If not, reverses the Polyline3D in place. Raises an error if the area of the Polyline3D in 2D is zero. |
|
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 from 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.
|
|
Gets or sets the first point of the Polyline3D. This is the point at index 0. Same as Polyline3D.Start Setting it mutates the Polyline3D in place and moves only this one point, so a closed Polyline3D gets opened. Use SetXYZPreservingClosure or MovePointPreservingClosure to keep it closed.
|
|
Gets the first segment of the Polyline3D.
|
|
Gets the 3D point at the given pointIndex in the list of points. (this gets Pnt(XYZs.[pointIndex * 3], XYZs.[pointIndex * 3 + 1], XYZs.[pointIndex * 3 + 2]) from the internal flat list of x, y, and z coordinates )
|
|
|
Full Usage:
this.GetX
Parameters:
int
Returns: float
|
Gets the x coordinate of the 3D point at the given pointIndex in the list of points. (this gets XYZs.[pointIndex * 3] from the internal flat list of x, y, and z coordinates )
|
Full Usage:
this.GetY
Parameters:
int
Returns: float
|
Gets the y coordinate of the 3D point at the given pointIndex in the list of points. (this gets XYZs.[pointIndex * 3 + 1] from the internal flat list of x, y, and z coordinates )
|
Full Usage:
this.GetZ
Parameters:
int
Returns: float
|
Gets the z coordinate of the 3D point at the given pointIndex in the list of points. (this gets XYZs.[pointIndex * 3 + 2] from the internal flat list of x, y, and z coordinates )
|
Full Usage:
this.IsAlmostClosed
Parameters:
float
Returns: bool
|
Tests if Polyline3D is closed within given tolerance. Returns FALSE if the Polyline3D has fewer 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 negative the Polyline3D is Clockwise.
|
Full Usage:
this.IsClosed
Returns: bool
|
Tests if Polyline3D start and end points are exactly the same. Returns FALSE if the Polyline3D has fewer than 3 points.
|
Full Usage:
this.IsCounterClockwiseIn2D
Returns: bool
|
Test if Polyline3D is counter-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 counter-clockwise.
|
Full Usage:
this.IsPlanar
Parameters:
float
Returns: bool
|
Tests if all points of the Polyline3D lie in one plane. The optional 'tolerance' is the maximum distance any point may have from that plane, it defaults to 1e-6. Returns FALSE if the Polyline3D has less than 3 points, or if all points are within the tolerance of one point or of one line, because then there is no unique plane.
|
|
Gets or sets the last point of the Polyline3D. This is the point at index Points.Count - 1. Same as Polyline3D.End Setting it mutates the Polyline3D in place and moves only this one point, so a closed Polyline3D gets opened. Use SetXYZPreservingClosure or MovePointPreservingClosure to keep it closed.
|
|
Gets the last segment of the Polyline3D.
|
Full Usage:
this.Length
Returns: float
|
Gets the length of the Polyline3D. The sum of the lengths of all segments. Returns 0.0 if there are fewer than 2 points.
|
Moves the Polyline3D in place by a vector.
|
|
Full Usage:
this.MovePoint
Parameters:
int
-
The index of the point to move. Must be between 0 and PointCount - 1.
v : Vec
-
The vector to move the point by.
|
Moves the 3D point at the given pointIndex in place by a vector. NOTE: moving the first or last point on a closed Polyline3D opens it. Use MovePointPreservingClosure to keep it closed. (this adds v.X, v.Y and v.Z to XYZs.[pointIndex * 3], XYZs.[pointIndex * 3 + 1] and XYZs.[pointIndex * 3 + 2] in the internal flat list of x, y, and z coordinates )
|
Full Usage:
this.MovePointPreservingClosure
Parameters:
int
-
The index of the point to move. Must be between 0 and PointCount - 1.
v : Vec
-
The vector to move the point by.
|
Moves the 3D point at the given pointIndex in place by a vector. On a closed Polyline3D, moving the first or last point moves both, so it stays closed. (this adds v.X, v.Y and v.Z to XYZs.[pointIndex * 3], XYZs.[pointIndex * 3 + 1] and XYZs.[pointIndex * 3 + 2] in the internal flat list of x, y, and z coordinates )
|
Full Usage:
this.MoveX
Parameters:
float
|
Moves the Polyline3D in place by a given distance in X direction.
|
Full Usage:
this.MoveXYZ
Parameters:
int
-
The index of the point to move. Must be between 0 and PointCount - 1.
x : float
-
The distance to move the point in X direction.
y : float
-
The distance to move the point in Y direction.
z : float
-
The distance to move the point in Z direction.
|
Moves the 3D point at the given pointIndex in place by the given x, y, and z distances. NOTE: moving the first or last point on a closed Polyline3D opens it. Use MoveXYZPreservingClosure to keep it closed. (this adds x, y and z to XYZs.[pointIndex * 3], XYZs.[pointIndex * 3 + 1] and XYZs.[pointIndex * 3 + 2] in the internal flat list of x, y, and z coordinates )
|
Full Usage:
this.MoveXYZPreservingClosure
Parameters:
int
-
The index of the point to move. Must be between 0 and PointCount - 1.
x : float
-
The distance to move the point in X direction.
y : float
-
The distance to move the point in Y direction.
z : float
-
The distance to move the point in Z direction.
|
Moves the 3D point at the given pointIndex in place by the given x, y, and z distances. On a closed Polyline3D, moving the first or last point moves both, so it stays closed. (this adds x, y and z to XYZs.[pointIndex * 3], XYZs.[pointIndex * 3 + 1] and XYZs.[pointIndex * 3 + 2] in the internal flat list of x, y, and z coordinates )
|
Full Usage:
this.MoveY
Parameters:
float
|
Moves the Polyline3D in place by a given distance in Y direction.
|
Full Usage:
this.MoveZ
Parameters:
float
|
Moves the Polyline3D in place by a given distance in Z direction.
|
Full Usage:
this.PointCount
Returns: int
|
Gets the number of points in the Polyline3D.
|
Full Usage:
this.RemoveDuplicateAndCollinearPoints
Parameters:
float<MeasureProduct<cosine, MeasureOne>>
distanceTolerance : float
|
Removes consecutive duplicate points and collinear points from the Polyline3D in place, within given tolerances. This algorithm allows the last and first point to be identical if the Polyline3D is closed. Collinear 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 collinear segments, the first point is replaced with the last non-collinear point. So the joint of the loop is now moved to the last non-collinear point. So that there are no collinear segments even between start and end. Raises an error if all points are within the distanceTolerance of the first point. In that case the Polyline3D is not changed.
|
Full Usage:
this.RemoveDuplicatePoints
Parameters:
float
-
The distance within which points are considered duplicates.
|
Removes consecutive duplicate points from the Polyline3D in place, within a given tolerance. From a cluster of points that are closer than the distanceTolerance, only the first point is kept. Use 'RemoveDuplicatePointsFaithfully' if you want to keep the edges in their position by re-intersecting segments. The position of start and end point is NOT changed. Use Close to ensure start and end point are identical.
|
Full Usage:
this.RemoveDuplicatePointsAndReport
Parameters:
float
-
The distance within which points are considered duplicates.
Returns: ResizeArray<Pnt>
The removed duplicate points, with consecutive identical entries listed once per run.
An empty list if no duplicates were found and the Polyline3D was not changed.
|
Removes consecutive duplicate points from the Polyline3D in place, within a given tolerance, and returns them. Same as 'RemoveDuplicatePoints', but also reports the points that were removed.
|
Full Usage:
this.RemoveDuplicatePointsFaithfully
Parameters:
float
-
The distance within which points are considered duplicates.
|
Removes consecutive duplicate points from the Polyline3D in place, within a given tolerance. This algorithm keeps edges in their position by re-intersecting segments at their closest approach if points are closer than the distanceTolerance but not identical. The position of start and end point is NOT changed. Use Close to ensure start and end point are identical.
|
Full Usage:
this.RemoveUTurns
Parameters:
float<MeasureProduct<cosine, MeasureOne>>
-
The angle between segments so that they are considered a U-turn.
For example, for 179.9 degrees use 'Cosine.``179.9``'.
|
Removes simple sharp U-Turns from the Polyline3D in place. The Offset3D module also has a removeUTurns function that takes precomputed unit vectors and is therefore more efficient. For nested U-turns and collinear points in U-turns segments use 'RemoveUTurnsDeeply'. That function calls repeatedly until no more U-turns are present.
|
Full Usage:
this.RemoveUTurnsDeeply
Parameters:
float<MeasureProduct<cosine, MeasureOne>>
-
The angle between segments so that they are considered a U-turn.
For example, for 179.9 degrees use 'Cosine.``179.9``'.
|
Removes all sharp U-Turns from the Polyline3D in place, recursively until no more U-turns are present. This function calls 'RemoveUTurns' repeatedly until no more U-turns are present. Use this function when you have nested U-turns and collinear points in U-turns segments. If an error is raised in any of the repeated calls, the Polyline3D is not changed.
|
Full Usage:
this.Reverse
|
Reverses the order of the Polyline3D in place. |
|
Multiplies (or applies) a Quaternion to the Polyline3D in place. The polyline is rotated around the World Origin.
|
Full Usage:
this.RotateAround
Parameters:
Pnt
-
The center point of the rotation.
q : Quaternion
-
The rotation to apply.
|
Multiplies (or applies) a Quaternion to the Polyline3D in place, to rotate around a given center point.
|
|
Rotates the Polyline3D in place around the Z-axis.
|
|
Rotates the Polyline3D in place around the local Z-axis through the given center point.
|
Full Usage:
this.Scale
Parameters:
float
|
Scales the Polyline3D in place by a given factor. Scale center is World Origin 0,0,0
|
Full Usage:
this.ScaleOn
Parameters:
Pnt
-
The center point of the scaling.
factor : float
-
The scale factor.
|
Scales the Polyline3D in place by a given factor around a given center point.
|
|
Gets or sets the second last point of the Polyline3D. Setting it mutates the Polyline3D in place.
|
|
Gets or sets the second point of the Polyline3D. This is the point at index 1. Setting it mutates the Polyline3D in place.
|
Full Usage:
this.SegmentCount
Returns: int
|
Gets the number of segments in the Polyline3D. This is the point count minus one, but never negative.
|
|
Returns the line vectors of all segments of the Polyline3D as a list of Vec. The length of the list is one less than the point count.
|
Full Usage:
this.SegmentVectorsXYZ
Returns: ResizeArray<float>
|
Returns the line vectors of all segments of the Polyline3D as a flat list of x, y, and z components. The length of the list is 3 less than the xyzs count, so one less vector than points in the polyline.
|
|
Returns all segments of the Polyline3D as a list of Line3D.
|
|
Sets the 3D point at the given pointIndex in the list of points. (this sets XYZs.[pointIndex * 3], XYZs.[pointIndex * 3 + 1], and XYZs.[pointIndex * 3 + 2] in the internal flat list of x, y, and z coordinates )
|
|
Sets the 3D point at the given pointIndex in the list of points. On a closed Polyline3D, setting the first or last point will set both to the same point. Raises an error if the pointIndex is out of range. (this sets XYZs.[pointIndex * 3], XYZs.[pointIndex * 3 + 1], and XYZs.[pointIndex * 3 + 2] in the internal flat list of x, y, and z coordinates )
|
Full Usage:
this.SetXYZ
Parameters:
int
x : float
y : float
z : float
|
Sets the x, y, and z coordinates of the 3D point at the given pointIndex in the list of points. NOTE: setting the first or last point on a closed Polyline3D might open it. (this sets XYZs.[pointIndex * 3], XYZs.[pointIndex * 3 + 1], and XYZs.[pointIndex * 3 + 2] in the internal flat list of x, y, and z coordinates )
|
Full Usage:
this.SetXYZPreservingClosure
Parameters:
int
x : float
y : float
z : float
|
Sets the x, y, and z coordinates of the 3D point at the given pointIndex in the list of points. On a closed Polyline3D, setting the first or last point will set both to the same point. Raises an error if the pointIndex is out of range. (this sets XYZs.[pointIndex * 3], XYZs.[pointIndex * 3 + 1], and XYZs.[pointIndex * 3 + 2] in the internal flat list of x, y, and z coordinates )
|
Full Usage:
this.SignedAreaIn2D
Returns: float
|
Calculates the signed area of the Polyline3D when projected in 2D. Z values are ignored. If it is positive the Polyline3D is counter-clockwise. Polyline does not need to be exactly closed. The segment from the last point to the first point is included in the area calculation. For self-intersecting Polylines the result is invalid. Raises an error on an empty Polyline3D.
|
|
Gets or sets the first point of the Polyline3D. This is the point at index 0. Same as Polyline3D.FirstPoint Setting it mutates the Polyline3D in place and moves only this one point, so a closed Polyline3D gets opened. Use SetXYZPreservingClosure or MovePointPreservingClosure to keep it closed.
|
|
Applies or multiplies a 4x4 transformation matrix to the Polyline3D in place.
|
|
Multiplies (or applies) a RigidMatrix to the Polyline3D in place.
|
|
Returns the average normal vector of the Polyline3D, or ValueNone if it is degenerate. It is calculated by summing up the cross products of all segments around the center point, so it is the same vector as Polyline3D.AverageNormal, but bad input returns ValueNone instead of raising an exception. The returned vector is not unitized, its length is twice the area of the polygon projected onto that plane. Returns ValueNone if the summed normal is shorter than 1e-6. This happens if: the Polyline3D has less than 3 points, or all points are in one line, or the cross products cancel each other out on a self intersecting shape, or the Polyline3D is very small. For these last two cases Polyline3D.TryAveragePlane still finds a plane.
|
|
Tries to find the average plane of the Polyline3D, even if the points are not planar. As opposed to Polyline3D.TryPlane this does not check if all points are on that plane. The origin of the returned NPlane is the average of all points, see Polyline3D.Center. The normal is the unitized Polyline3D.AverageNormal, so it follows the order of the points. If they are counter-clockwise in the World X-Y plane, then the normal points in World Z direction. On self intersecting shapes, where these cross products cancel each other out, the orientation is arbitrary. The optional 'tolerance' is the maximum distance for considering all points to be on one point or on one line, it defaults to 1e-6. Returns ValueNone if the Polyline3D has less than 3 points, or if all points are within the tolerance of one point or of one line, because then there is no unique plane.
|
|
Tries to find the plane that all points of the Polyline3D lie in. The optional 'tolerance' is the maximum distance any point may have from the plane, it defaults to 1e-6. The origin of the returned NPlane is the average of all points, see Polyline3D.Center. The orientation of the normal follows the order of the points. If they are counter-clockwise in the World X-Y plane, then the normal points in World Z direction. On self intersecting shapes, where these cross products cancel each other out, the orientation is arbitrary. Returns ValueNone if: the Polyline3D has less than 3 points, or all points are within the tolerance of one point or of one line, so that there is no unique plane, or any point is further away from the plane than the tolerance. Use Polyline3D.TryAveragePlane to get the average plane of non planar points too.
|
Full Usage:
this.XYZs
Returns: ResizeArray<float>
|
Gets the X, Y and Z interleaved ResizeArray of the Polyline3D: x0, y0, z0, x1, y1, z1, ... This is the live internal buffer, so changes to the list will be reflected in the Polyline3D.
|
Static members
| Static member |
Description
|
|
Adds a point to the end of the Polyline3D.
|
Full Usage:
Polyline3D.addXYZ x y z p
Parameters:
float
y : float
z : float
p : Polyline3D
Modifiers: inline |
Adds a point from x, y, and z coordinates.
|
|
Calculates the area of the Polyline3D when projected in 2D. Z values are ignored. The segment from the last point to the first point is included in the area calculation. For self-intersecting Polylines the result is invalid.
|
Full Usage:
Polyline3D.asFSharpCode pl
Parameters:
Polyline3D
Returns: string
Modifiers: inline |
Format a 3D polyline into an F# code string that can be used to recreate the polyline.
|
Full Usage:
Polyline3D.asPoints p
Parameters:
Polyline3D
Returns: ResizeArray<Pnt>
Modifiers: inline |
Converts the float buffer of the Polyline3D into a list of Points. Use .XYZs to access the live internal buffer.
|
|
|
|
Returns the average normal vector of the Polyline3D. It is calculated by summing up the cross products of all segments around the center point. The returned vector is not unitized, its length is twice the area of the polygon projected onto that plane. Fails if the summed normal is shorter than 1e-6, because then no normal can be found. This happens if: the Polyline3D has less than 3 points, or all points are in one line, or the cross products cancel each other out on a self intersecting shape, or the Polyline3D is very small. Use tryAverageNormal to get ValueNone instead of an exception. For the last two cases Polyline3D.averagePlane still finds a plane.
|
Full Usage:
Polyline3D.averagePlane tolerance pl
Parameters:
float
pl : Polyline3D
Returns: NPlane
Modifiers: inline |
Returns the average plane of the Polyline3D, even if the points are not planar. As opposed to Polyline3D.tryPlane this does not check if all points are on that plane. The origin of the returned NPlane is the average of all points, see Polyline3D.center. The normal is the unitized Polyline3D.averageNormal, so it follows the order of the points. If they are counter-clockwise in the World X-Y plane, then the normal points in World Z direction. On self intersecting shapes, where these cross products cancel each other out, the orientation is arbitrary. The 'tolerance' is the maximum distance for considering all points to be on one point or on one line. Use 1e-6 as a default. Fails if the Polyline3D has less than 3 points, or if all points are within the tolerance of one point or of one line, because then there is no unique plane.
|
|
|
|
|
|
|
Full Usage:
Polyline3D.close toleranceForAddingPoint pl
Parameters:
float
-
The tolerance used to decide whether to snap the last point to the first point.
pl : Polyline3D
-
The Polyline3D to close.
Returns: Polyline3D
A new closed Polyline3D. Use p.Close to close in place.
|
Returns a new closed Polyline3D. The input Polyline3D is not changed. If the ends are closer than the tolerance, the last point is set equal to the first point. Otherwise the start point is added to the end of the Polyline3D. Raises an error if the Polyline3D has fewer than 3 points.
|
Full Usage:
Polyline3D.closestParameter pnt pl
Parameters:
Pnt
pl : Polyline3D
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 from 0.0 to 1.0 on the segment. The domain Polyline3D starts at 0.0 and ends at points.Count - 1.0 .
|
Full Usage:
Polyline3D.closestParameterXYZ x y z pl
Parameters:
float
y : float
z : float
pl : Polyline3D
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 from 0.0 to 1.0 on the segment. The domain Polyline3D starts at 0.0 and ends at points.Count - 1.0 .
|
Full Usage:
Polyline3D.closestPoint pnt pl
Parameters:
Pnt
pl : Polyline3D
Returns: Pnt
Modifiers: inline |
Returns the point on the Polyline3D that is the closest point to the given point. This might be a point on a segment or a vertex of the Polyline3D.
|
Full Usage:
Polyline3D.closestPointIndex pnt pl
Parameters:
Pnt
pl : Polyline3D
Returns: int
Modifiers: inline |
Returns the index into the Polyline3D's point list of the point that is closest to the given point.
|
Full Usage:
Polyline3D.createEmpty capacity
Parameters:
int
Returns: Polyline3D
Modifiers: inline |
Create a new empty Polyline3D without any points. But predefined capacity.
|
Full Usage:
Polyline3D.createFromMembersXY xyObjs
Parameters:
^T seq
Returns: Polyline3D
Modifiers: inline Type parameters: ^T, ^a, ^b (requires (member get_X : ^T -> ^a) and (member get_Y : ^T -> ^b) and (static member op_Explicit : ^a -> Microsoft.FSharp.Core.float) and (static member op_Explicit : ^b -> Microsoft.FSharp.Core.float)) |
Creates a Polyline3D from a list of objects with X and Y members (uppercase), using 0.0 for Z.
|
Full Usage:
Polyline3D.createFromMembersXYZ xyzObjs
Parameters:
^T seq
Returns: Polyline3D
Modifiers: inline Type parameters: ^T, ^a, ^b, ^c (requires (member get_X : ^T -> ^a) and (member get_Y : ^T -> ^b) and (member get_Z : ^T -> ^c) and (static member op_Explicit : ^a -> Microsoft.FSharp.Core.float) and (static member op_Explicit : ^b -> Microsoft.FSharp.Core.float) and (static member op_Explicit : ^c -> Microsoft.FSharp.Core.float)) |
Creates a Polyline3D from a list of objects with X, Y, and Z members (uppercase).
|
Full Usage:
Polyline3D.createFromMembersxy xyObjs
Parameters:
^T seq
Returns: Polyline3D
Modifiers: inline Type parameters: ^T, ^a, ^b (requires (member get_x : ^T -> ^a) and (member get_y : ^T -> ^b) and (static member op_Explicit : ^a -> Microsoft.FSharp.Core.float) and (static member op_Explicit : ^b -> Microsoft.FSharp.Core.float)) |
Creates a Polyline3D from a list of objects with x and y members (lowercase), using 0.0 for z.
|
Full Usage:
Polyline3D.createFromMembersxyz xyzObjs
Parameters:
^T seq
Returns: Polyline3D
Modifiers: inline Type parameters: ^T, ^a, ^b, ^c (requires (member get_x : ^T -> ^a) and (member get_y : ^T -> ^b) and (member get_z : ^T -> ^c) and (static member op_Explicit : ^a -> Microsoft.FSharp.Core.float) and (static member op_Explicit : ^b -> Microsoft.FSharp.Core.float) and (static member op_Explicit : ^c -> Microsoft.FSharp.Core.float)) |
Creates a Polyline3D from a list of objects with x, y, and z members (lowercase).
|
|
Create a new Polyline3D by copying over all points. This will allocate a new ResizeArray and copy all points.
|
|
Creates a closed Polyline3D starting at the Origin, going to x, then x+y, then y and back to origin.
|
Full Usage:
Polyline3D.createFromXYZs xyzs
Parameters:
ResizeArray<float>
Returns: Polyline3D
|
Create a new Polyline3D by using the provided X, Y and Z interleaved ResizeArray directly. The buffer is shared, not copied: later changes to the ResizeArray will be reflected in the Polyline3D, and vice versa.
|
Full Usage:
Polyline3D.distanceToPnt pnt pl
Parameters:
Pnt
pl : Polyline3D
Returns: float
Modifiers: inline |
Returns the distance of the test point to the closest point on the Polyline3D.
|
Full Usage:
Polyline3D.distanceToXYZ x y z pl
Parameters:
float
y : float
z : float
pl : Polyline3D
Returns: float
Modifiers: inline |
Returns the distance of the test point to the closest point on the Polyline3D.
|
Full Usage:
Polyline3D.duplicate pl
Parameters:
Polyline3D
Returns: Polyline3D
Modifiers: inline |
|
|
Gets the last or end point of the Polyline3D. This is the point at index Points.Count - 1. Same as Polyline3D.LastPoint
|
Full Usage:
Polyline3D.ensureClockwiseIn2D pl
Parameters:
Polyline3D
Returns: Polyline3D
Modifiers: inline |
Returns a new Polyline3D that is Clockwise when projected in 2D (Z values are ignored). It is reversed if the input is counter-clockwise. The input Polyline3D is not changed. Raises an error if the area of the Polyline3D in 2D is zero.
|
Full Usage:
Polyline3D.ensureCounterClockwiseIn2D pl
Parameters:
Polyline3D
Returns: Polyline3D
Modifiers: inline |
Returns a new Polyline3D that is counter-clockwise when projected in 2D (Z values are ignored). It is reversed if the input is clockwise. The input Polyline3D is not changed. Raises an error if the area of the Polyline3D in 2D is zero.
|
Full Usage:
Polyline3D.equalsExact pl1 pl2
Parameters:
Polyline3D
-
The first Polyline3D instance.
pl2 : Polyline3D
-
The second Polyline3D instance.
Returns: bool
TRUE if the two Polyline3D instances are equal, otherwise FALSE.
|
Tests if two Polyline3D have the same point count and if their corresponding points are exactly equal. The same instance is always equal to itself. Otherwise a NaN coordinate is never equal.
|
Full Usage:
Polyline3D.equalsWithin tol pl1 pl2
Parameters:
float
-
The tolerance value for comparing each coordinate.
pl1 : Polyline3D
-
The first Polyline3D instance.
pl2 : Polyline3D
-
The second Polyline3D instance.
Returns: bool
TRUE if the two Polyline3D instances are equal within the tolerance, otherwise FALSE.
|
Tests if two Polyline3D have the same point count and if their corresponding points are equal within a given tolerance. The tolerance applies to the X, Y and Z coordinates of each point separately, not to the Euclidean distance between the points. The same instance is always equal to itself. Otherwise a NaN coordinate is never equal. Use Polyline3D.equalsExact to check for an exact match.
|
|
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 from 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:
Polyline3D.findAllSelfIntersections pl
Parameters:
Polyline3D
-
The polyline to search.
Returns: ResizeArray<Pnt * int * int>
A new list of points on the first segment with the indices of the two intersecting segments,
sorted by the first and then by the second segment index. The first index is always smaller than the second.
The list is empty if no intersection is found.
|
Finds all intersections between non-adjacent segments in O(n²) time, with the same rules as Polyline3D.tryFindSelfIntersection: Excludes the closure joint when endpoints are within 1e-7, parallel overlaps (angle below 0.25 degrees), and segments shorter than 1e-6. Uses the XLine3D endpoint parameter tolerance of 1e-6. The closest separation must be less than 1e-6. Use Polyline3D.findAllSelfIntersectionsWithin to set this tolerance.
|
Full Usage:
Polyline3D.findAllSelfIntersectionsWithin maxSkewDistance pl
Parameters:
float
-
Finite, nonnegative separation tolerance.
pl : Polyline3D
-
The polyline to search.
Returns: ResizeArray<Pnt * int * int>
A new list of points on the first segment with the indices of the two intersecting segments,
sorted by the first and then by the second segment index. The first index is always smaller than the second.
The list is empty if no intersection is found.
|
Finds all intersections between non-adjacent segments in O(n²) time, with the same rules as Polyline3D.tryFindSelfIntersectionWithin: Excludes the closure joint when endpoints are within 1e-7, parallel overlaps (angle below 0.25 degrees), and segments shorter than 1e-6. Uses the XLine3D endpoint parameter tolerance of 1e-6. The closest separation must be strictly less than maxSkewDistance; zero therefore finds no intersections. Use Polyline3D.findAllSelfIntersections for the default maxSkewDistance of 1e-6.
|
|
Gets the first point of the Polyline3D. This is the point at index 0. Same as Polyline3D.Start
|
Full Usage:
Polyline3D.firstSegment pl
Parameters:
Polyline3D
Returns: Line3D
Modifiers: inline |
|
Full Usage:
Polyline3D.getPoint pointIndex p
Parameters:
int
p : Polyline3D
Returns: Pnt
Modifiers: inline |
Gets the 3D point at the given pointIndex in the list of points. (this gets Pnt(XYZs.[pointIndex * 3], XYZs.[pointIndex * 3 + 1], XYZs.[pointIndex * 3 + 2]) from the internal flat list of x, y, and z coordinates )
|
Full Usage:
Polyline3D.getSegment i pl
Parameters:
int
pl : Polyline3D
Returns: Line3D
Modifiers: inline |
|
Full Usage:
Polyline3D.getX pointIndex p
Parameters:
int
p : Polyline3D
Returns: float
Modifiers: inline |
Gets the x coordinate of the 3D point at the given pointIndex in the list of points. (this gets XYZs.[pointIndex * 3] from the internal flat list of x, y, and z coordinates )
|
Full Usage:
Polyline3D.getY pointIndex p
Parameters:
int
p : Polyline3D
Returns: float
Modifiers: inline |
Gets the y coordinate of the 3D point at the given pointIndex in the list of points. (this gets XYZs.[pointIndex * 3 + 1] from the internal flat list of x, y, and z coordinates )
|
Full Usage:
Polyline3D.getZ pointIndex p
Parameters:
int
p : Polyline3D
Returns: float
Modifiers: inline |
Gets the z coordinate of the 3D point at the given pointIndex in the list of points. (this gets XYZs.[pointIndex * 3 + 2] from the internal flat list of x, y, and z coordinates )
|
Full Usage:
Polyline3D.isAlmostClosed tolerance pl
Parameters:
float
pl : Polyline3D
Returns: bool
Modifiers: inline |
Tests if Polyline3D is closed within given tolerance. Returns FALSE if the Polyline3D has fewer than 3 points.
|
Full Usage:
Polyline3D.isClockwiseIn2D pl
Parameters:
Polyline3D
Returns: bool
Modifiers: inline |
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 negative the Polyline3D is Clockwise.
|
|
Tests if Polyline3D start and end points are exactly the same. Returns FALSE if the Polyline3D has fewer than 3 points.
|
Full Usage:
Polyline3D.isCounterClockwiseIn2D pl
Parameters:
Polyline3D
Returns: bool
Modifiers: inline |
Test if Polyline3D is counter-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 counter-clockwise.
|
Full Usage:
Polyline3D.isPlanar tolerance pl
Parameters:
float
pl : Polyline3D
Returns: bool
Modifiers: inline |
Tests if all points of the Polyline3D lie in one plane. The 'tolerance' is the maximum distance any point may have from that plane. Use 1e-6 as a default. Returns FALSE if the Polyline3D has less than 3 points, or if all points are within the tolerance of one point or of one line, because then there is no unique plane.
|
Full Usage:
Polyline3D.iter action pl
Parameters:
float -> float -> float -> unit
-
A function that takes the X, Y and Z coordinates of a point.
pl : Polyline3D
-
The Polyline3D to iterate over.
Modifiers: inline |
Iterate over each point in the Polyline3D.
|
Full Usage:
Polyline3D.iterLineSegments action pl
Parameters:
Line3D -> unit
-
A function that takes a Line3D representing the segment.
pl : Polyline3D
-
The Polyline3D to iterate over.
Modifiers: inline |
Iterate over each segment in the Polyline3D.
|
Full Usage:
Polyline3D.iterPnt action pl
Parameters:
Pnt -> unit
-
A function that takes a point.
pl : Polyline3D
-
The Polyline3D to iterate over.
|
Iterate over each point in the Polyline3D.
|
Full Usage:
Polyline3D.iterSegments action pl
Parameters:
float -> float -> float -> float -> float -> float -> unit
-
A function that takes startX, startY, startZ, endX, endY, and endZ coordinates of a segment.
pl : Polyline3D
-
The Polyline3D to iterate over.
Modifiers: inline |
Iterate over each segment in the Polyline3D.
|
Full Usage:
Polyline3D.iteri action pl
Parameters:
int -> float -> float -> float -> unit
-
A function that takes the index of the X coordinate (in the flat coordinate array) and the X, Y and Z coordinates of a point.
pl : Polyline3D
-
The Polyline3D to iterate over.
|
Iterate over each point in the Polyline3D with index.
|
Full Usage:
Polyline3D.iteriPnt action pl
Parameters:
int -> Pnt -> unit
-
A function that takes the pointIndex of the point ( = array index/3) and the point itself.
pl : Polyline3D
-
The Polyline3D to iterate over.
|
Iterate over each point in the Polyline3D with index.
|
|
Gets the last point of the Polyline3D. This is the point at index Points.Count - 1. Same as Polyline3D.End
|
|
|
|
Gets the length of the Polyline3D. The sum of the lengths of all segments. Returns 0.0 if there are fewer than 2 points.
|
Full Usage:
Polyline3D.map mapping pl
Parameters:
float -> float -> float -> Pnt
-
A function that takes the X, Y and Z coordinates of a point and returns a new point.
pl : Polyline3D
-
The Polyline3D to map over.
Returns: Polyline3D
A new Polyline3D with the mapped points.
|
Apply a mapping function to each point in the Polyline3D. Returns new Polyline3D.
|
Full Usage:
Polyline3D.mapPnt mapping pl
Parameters:
Pnt -> Pnt
-
A function that takes a point and returns a new point.
pl : Polyline3D
-
The Polyline3D to map over.
Returns: Polyline3D
A new Polyline3D with the mapped points.
|
Apply a mapping function to each point in the Polyline3D. Returns new Polyline3D.
|
Full Usage:
Polyline3D.mapi mapping pl
Parameters:
int -> float -> float -> float -> Pnt
-
A function that takes the index of the X coordinate (in the flat coordinate array) and the X, Y and Z coordinates of a point and returns a new point.
pl : Polyline3D
-
The Polyline3D to map over.
Returns: Polyline3D
A new Polyline3D with the mapped points.
|
Apply a mapping function to each point in the Polyline3D with index. Returns new Polyline3D.
|
Full Usage:
Polyline3D.mapiPnt mapping pl
Parameters:
int -> Pnt -> Pnt
-
A function that takes the pointIndex of the point ( = array index/3) and the point itself, and returns a new point.
pl : Polyline3D
-
The Polyline3D to map over.
Returns: Polyline3D
A new Polyline3D with the mapped points.
|
Apply a mapping function to each point in the Polyline3D with the pointIndex (not the index into the flat coordinate array). Returns new Polyline3D.
|
|
Returns a new Polyline3D moved by a vector. The input Polyline3D is not changed.
|
Full Usage:
Polyline3D.movePoint pointIndex v p
Parameters:
int
-
The index of the point to move. Must be between 0 and PointCount - 1.
v : Vec
-
The vector to move the point by.
p : Polyline3D
-
The Polyline3D to change.
Modifiers: inline |
Moves the 3D point at the given pointIndex in place by a vector. NOTE: moving the first or last point on a closed Polyline3D opens it. Use Polyline3D.movePointPreservingClosure to keep it closed.
|
Full Usage:
Polyline3D.movePointPreservingClosure pointIndex v p
Parameters:
int
-
The index of the point to move. Must be between 0 and PointCount - 1.
v : Vec
-
The vector to move the point by.
p : Polyline3D
-
The Polyline3D to change.
Modifiers: inline |
Moves the 3D point at the given pointIndex in place by a vector. On a closed Polyline3D, moving the first or last point moves both, so it stays closed.
|
Full Usage:
Polyline3D.moveX distance pl
Parameters:
float
pl : Polyline3D
Returns: Polyline3D
|
Returns a new Polyline3D moved by a given distance in X direction. The input Polyline3D is not changed.
|
Full Usage:
Polyline3D.moveXYZ pointIndex x y z p
Parameters:
int
-
The index of the point to move. Must be between 0 and PointCount - 1.
x : float
-
The distance to move the point in X direction.
y : float
-
The distance to move the point in Y direction.
z : float
-
The distance to move the point in Z direction.
p : Polyline3D
-
The Polyline3D to change.
Modifiers: inline |
Moves the 3D point at the given pointIndex in place by the given x, y, and z distances. NOTE: moving the first or last point on a closed Polyline3D opens it. Use Polyline3D.moveXYZPreservingClosure to keep it closed.
|
Full Usage:
Polyline3D.moveXYZPreservingClosure pointIndex x y z p
Parameters:
int
-
The index of the point to move. Must be between 0 and PointCount - 1.
x : float
-
The distance to move the point in X direction.
y : float
-
The distance to move the point in Y direction.
z : float
-
The distance to move the point in Z direction.
p : Polyline3D
-
The Polyline3D to change.
Modifiers: inline |
Moves the 3D point at the given pointIndex in place by the given x, y, and z distances. On a closed Polyline3D, moving the first or last point moves both, so it stays closed.
|
Full Usage:
Polyline3D.moveY distance pl
Parameters:
float
pl : Polyline3D
Returns: Polyline3D
|
Returns a new Polyline3D moved by a given distance in Y direction. The input Polyline3D is not changed.
|
Full Usage:
Polyline3D.moveZ distance pl
Parameters:
float
pl : Polyline3D
Returns: Polyline3D
|
Returns a new Polyline3D moved by a given distance in Z direction. The input Polyline3D is not changed.
|
Full Usage:
Polyline3D.offset inPlaneOffsetDistance perpendicularOffsetDistance polyLine
Parameters:
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 counter-clockwise polyline in xy-plane this is Upwards.
A negative distance offsets in the opposite direction.
polyLine : Polyline3D
-
A 3D Polyline, open or closed.
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, on U-turns sharper than 175 degrees, and if the average normal cannot be computed, for example if all points are collinear.
|
Full Usage:
Polyline3D.offsetByNormal refNormal inPlaneOffsetDistance perpendicularOffsetDistance polyLine
Parameters:
UnitVec
-
A unit vector defining an approximate normal direction for orienting the perpendicular offset and determining inside/outside.
Only if the polyline has no corner, like a straight one, it defines the offset plane.
Fails if it is within half a degree of perpendicular to the plane of every corner, because then it cannot tell the sides apart.
inPlaneOffsetDistance : float
-
The offset distance in the local plane defined by two segments.
A positive distance offsets to the inside of the polyline (for counter-clockwise 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.
polyLine : Polyline3D
-
A 3D Polyline, open or closed.
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 on U-turns sharper than 175 degrees. Uses the default settings of Polyline3D.offsetByNormalCustom. Use Polyline3D.offsetByNormalCustom to set them.
|
Full Usage:
Polyline3D.offsetByNormalCustom (polyLine, inPlaneOffsetDistance, perpendicularOffsetDistance, refNormal, ?loop, ?considerCollinearBelow, ?failAtUTurnAbove)
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 counter-clockwise 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.
Only if the polyline has no corner, like a straight one, it defines the offset plane.
Fails if it is within half a degree of perpendicular to the plane of every corner, because then it cannot tell the sides apart.
?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.
?considerCollinearBelow : MeasureProduct<cosine, MeasureOne>
-
Optional, defaults to 2.5 degrees in cosine measure.
The cosine of the angle below which segments are considered collinear,
unless the polyline turned by more than this angle since the previous corner, so that an arc keeps its corners.
A collinear point takes the plane interpolated between the neighboring corners.
?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.
There is no U-turn behavior like Offset2D.UTurn, on purpose: two almost opposite segments span no reliable plane in 3D, so a chamfer or threshold point has no defined direction. Remove U-turns first, for example with Polyline3D.removeUTurns.
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 on U-turns sharper than failAtUTurnAbove.
|
Full Usage:
Polyline3D.offsetCustom (polyLine, inPlaneOffsetDistance, perpendicularOffsetDistance, ?loop, ?considerCollinearBelow, ?failAtUTurnAbove)
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 counter-clockwise 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.
?considerCollinearBelow : MeasureProduct<cosine, MeasureOne>
-
Optional, defaults to 2.5 degrees in cosine measure.
The cosine of the angle below which segments are considered collinear,
unless the polyline turned by more than this angle since the previous corner, so that an arc keeps its corners.
A collinear point takes the plane interpolated between the neighboring corners.
?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.
There is no U-turn behavior like Offset2D.UTurn, on purpose: two almost opposite segments span no reliable plane in 3D, so a chamfer or threshold point has no defined direction. Remove U-turns first, for example with Polyline3D.removeUTurns.
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, on U-turns sharper than failAtUTurnAbove, and if the average normal cannot be computed, for example if all points are collinear.
|
Full Usage:
Polyline3D.offsetVariable inPlaneOffsetDistances perpendicularOffsetDistances polyLine
Parameters:
IList<float>
-
The offset distances in the local plane defined by two segments. One distance per segment.
perpendicularOffsetDistances : IList<float>
-
The offset distances perpendicular to the local plane. One distance per point.
For a closed polyline one less, because its last point is its first point.
polyLine : Polyline3D
-
A 3D Polyline, open or closed.
Returns: Polyline3D
A new 3D polyline.
|
Offsets a Polyline in 3D space by finding the local plane in each corner, with one in-plane distance per segment and one perpendicular distance per point. 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, on U-turns sharper than 175 degrees, at collinear points where the two segments have different in-plane distances, and if the average normal cannot be computed, for example if all points are collinear. Uses the default settings of Polyline3D.offsetVariableCustom. Use Polyline3D.offsetVariableCustom to set them.
|
Full Usage:
Polyline3D.offsetVariableByNormal refNormal inPlaneOffsetDistances perpendicularOffsetDistances polyLine
Parameters:
UnitVec
-
A unit vector defining an approximate normal direction for orienting the perpendicular offset and determining inside/outside.
Only if the polyline has no corner, like a straight one, it defines the offset plane.
Fails if it is within half a degree of perpendicular to the plane of every corner, because then it cannot tell the sides apart.
inPlaneOffsetDistances : IList<float>
-
The offset distances in the local plane defined by two segments. One distance per segment.
perpendicularOffsetDistances : IList<float>
-
The offset distances perpendicular to the local plane. One distance per point.
For a closed polyline one less, because its last point is its first point.
polyLine : Polyline3D
-
A 3D Polyline, open or closed.
Returns: Polyline3D
A new 3D polyline.
|
Offsets a Polyline in 3D space by finding the local plane in each corner, with one in-plane distance per segment and one perpendicular distance per point. 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, on U-turns sharper than 175 degrees, and at collinear points where the two segments have different in-plane distances. Uses the default settings of Polyline3D.offsetVariableByNormalCustom. Use Polyline3D.offsetVariableByNormalCustom to set them.
|
Full Usage:
Polyline3D.offsetVariableByNormalCustom (polyLine, inPlaneOffsetDistances, perpendicularOffsetDistances, refNormal, ?loop, ?varDistParallelBehavior, ?considerCollinearBelow, ?failAtUTurnAbove)
Parameters:
Polyline3D
-
A 3D Polyline, open or closed.
inPlaneOffsetDistances : 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 counter-clockwise 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 point.
For a closed polyline one less, because its last point is its first point. With loop = TRUE one per point of the open polyline.
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.
Only if the polyline has no corner, like a straight one, it defines the offset plane.
Fails if it is within half a degree of perpendicular to the plane of every corner, because then it cannot tell the sides apart.
?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.
?varDistParallelBehavior : VarDistParallel
-
Optional, defaults to Fail.
The behavior to use when collinear segments with different offset distances are found.
?considerCollinearBelow : MeasureProduct<cosine, MeasureOne>
-
Optional, defaults to 2.5 degrees in cosine measure.
The cosine of the angle below which segments are considered collinear,
unless the polyline turned by more than this angle since the previous corner, or for different distances, since the last point that was offset exactly.
?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.
There is no U-turn behavior like Offset2D.UTurn, on purpose: two almost opposite segments span no reliable plane in 3D, so a chamfer or threshold point has no defined direction. Remove U-turns first, for example with Polyline3D.removeUTurns.
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, on U-turns sharper than failAtUTurnAbove, and at collinear points where the two segments have different in-plane distances, unless varDistParallelBehavior says otherwise.
|
Full Usage:
Polyline3D.offsetVariableCustom (polyLine, inPlaneOffsetDistances, perpendicularOffsetDistances, ?loop, ?varDistParallelBehavior, ?considerCollinearBelow, ?failAtUTurnAbove)
Parameters:
Polyline3D
-
A 3D Polyline, open or closed.
inPlaneOffsetDistances : 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.
A negative distance offsets to the outside.
No matter how the polyline is oriented.
perpendicularOffsetDistances : IList<float>
-
The offset distances perpendicular to the local plane. One distance per point.
For a closed polyline one less, because its last point is its first point. With loop = TRUE one per point of the open polyline.
A positive distance offsets in the direction of the computed normal.
For a counter-clockwise 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.
?varDistParallelBehavior : VarDistParallel
-
Optional, defaults to Fail.
The behavior to use when collinear segments with different offset distances are found.
?considerCollinearBelow : MeasureProduct<cosine, MeasureOne>
-
Optional, defaults to 2.5 degrees in cosine measure.
The cosine of the angle below which segments are considered collinear,
unless the polyline turned by more than this angle since the previous corner, or for different distances, since the last point that was offset exactly.
?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.
There is no U-turn behavior like Offset2D.UTurn, on purpose: two almost opposite segments span no reliable plane in 3D, so a chamfer or threshold point has no defined direction. Remove U-turns first, for example with Polyline3D.removeUTurns.
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, on U-turns sharper than failAtUTurnAbove, at collinear points where the two segments have different in-plane distances unless varDistParallelBehavior says otherwise, and if the average normal cannot be computed, for example if all points are collinear.
|
|
|
Full Usage:
Polyline3D.removeDuplicateAndCollinearPoints angleTolerance distanceTolerance pl
Parameters:
float<MeasureProduct<cosine, MeasureOne>>
distanceTolerance : float
pl : Polyline3D
Returns: Polyline3D
|
Returns a new Polyline3D with consecutive duplicate points and collinear points removed, within given tolerances. The input Polyline3D is not changed. Use p.RemoveDuplicateAndCollinearPoints to remove the points in place. This algorithm allows the last and first point to be identical if the Polyline3D is closed. Collinear 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 collinear segments, the first point is replaced with the last non-collinear point. So the joint of the loop is now moved to the last non-collinear point. So that there are no collinear segments even between start and end. Raises an error if all points are within the distanceTolerance of the first point.
|
Full Usage:
Polyline3D.removeDuplicatePoints distanceTolerance pl
Parameters:
float
-
The distance within which points are considered duplicates.
pl : Polyline3D
-
A 3D Polyline, open or closed.
Returns: Polyline3D
A new Polyline3D. Use p.RemoveDuplicatePoints to remove the points in place.
|
Returns a new Polyline3D with consecutive duplicate points removed, within a given tolerance. The input Polyline3D is not changed. From a cluster of points that are closer than the distanceTolerance, only the first point is kept. Use 'Polyline3D.removeDuplicatePointsFaithfully' if you want to keep the edges in their position by re-intersecting segments. The position of start and end point is NOT changed. Use Polyline3D.close to ensure start and end point are identical.
|
Full Usage:
Polyline3D.removeDuplicatePointsAndReport distanceTolerance pl
Parameters:
float
-
The distance within which points are considered duplicates.
pl : Polyline3D
-
A 3D Polyline, open or closed.
Returns: Polyline3D * ResizeArray<Pnt>
A tuple of the new Polyline3D and the removed duplicate points, with consecutive identical entries listed once per run.
The list of removed points is empty if no duplicates were found.
Use p.RemoveDuplicatePointsAndReport to remove the points in place.
|
Returns a new Polyline3D with consecutive duplicate points removed, within a given tolerance, and the removed points. Same as 'Polyline3D.removeDuplicatePoints', but also reports the points that were removed. The input Polyline3D is not changed.
|
Full Usage:
Polyline3D.removeDuplicatePointsFaithfully distanceTolerance pl
Parameters:
float
-
The distance within which points are considered duplicates.
pl : Polyline3D
-
A 3D Polyline, open or closed.
Returns: Polyline3D
A new Polyline3D. Use p.RemoveDuplicatePointsFaithfully to remove the points in place.
|
Returns a new Polyline3D with consecutive duplicate points removed, within a given tolerance. The input Polyline3D is not changed. This algorithm keeps edges in their position by re-intersecting segments at their closest approach if points are closer than the distanceTolerance but not identical. The position of start and end point is NOT changed. Use Polyline3D.close to ensure start and end point are identical.
|
Full Usage:
Polyline3D.removeUTurns minCos polyLine
Parameters:
float<MeasureProduct<cosine, MeasureOne>>
-
The angle between segments so that they are considered a U-turn.
For example, for 179.9 degrees use 'Cosine.``179.9``'.
polyLine : Polyline3D
-
A 3D Polyline, open or closed.
Returns: Polyline3D
A new Polyline3D. Use p.RemoveUTurns to remove the U-turns in place.
|
Returns a new Polyline3D with simple sharp U-Turns removed. The input Polyline3D is not changed. For nested U-turns and collinear points in U-turns segments use 'removeUTurnsDeeply'.
|
Full Usage:
Polyline3D.removeUTurnsDeeply minCos polyLine
Parameters:
float<MeasureProduct<cosine, MeasureOne>>
-
The angle between segments so that they are considered a U-turn.
For example, for 179.9 degrees use 'Cosine.``179.9``'.
polyLine : Polyline3D
-
A 3D Polyline, open or closed.
Returns: Polyline3D
A new Polyline3D. Use p.RemoveUTurnsDeeply to remove the U-turns in place.
|
Returns a new Polyline3D with all sharp U-Turns removed, recursively until no more U-turns are present. The input Polyline3D is not changed. Use this function when you have nested U-turns and collinear points in U-turns segments.
|
|
Returns a new Polyline3D with the order of the points reversed. The input Polyline3D is not changed. Use p.Reverse() to reverse in place.
|
Full Usage:
Polyline3D.rotate q pl
Parameters:
Quaternion
pl : Polyline3D
Returns: Polyline3D
Modifiers: inline |
Returns a new Polyline3D rotated by a Quaternion. The input Polyline3D is not changed. The polyline is rotated around the World Origin.
|
Full Usage:
Polyline3D.rotateAround cen q pl
Parameters:
Pnt
-
The center point of the rotation.
q : Quaternion
-
The rotation to apply.
pl : Polyline3D
-
The Polyline3D to rotate. It is not changed.
Returns: Polyline3D
A new Polyline3D. Use p.RotateAround to rotate in place.
|
Returns a new Polyline3D rotated by a Quaternion around a given center point.
|
Full Usage:
Polyline3D.rotateOnZ r pl
Parameters:
Rotation2D
pl : Polyline3D
Returns: Polyline3D
|
Returns a new Polyline3D rotated around the Z-axis. The input Polyline3D is not changed.
|
Full Usage:
Polyline3D.rotateOnZAround cen r pl
Parameters:
Pnt
r : Rotation2D
pl : Polyline3D
Returns: Polyline3D
|
Returns a new Polyline3D rotated around the local Z-axis through the given center point. The input Polyline3D is not changed.
|
Full Usage:
Polyline3D.scale factor pl
Parameters:
float
pl : Polyline3D
Returns: Polyline3D
|
Returns a new Polyline3D scaled by a given factor. The input Polyline3D is not changed. Scale center is World Origin 0,0,0
|
Full Usage:
Polyline3D.scaleOn cen factor pl
Parameters:
Pnt
-
The center point of the scaling.
factor : float
-
The scale factor.
pl : Polyline3D
-
The Polyline3D to scale. It is not changed.
Returns: Polyline3D
A new Polyline3D. Use p.ScaleOn to scale in place.
Modifiers: inline |
Returns a new Polyline3D scaled by a given factor around a given center point.
|
Full Usage:
Polyline3D.secondLastPoint pl
Parameters:
Polyline3D
Returns: Pnt
Modifiers: inline |
|
|
|
|
Gets the number of segments in the Polyline3D. This is the point count minus one, but never negative.
|
Full Usage:
Polyline3D.segmentVectors pl
Parameters:
Polyline3D
Returns: ResizeArray<Vec>
Modifiers: inline |
Returns the line vectors of all segments of the Polyline3D as a list of Vec. The length of the list is one less than the point count.
|
Full Usage:
Polyline3D.segmentVectorsXYZ p
Parameters:
Polyline3D
Returns: ResizeArray<float>
Modifiers: inline |
Returns the line vectors of all segments of the Polyline3D as a flat list of x, y, and z components. The length of the list is 3 less than the xyzs count, so one less vector than points in the polyline.
|
Full Usage:
Polyline3D.segments pl
Parameters:
Polyline3D
Returns: ResizeArray<Line3D>
Modifiers: inline |
Returns all segments of the Polyline3D as a list of Line3D.
|
Full Usage:
Polyline3D.setPoint pointIndex pnt p
Parameters:
int
pnt : Pnt
p : Polyline3D
Modifiers: inline |
Sets the 3D point at the given pointIndex in the list of points. (this sets XYZs.[pointIndex * 3], XYZs.[pointIndex * 3 + 1], and XYZs.[pointIndex * 3 + 2] in the internal flat list of x, y, and z coordinates )
|
Full Usage:
Polyline3D.setPointPreservingClosure pointIndex pnt p
Parameters:
int
pnt : Pnt
p : Polyline3D
Modifiers: inline |
Sets the 3D point at the given pointIndex in the list of points. On a closed Polyline3D, setting the first or last point will set both to the same point. Raises an error if the pointIndex is out of range. (this sets XYZs.[pointIndex * 3], XYZs.[pointIndex * 3 + 1], and XYZs.[pointIndex * 3 + 2] in the internal flat list of x, y, and z coordinates )
|
Full Usage:
Polyline3D.setXYZ pointIndex x y z p
Parameters:
int
x : float
y : float
z : float
p : Polyline3D
Modifiers: inline |
Sets the x, y, and z coordinates of the 3D point at the given pointIndex in the list of points. NOTE: setting the first or last point on a closed Polyline3D might open it. (this sets XYZs.[pointIndex * 3], XYZs.[pointIndex * 3 + 1], and XYZs.[pointIndex * 3 + 2] in the internal flat list of x, y, and z coordinates )
|
Full Usage:
Polyline3D.setXYZPreservingClosure pointIndex x y z p
Parameters:
int
x : float
y : float
z : float
p : Polyline3D
Modifiers: inline |
Sets the x, y, and z coordinates of the 3D point at the given pointIndex in the list of points. On a closed Polyline3D, setting the first or last point will set both to the same point. Raises an error if the pointIndex is out of range. (this sets XYZs.[pointIndex * 3], XYZs.[pointIndex * 3 + 1], and XYZs.[pointIndex * 3 + 2] in the internal flat list of x, y, and z coordinates )
|
Full Usage:
Polyline3D.signedAreaIn2D pl
Parameters:
Polyline3D
Returns: float
Modifiers: inline |
Calculates the signed area of the Polyline3D when projected in 2D. Z values are ignored. If it is positive the Polyline3D is counter-clockwise. Polyline does not need to be exactly closed. The segment from the last point to the first point is included in the area calculation. For self-intersecting Polylines the result is invalid. Raises an error on an empty Polyline3D.
|
|
Gets the first point of the Polyline3D. This is the point at index 0. Same as Polyline3D.FirstPoint
|
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 than 'b' then the new Polyline3D is in opposite direction. If the start parameter is less than 1e-4 below the next integer it snaps up to that vertex. If the end parameter is less than 1e-4 above the previous integer it snaps down to that vertex. Raises an error if a parameter is outside the domain of the Polyline3D (0.0 to points.Count - 1.0).
|
|
Returns a new Polyline3D transformed by a 4x4 transformation matrix. The input Polyline3D is not changed.
|
Full Usage:
Polyline3D.transformRigid m pl
Parameters:
RigidMatrix
pl : Polyline3D
Returns: Polyline3D
|
Returns a new Polyline3D transformed by a RigidMatrix. The input Polyline3D is not changed.
|
Full Usage:
Polyline3D.tryAverageNormal pl
Parameters:
Polyline3D
Returns: Vec voption
Modifiers: inline |
Returns the average normal vector of the Polyline3D, or ValueNone if it is degenerate. It is calculated by summing up the cross products of all segments around the center point, so it is the same vector as Polyline3D.averageNormal, but bad input returns ValueNone instead of raising an exception. The returned vector is not unitized, its length is twice the area of the polygon projected onto that plane. Returns ValueNone if the summed normal is shorter than 1e-6. This happens if: the Polyline3D has less than 3 points, or all points are in one line, or the cross products cancel each other out on a self intersecting shape, or the Polyline3D is very small. For these last two cases Polyline3D.tryAveragePlane still finds a plane.
|
Full Usage:
Polyline3D.tryAveragePlane tolerance pl
Parameters:
float
pl : Polyline3D
Returns: NPlane voption
Modifiers: inline |
Tries to find the average plane of the Polyline3D, even if the points are not planar. As opposed to Polyline3D.tryPlane this does not check if all points are on that plane. The origin of the returned NPlane is the average of all points, see Polyline3D.center. The normal is the unitized Polyline3D.averageNormal, so it follows the order of the points. If they are counter-clockwise in the World X-Y plane, then the normal points in World Z direction. On self intersecting shapes, where these cross products cancel each other out, the orientation is arbitrary. The 'tolerance' is the maximum distance for considering all points to be on one point or on one line. Use 1e-6 as a default. Returns ValueNone if the Polyline3D has less than 3 points, or if all points are within the tolerance of one point or of one line, because then there is no unique plane.
|
Full Usage:
Polyline3D.tryFind condition pl
Parameters:
float -> float -> float -> bool
-
A function that takes the X, Y and Z coordinates of a point and returns a boolean indicating whether the condition is satisfied.
pl : Polyline3D
-
The Polyline3D to search through.
Returns: Pnt voption
ValueSome(Pnt) if a point satisfying the condition is found, otherwise ValueNone.
Modifiers: inline |
Find the first point in the Polyline3D that satisfies a given condition. Returns ValueSome(point) if found, otherwise ValueNone.
|
Full Usage:
Polyline3D.tryFindIndex condition pl
Parameters:
float -> float -> float -> bool
-
A function that takes the X, Y and Z coordinates of a point and returns a boolean indicating whether the condition is satisfied.
pl : Polyline3D
-
The Polyline3D to search through.
Returns: int voption
ValueSome(index of x) the index of the x value in the polyline's flat array if found, otherwise ValueNone.
Modifiers: inline |
Find the index of the first point in the Polyline3D that satisfies a given condition. Returns ValueSome(index) if found, otherwise ValueNone.
|
Full Usage:
Polyline3D.tryFindLast condition pl
Parameters:
float -> float -> float -> bool
-
A function that takes the X, Y and Z coordinates of a point and returns a boolean indicating whether the condition is satisfied.
pl : Polyline3D
-
The Polyline3D to search through.
Returns: Pnt voption
ValueSome(Pnt) if a point satisfying the condition is found, otherwise ValueNone.
Modifiers: inline |
Find the last point in the Polyline3D that satisfies a given condition. Returns ValueSome(point) if found, otherwise ValueNone.
|
Full Usage:
Polyline3D.tryFindLastIndex condition pl
Parameters:
float -> float -> float -> bool
-
A function that takes the X, Y and Z coordinates of a point and returns a boolean indicating whether the condition is satisfied.
pl : Polyline3D
-
The Polyline3D to search through.
Returns: int voption
ValueSome(index of x) the index of the x value in the polyline's flat array if found, otherwise ValueNone.
Modifiers: inline |
Find the index of the last point in the Polyline3D that satisfies a given condition. Returns ValueSome(index) if found, otherwise ValueNone.
|
Full Usage:
Polyline3D.tryFindSelfIntersection pl
Parameters:
Polyline3D
-
The polyline to search.
Returns: (Pnt * int * int) voption
ValueSome with a point on the first segment and both segment indices, or ValueNone.
|
Searches non-adjacent segments in index order for an intersection in O(n²) time. Excludes the closure joint when endpoints are within 1e-7, parallel overlaps (angle below 0.25 degrees), and segments shorter than 1e-6. Uses the XLine3D endpoint parameter tolerance of 1e-6. The closest separation must be less than 1e-6. Use Polyline3D.tryFindSelfIntersectionWithin to set this tolerance.
|
Full Usage:
Polyline3D.tryFindSelfIntersectionWithin maxSkewDistance pl
Parameters:
float
-
Finite, nonnegative separation tolerance.
pl : Polyline3D
-
The polyline to search.
Returns: (Pnt * int * int) voption
ValueSome with a point on the first segment and both segment indices, or ValueNone.
|
Searches non-adjacent segments in index order for an intersection in O(n²) time. Excludes the closure joint when endpoints are within 1e-7, parallel overlaps (angle below 0.25 degrees), and segments shorter than 1e-6. Uses the XLine3D endpoint parameter tolerance of 1e-6. The closest separation must be strictly less than maxSkewDistance; zero therefore finds no intersections. Use Polyline3D.tryFindSelfIntersection for the default maxSkewDistance of 1e-6.
|
Full Usage:
Polyline3D.tryPlane tolerance pl
Parameters:
float
pl : Polyline3D
Returns: NPlane voption
Modifiers: inline |
Tries to find the plane that all points of the Polyline3D lie in. The 'tolerance' is the maximum distance any point may have from the plane. Use 1e-6 as a default. The origin of the returned NPlane is the average of all points, see Polyline3D.Center. The orientation of the normal follows the order of the points. If they are counter-clockwise in the World X-Y plane, then the normal points in World Z direction. On self intersecting shapes, where these cross products cancel each other out, the orientation is arbitrary. Returns ValueNone if: the Polyline3D has less than 3 points, or all points are within the tolerance of one point or of one line, so that there is no unique plane, or any point is further away from the plane than the tolerance. Use Polyline3D.tryAveragePlane to get the average plane of non planar points too.
|
Full Usage:
Polyline3D.xyzs p
Parameters:
Polyline3D
Returns: ResizeArray<float>
Modifiers: inline |
Gets the X, Y and Z interleaved ResizeArray of the Polyline3D: x0, y0, z0, x1, y1, z1, ... This is the live internal buffer, so changes to the list will be reflected in the Polyline3D.
|
Euclid