BSpline3D
Canonical path: NemAll_Python_Geometry.BSpline3D
Bases: PolyPoints3D
class for 3D (non uniform, rational) B-spline geometry
Methods:
-
Clear
–Clear data, getting invalid state
-
Count
–Get count of points.
-
Create
–Create BSpline from ICurve3D
-
CreateArc3D
–Create BSpline form Arc3D
-
CreateBSpline
–Create BSpline from control points
-
CreateBSpline3DFrom2DCurves
–Creates BSpline3D from direction 2D curve and elevation 2D curve
-
CreateBSpline3DFromAxisAndGradient
–Create BSpline3D curve from axis and gradient (all placed in XY plane)
-
CreateBSplineInterpolated
–Create BSpline from interpolated points
-
CreateBSplineJoined
–Create BSpline by joining curves. Curves should meet by end points.
-
CreateLine3D
–Create BSpline3D from Line3D
-
CreatePolyline3D
–Create a BSpline out of a Polyline3D object
-
CreateSpline
–Create BSpline from Spline3D
-
Empty
–Return true if no points, otherwise false.
-
EqualRef
–Test if reference points are equal.
-
EvaluateEndPoint
–Evaluate end point of bspline
-
EvaluateEndRelPoint
–Evaluate relative end (last) point of bspline
-
EvaluatePoint
–Evaluate point of b-spline
-
EvaluatePointsWithTangents
–Evaluate points and tangents of b-spline
-
EvaluateStartPoint
–Evaluate start point of bspline
-
EvaluateStartRelPoint
–Evaluate relative start point of bspline
-
Get
–Set the b-spline data
-
GetDegree
–Gets spline degree
-
GetEndPoint
–Get the end point in world coordinate system.
-
GetEndRelPoint
–Get the end point
-
GetInterpolatedPoints
–Function returns interpolated points of b-spline
-
GetInterpolatedPointsParameters
–Function returns list of parameters for interpolated points of b-spline
-
GetInterval
–Function returns the interval of bspline
-
GetKnotMultiplicities
–Get knot vector and knot multiplicities
-
GetKnots
–Get knot vector
-
GetLastPoint
–Get the last point in world coordinate system.
-
GetParametersForDistances
–Find parameters for distances on b-spline
-
GetPoint
–Get point in world coordinate system.
-
GetPointIndex
–Get index of the given point
-
GetPointIndexes
–Get indexes of the given point, in case that several points in the spline
-
GetRefPoint
–Get reference point.
-
GetRelPoint
–Get point in Local coordinate system.
-
GetStartPoint
–Get the start point in world coordinate system.
-
GetStartRelPoint
–Get the start point
-
GetWeights
–Get control points weights
-
Insert
–Overloaded function. See individual overloads.
-
InsertRel
–Insert relative point at specific position. Used local coordinates.
-
IsClosed
–Check if spline is closed ( first/last points are equal )
-
IsEndClamped
–Function returns whether the bspline is clamped at the end
-
IsLine
–Check if bspline is line
-
IsPeriodicClosed
–Returns whether the spline is periodic or closed in 1st degree
-
IsRational
–Check if the spline is rational
-
IsStartClamped
–Function returns whether the bspline is clamped at the start
-
IsValid
–Check spline validity
-
Remove
–Remove point from specific position.
-
RemoveLastPoint
–Remove the last point
-
Reserve
–Reserve container capacity
-
Resize
–Specifies a new size for the points vector.
-
Reverse
–Reverse of current spline
-
Set
–Set the b-spline data
-
SetDegree
–Set spline degree
-
SetEndPoint
–Set the end point in world coordinates
-
SetKnots
–Set knot vector
-
SetPeriodic
–Set periodic flag
-
SetPoint
–Set point at given position in world coordinate system.
-
SetRefPoint
–Set reference point in world coordinate system.
-
SetRelPoint
–Set point at given position in relative coordinate system.
-
SetStartPoint
–Set the start point in world coordinates
-
SetWeights
–Set weights for control points
-
ToLineChain
–Get polyline as a chain of lines composed from 2 points.
-
__eq__
–Comparison of bspline.
-
__getitem__
–Get point at position from index. Used world coordinates.
-
__iadd__
–Addition assignment operator
-
__init__
–Overloaded function. See individual overloads.
-
__mul__
–3D matrix transformation
-
__repr__
–Convert to string
-
__setitem__
–Set a value at position from index.
Attributes:
-
Degree
(int
) –Gets spline degree
-
EndPoint
(Point3D
) –Get the end point in world coordinate system.
-
EndRelPoint
(Point3D
) –Get the end point
-
InterpolatedPoints
(list[Point3D]
) –Function returns interpolated points of b-spline
-
InterpolatedPointsParameters
(VecDoubleList
) –Function returns list of parameters for interpolated points of b-spline
-
IsPeriodic
(bool
) –Returns whether the spline is periodic
-
Knots
(VecDoubleList
) –Get knot vector
-
LastPoint
(Point3D
) –Get the last point in world coordinate system.
-
Points
(list[Point3D]
) –Get the points
-
RefPoint
(Point3D
) –Get reference point.
-
StartPoint
(Point3D
) –Get the start point in world coordinate system.
-
StartRelPoint
(Point3D
) –Get the start point
-
Weights
(VecDoubleList
) –Get control points weights
InterpolatedPoints
property
InterpolatedPoints: list[Point3D]
Function returns interpolated points of b-spline
InterpolatedPointsParameters
property
InterpolatedPointsParameters: VecDoubleList
Function returns list of parameters for interpolated points of b-spline
IsPeriodic
property
writable
Returns whether the spline is periodic
Returns only given flag which was originally set
Create
staticmethod
CreateArc3D
staticmethod
CreateBSpline
staticmethod
CreateBSpline(points: Point3DList, degree: int, isPeriodic: bool) -> BSpline3D
Create BSpline from control points
Parameters:
-
points
(Point3DList
) –Control points
-
degree
(int
) –Degree of BSpline
-
isPeriodic
(bool
) –true if BSpline should be smoothly closed
Returns:
-
BSpline3D
–BSpline object
CreateBSpline3DFrom2DCurves
staticmethod
CreateBSpline3DFrom2DCurves(
directionCurve: object,
elevationCurve: object,
startHeight: float,
chainPoints: Point3DList,
) -> tuple[eGeometryErrorCode, BSpline3D]
Creates BSpline3D from direction 2D curve and elevation 2D curve
Parameters:
-
directionCurve
(object
) –direction curve ( for X,Y coordinates)
-
elevationCurve
(object
) –elevation curve (for Z coordinates)
-
startHeight
(float
) –Z coordinate of new curve start point
-
chainPoints
(Point3DList
) –list of chain points to match resulting curve
Returns:
-
tuple[eGeometryErrorCode, BSpline3D]
–tuple(eOK if successful, created BSpline3D)
CreateBSpline3DFromAxisAndGradient
staticmethod
CreateBSpline3DFromAxisAndGradient(
directionCurve: (
Arc3D | BSpline3D | Line3D | Path3D | Polyline3D | Polygon3D | Spline3D
),
elevationCurve: (
Arc3D | BSpline3D | Line3D | Path3D | Polyline3D | Polygon3D | Spline3D
),
startHeight: float,
chainPoints: Point3DList,
) -> tuple
Create BSpline3D curve from axis and gradient (all placed in XY plane)
Parameters:
-
directionCurve
(Arc3D | BSpline3D | Line3D | Path3D | Polyline3D | Polygon3D | Spline3D
) –direction/axis curve
-
elevationCurve
(Arc3D | BSpline3D | Line3D | Path3D | Polyline3D | Polygon3D | Spline3D
) –elevation/gradient curve
-
startHeight
(float
) –Z coordinate of new curve start point
-
chainPoints
(Point3DList
) –list of chain points to match resulting curve
Returns:
-
tuple
–tuple(error code, result BSpline3D curve)
CreateBSplineInterpolated
staticmethod
CreateBSplineInterpolated(
points: Point3DList, degree: int, isPeriodic: bool
) -> BSpline3D
Create BSpline from interpolated points
Parameters:
-
points
(Point3DList
) –Interpolated points
-
degree
(int
) –Degree of BSpline
-
isPeriodic
(bool
) –true if BSpline should be smoothly closed
Returns:
-
BSpline3D
–BSpline object
CreateBSplineJoined
staticmethod
CreateBSplineJoined(curves: Curve3DList) -> BSpline3D
Create BSpline by joining curves. Curves should meet by end points.
Parameters:
-
curves
(Curve3DList
) –Source curves
Returns:
-
BSpline3D
–BSpline object (empty, if joining failed)
CreateLine3D
staticmethod
CreatePolyline3D
staticmethod
CreatePolyline3D(polyline3d: Polyline3D) -> BSpline3D
Create a BSpline out of a Polyline3D object
Parameters:
-
polyline3d
(Polyline3D
) –Polyline3D that will be used for conversion
Returns:
-
BSpline3D
–An instance of the created BSpline3D
CreateSpline
staticmethod
EqualRef
EqualRef(polyPoints: PolyPoints3D) -> bool
Test if reference points are equal.
Parameters:
-
polyPoints
(PolyPoints3D
) –the PolyPoints.
Returns:
-
bool
–Reference points are equal: true/false
EvaluateEndPoint
EvaluateEndPoint() -> tuple[eGeometryErrorCode, Point3D]
EvaluateEndRelPoint
EvaluateEndRelPoint() -> tuple[eGeometryErrorCode, Point3D]
Evaluate relative end (last) point of bspline
Returns:
-
tuple[eGeometryErrorCode, Point3D]
–evaluated relative end point
EvaluatePoint
EvaluatePoint(param: float) -> tuple[eGeometryErrorCode, Point3D]
Evaluate point of b-spline
Parameters:
-
param
(float
) –parameter to evaluate point on b-spline
Returns:
-
tuple[eGeometryErrorCode, Point3D]
–tuple(error code of evaluation, resulting point, if succeeded)
EvaluatePointsWithTangents
EvaluatePointsWithTangents(
parameters: VecDoubleList,
) -> list[tuple[Point3D, Vector3D]]
Evaluate points and tangents of b-spline
Parameters:
-
parameters
(VecDoubleList
) –parameters to evaluate points and tangents on b-spline
Returns:
EvaluateStartPoint
EvaluateStartPoint() -> tuple[eGeometryErrorCode, Point3D]
EvaluateStartRelPoint
EvaluateStartRelPoint() -> tuple[eGeometryErrorCode, Point3D]
Evaluate relative start point of bspline
Returns:
-
tuple[eGeometryErrorCode, Point3D]
–evaluated relative start point
Get
Get() -> tuple[Point3DList, VecDoubleList, VecDoubleList, int, bool]
Set the b-spline data
Returns:
-
tuple[Point3DList, VecDoubleList, VecDoubleList, int, bool]
–tuple(Points, Weights, Knots, Degree type, Is periodic state)
GetEndPoint
GetEndPoint() -> Point3D
Get the end point in world coordinate system.
Returns:
-
Point3D
–end point in world coordinate system
GetInterpolatedPoints
GetInterpolatedPoints() -> Point3DList
GetInterpolatedPointsParameters
GetInterpolatedPointsParameters() -> VecDoubleList
Function returns list of parameters for interpolated points of b-spline
Returns:
-
VecDoubleList
–list of parameters of interpolated points
GetInterval
GetInterval() -> tuple[bool, float, float]
Function returns the interval of bspline
Returns:
-
tuple[bool, float, float]
–tuple(true if success, start of curve interval, end of curve interval)
GetKnotMultiplicities
GetKnotMultiplicities() -> tuple[VecDoubleList, VecSizeTList]
Get knot vector and knot multiplicities
Returns:
-
tuple[VecDoubleList, VecSizeTList]
–tuple(knot vector with unique values, knot multiplicities)
GetLastPoint
GetLastPoint() -> Point3D
Get the last point in world coordinate system.
Returns:
-
Point3D
–last point in world coordinate system
GetParametersForDistances
GetParametersForDistances(distances: VecDoubleList) -> VecDoubleList
Find parameters for distances on b-spline
Parameters:
-
distances
(VecDoubleList
) –list of distances to calculate parameters for
Returns:
-
VecDoubleList
–list of parameters, if calculation failed for any distance, empty vector is returned
GetPoint
GetPoint(index: int) -> Point3D
Get point in world coordinate system.
This method is checked and throwing Geometry::Exception when index is out of range.
Parameters:
-
index
(int
) –point index.
Returns:
-
Point3D
–point point in world coordinate system.
GetPointIndex
GetPointIndexes
GetRefPoint
GetRefPoint() -> Point3D
GetRelPoint
GetRelPoint(index: int) -> Point3D
Get point in Local coordinate system.
This method is checked and throwing Geometry::Exception when index is out of range.
Parameters:
-
index
(int
) –point index.
Returns:
-
Point3D
–point the point at position index.
GetStartPoint
GetStartPoint() -> Point3D
Get the start point in world coordinate system.
Returns:
-
Point3D
–start point in world coordinate system
GetWeights
GetWeights() -> VecDoubleList
Insert
overloaded
Insert(polyPoints: PolyPoints3D, position: int = 18446744073709551615) -> bool
Insert vector of points at specific position.
If return false then points weren't inserted.
Parameters:
-
polyPoints
(PolyPoints3D
) –the PolyPoints.
-
position
(int
, default:18446744073709551615
) –position where points will be inserted.
Returns:
-
bool
–bool true if successful.
Insert(point: Point3D, position: int = 18446744073709551615) -> bool
Insert point at specific position. Used world coordinates.
If return false then points weren't Inserted.
Parameters:
-
point
(Point3D
) –the Point.
-
position
(int
, default:18446744073709551615
) –position where points will be inserted.
Returns:
-
bool
–bool true if successful.
InsertRel
InsertRel(point: Point3D, position: int = 18446744073709551615) -> bool
Insert relative point at specific position. Used local coordinates.
If return false then points weren't Inserted.
Parameters:
-
point
(Point3D
) –the Point.
-
position
(int
, default:18446744073709551615
) –position where points will be inserted.
Returns:
-
bool
–bool true if successful.
IsClosed
Check if spline is closed ( first/last points are equal )
Returns:
-
bool
–closed spline true/false
IsEndClamped
Function returns whether the bspline is clamped at the end
Returns:
-
bool
–true if clamped on end
IsPeriodicClosed
Returns whether the spline is periodic or closed in 1st degree
BSpline with degree == 1 cannot be periodic, wherefore returns true if closed.
Returns:
-
bool
–bool true = periodic or closed
IsRational
Check if the spline is rational
Returns:
-
bool
–bool true = rational
IsStartClamped
Function returns whether the bspline is clamped at the start
Returns:
-
bool
–true if clamped on start
Remove
Remove point from specific position.
If return false then points weren't removed.
Parameters:
-
position
(int
) –position of point which will be removed.
Returns:
-
bool
–Point removed: true/false
RemoveLastPoint
Remove the last point
Returns:
-
bool
–Point removed: true/false
Reserve
Reserve container capacity
Parameters:
-
newCount
(int
) –Expected size of container [count of points]
Resize
Specifies a new size for the points vector.
Parameters:
-
newSize
(int
) –The new size of the points vector.
Reverse
Reverse of current spline
Method reverse Spline using reverse from PolyPoints and swapping tangents.
Set
Set(
points: Point3DList,
weights: VecDoubleList,
knots: VecDoubleList,
degree: int,
isPeriodic: bool = False,
)
Set the b-spline data
Parameters:
-
points
(Point3DList
) –Points
-
weights
(VecDoubleList
) –Weights
-
knots
(VecDoubleList
) –Knots
-
degree
(int
) –Degree type
-
isPeriodic
(bool
, default:False
) –Is periodic state
SetEndPoint
SetEndPoint(endpoint: Point3D)
SetKnots
SetKnots(knots: VecDoubleList)
SetPeriodic
Set periodic flag
Parameters:
-
periodic
(bool
) –value of periodic flag
SetPoint
SetPoint(point: Point3D, index: int)
Set point at given position in world coordinate system.
Parameters:
-
point
(Point3D
) –point in the world coordinate system.
-
index
(int
) –index of point which will be set
SetRefPoint
SetRefPoint(refPoint: Point3D)
Set reference point in world coordinate system.
Parameters:
-
refPoint
(Point3D
) –reference point in the world coordinate system.
SetRelPoint
SetRelPoint(point: Point3D, index: int)
Set point at given position in relative coordinate system.
Parameters:
-
point
(Point3D
) –point in the relative coordinate system.
-
index
(int
) –index of point which will be set
SetStartPoint
SetStartPoint(startpoint: Point3D)
SetWeights
SetWeights(weights: VecDoubleList)
ToLineChain
ToLineChain() -> Point3DList
Get polyline as a chain of lines composed from 2 points.
Returns:
-
Point3DList
–vector of lines composed from 2 points (start and end point of a line)
__eq__
__eq__(bspline: BSpline3D) -> bool
Comparison of bspline.
Be careful, this method work without tolerance!
Parameters:
-
bspline
(BSpline3D
) –bspline to be compared.
Returns:
-
bool
–True when bspline are equal, otherwise false.
__getitem__
__getitem__(index: int) -> Point3D
Get point at position from index. Used world coordinates.
This method is checked and throwing Geometry::Exception when index is out of range.
Parameters:
-
index
(int
) –point index.
Returns:
-
Point3D
–copy of point.
__iadd__
__init__
overloaded
Initialize
__init__(
points: Point3DList,
weights: VecDoubleList,
knots: VecDoubleList,
degree: int,
isPeriodic: bool = False,
)
Constructor
Parameters:
-
points
(Point3DList
) –Points
-
weights
(VecDoubleList
) –Weights
-
knots
(VecDoubleList
) –Knots
-
degree
(int
) –Degree type
-
isPeriodic
(bool
, default:False
) –Is periodic state
__init__(spline: BSpline3D)