BSpline3D
Canonical path: NemAll_Python_Geometry.BSpline3D
Bases: PolyPoints3D
class for 3D (non uniform, rational) B-spline geometry
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
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]
Return type: tuple( Point3DList, VecDoubleList, VecDoubleList, int, bool)
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)
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
GetWeights
GetWeights() -> VecDoubleList
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
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,
)
Args: points weights knots degree isPeriodic
SetKnots
SetKnots(knots: VecDoubleList)
SetPeriodic
Set periodic flag
Parameters:
-
periodic
(bool
) –value of periodic flag
SetWeights
SetWeights(weights: VecDoubleList)
__eq__
__eq__(bspline: BSpline3D) -> object
Comparison of bsplines without tolerance.
Be careful, this method work without tolerance!
Parameters:
-
bspline
(BSpline3D
) –Compared bspline.
Returns:
-
object
–True when bsplines are equal, otherwise false.
__init__
overloaded
Initialize
__init__(
points: Point3DList,
weights: VecDoubleList,
knots: VecDoubleList,
degree: int,
isPeriodic: bool = False,
)
Default constructor. Creates invalid spline.
__init__(spline: BSpline3D)