B Spline2D
Class full path: NemAll_Python_Geometry.BSpline2D
Bases: PolyPoints2D
class for 2D (non uniform, rational) B-spline geometry
Attributes
Degree: int
property
writable
Gets spline degree
IsPeriodic: bool
property
writable
Check if the spline is periodic
Knots: VecDoubleList
property
writable
Get knot vector
Weights: VecDoubleList
property
writable
Get control points weights
Functions
Clear()
Clear data, getting invalid state
CreateLine2D(line)
staticmethod
Create BSpline2D from Line2D
Parameters:
Name | Type | Description | Default |
---|---|---|---|
line
|
Line2D
|
Input line. |
required |
Returns:
Type | Description |
---|---|
BSpline2D
|
Created BSpline2D. |
Get()
Gets the BSpline2D
Returns:
Type | Description |
---|---|
List[Point2D]
|
list of points |
List[float]
|
list of weights |
List[float]
|
list of knots |
int
|
spline degree |
bool
|
True if spline is periodic, False otherwise |
GetDegree()
Gets spline degree
Returns:
Type | Description |
---|---|
int
|
spline degree |
GetKnots()
Get knot vector
Returns:
Type | Description |
---|---|
VecDoubleList
|
knot vector const reference |
GetWeights()
Get control points weights
Returns:
Type | Description |
---|---|
VecDoubleList
|
weights vector const reference |
IsClosed()
Check if spline is closed ( first/last points are equal )
Returns:
Type | Description |
---|---|
bool
|
closed spline true/false |
IsRational()
Check if the spline is rational
Returns:
Type | Description |
---|---|
bool
|
bool true = rational |
IsValid()
Check spline validity
Returns:
Type | Description |
---|---|
bool
|
bool valid = true |
Reverse()
Reverse of current spline
Method reverse Spline using reverse from PolyPoints and swapping tangents.
Set(points, weights, knots, degree, isPeriodic)
Get/Set functions
Parameters:
Name | Type | Description | Default |
---|---|---|---|
points
|
Point2DList
|
spline points |
required |
weights
|
VecDoubleList
|
vector with spline weights |
required |
knots
|
VecDoubleList
|
vector with spline knots |
required |
degree
|
int
|
spline degree |
required |
isPeriodic
|
bool
|
Whether the spline is to be periodic |
required |
SetDegree(degree)
Set spline degree
Parameters:
Name | Type | Description | Default |
---|---|---|---|
degree
|
int
|
desired degree |
required |
SetKnots(knots)
Set knot vector
Parameters:
Name | Type | Description | Default |
---|---|---|---|
knots
|
VecDoubleList
|
knot vector to set |
required |
SetPeriodic(flag)
Set the periodic flag
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flag
|
bool
|
True if BSpline is periodic |
required |
SetWeights(weights)
Set weights for control points
Parameters:
Name | Type | Description | Default |
---|---|---|---|
weights
|
VecDoubleList
|
weights vector to set |
required |
__eq__(bspline)
Comparison of bsplines without tolerance.
Be careful, this method work without tolerance!
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bspline
|
BSpline2D
|
Compared bspline. |
required |
Returns:
Type | Description |
---|---|
object
|
True when bsplines are equal, otherwise false. |
__init__
overload
__init__()
initialize
__init__(points, weights, knots, degree, isPeriodic)
Constructor from b-spline data. Creates b-spline using provided data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
points
|
Point2DList
|
control points of b-spline. |
required |
weights
|
VecDoubleList
|
weights of b-spline. |
required |
knots
|
VecDoubleList
|
knots of b-spline. |
required |
degree
|
int
|
degree of b-spline. |
required |
isPeriodic
|
bool
|
flag of periodicity of b-spline. |
required |
__init__(spline)
Copy constructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
spline
|
BSpline2D
|
Spline which will be copied. |
required |
__repr__()
Convert to string