Polyline3D Type
A mutable 3D Polyline. If the last point is the same as the first point, the Polyline3D is closed.
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
|
|
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.CloseIfOpen
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 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. Fails 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. Fails 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. |
|
Scales the 3D polyline by a given factor. Scale center is World Origin 0,0
|
|
Scales the 2D 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 all segments of the Polyline3D as a list of Line3D.
|
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 |
|
Returns the Unitized Tangent 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 .
|
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.
|
|
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.
|
|
Returns the point on the Polyline3D that is the closest point 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.
|
|
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.
|
|
Returns the index of an outer corner and. a normal vector corresponding to an Counter-Clockwise view on the loop. This is used to calculate the RefNormal vector for the offset function. The input vectors are the vectors for each segment of the polyline. From first and second point up to last and first point.
|
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, offsetDistance, ?normalDistance, ?loop, ?refNormal)
Parameters:
Polyline3D
-
A 3D Polyline.
offsetDistance : float
-
The offset distance for all segments of the polyline. A positive distance offsets inwards in corners, a negative offset outwards.
?normalDistance : float
-
Optional, The normal distance defined as a perpendicular offset for all corners.
?loop : bool
-
Consider last point and first point to be from a closed loop, even if they are not at the same location.
?refNormal : Vec
-
Optional. An approximate orientation Normal to help find the correct offset side,
if given it doesn't need to be calculated anymore. This speeds up the algorithm.
To be in Z Axis orientation for Counter-Clockwise loops in 2D.
Returns: Polyline3D
A list of points that has the same length as the input list.
|
Offsets a Polyline in 3D space by finding the local offset in each corner. Auto detects if given points are from a closed Polyline (first point = last point) and loops them. Does not fail on colinear or duplicate points.
|
Full Usage:
Polyline3D.offset (polyLine, offsetDistances, ?normalDistances, ?loop, ?refNormal, ?obliqueOffsets)
Parameters:
Polyline3D
-
A 3D Polyline.
offsetDistances : float seq
-
The parallel offset distances for each segment of the polyline.
A positive distance offsets inwards in corners, a negative offset outwards.
For open and closed polylines this list of distances must have one item less than number of points in the polyline.
Except if the polyline is open and the loop parameter is set to true. Then points and distances list shall have the same count.
A empty list for no offset or singleton for constant offset is allowed too.
?normalDistances : float
-
Optional. Normal distances defined as a perpendicular offset at each corner.
Unlike offsetDistances this list of distances must have the same item count as number of points in the polyline.
Except if the input polyline is already closed. Then distances list shall have one less. (independent of 'loop' parameter)
A empty list for no normal offset or singleton for constant offset is allowed too.
?loop : bool
-
Optional. Consider last point and first point to be from a closed loop, even if they are not at the same location.
?refNormal : Vec
-
Optional. An approximate orientation Normal to help find the correct offset side,
if given it doesn't need to be calculated anymore. This speeds up the algorithm.
To be in Z Axis orientation for Counter-Clockwise loops in 2D.
?obliqueOffsets : bool
-
Optional. When two adjacent segments are colinear but have different offset distances there is no solution with a parallel offset.
By default an exception is raised. Set this to true to create and averaged oblique offset instead of failing.
Returns: Polyline3D
A list of points that has the same length as the input list.
|
Offsets a Polyline in 3D space by finding the local offset in each corner. Auto detects if given points are from a closed Polyline (first point = last point) and loops them. Does not fail on colinear or duplicate points.
|
Full Usage:
Polyline3D.offsetCore (pts, offD, normD, referenceNormal, fixColinearLooped, allowObliqueOffsetOnColinearSegments)
Parameters:
ResizeArray<Pnt>
offD : IList<float>
normD : ResizeArray<float>
referenceNormal : Vec
fixColinearLooped : bool
allowObliqueOffsetOnColinearSegments : bool
Returns: ResizeArray<Pnt>
|
The inner core routine of Points.offset. This function considers input a closed polyline. Start point and end point may not be equal, all arrays must be of the same length. 'referenceNormal' to be in Z Axis for Counter-Clockwise loops in 2D or if it is Vec.Zero it wil be calculated add hoc.
|
|
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.
|
|
|
|
Reverse order of the Polyline3D in place.
|
|
|
Full Usage:
Polyline3D.rotateWithCenter 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.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.
|
|
|
|
Move a Polyline3D by a vector. (same as Polyline3D.move)
|