Skip to content

BSpline3D

Canonical path: NemAll_Python_Geometry.BSpline3D

Bases: PolyPoints3D

class for 3D (non uniform, rational) B-spline geometry

Methods:

Attributes:

Degree property writable

Degree: int

Gets spline degree

EndPoint property writable

EndPoint: Point3D

Get the end point in world coordinate system.

EndRelPoint property

EndRelPoint: Point3D

Get the end point

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

IsPeriodic: bool

Returns whether the spline is periodic

Returns only given flag which was originally set

Knots property writable

Get knot vector

LastPoint property

LastPoint: Point3D

Get the last point in world coordinate system.

Points property writable

Points: list[Point3D]

Get the points

RefPoint property writable

RefPoint: Point3D

Get reference point.

StartPoint property writable

StartPoint: Point3D

Get the start point in world coordinate system.

StartRelPoint property

StartRelPoint: Point3D

Get the start point

Weights property writable

Weights: VecDoubleList

Get control points weights

Clear

Clear()

Clear data, getting invalid state

Count

Count() -> int

Get count of points.

Returns:

  • int

    bool.

Create staticmethod

Create(
    curve: (
        Arc3D | BSpline3D | Line3D | Path3D | Polyline3D | Polygon3D | Spline3D
    ),
) -> BSpline3D

Create BSpline from ICurve3D

Parameters:

Returns:

CreateArc3D staticmethod

CreateArc3D(arc: Arc3D) -> BSpline3D

Create BSpline form Arc3D

Parameters:

  • arc (Arc3D) –

    Input arc

Returns:

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:

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:

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:

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:

CreateBSplineJoined staticmethod

CreateBSplineJoined(curves: Curve3DList) -> BSpline3D

Create BSpline by joining curves. Curves should meet by end points.

Parameters:

Returns:

  • BSpline3D

    BSpline object (empty, if joining failed)

CreateLine3D staticmethod

CreateLine3D(line: Line3D) -> BSpline3D

Create BSpline3D from Line3D

Parameters:

  • line (Line3D) –

    Input line.

Returns:

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

CreateSpline(spline: Spline3D) -> BSpline3D

Create BSpline from Spline3D

Parameters:

Returns:

Empty

Empty() -> bool

Return true if no points, otherwise false.

Returns:

  • bool

    bool.

EqualRef

EqualRef(polyPoints: PolyPoints3D) -> bool

Test if reference points are equal.

Parameters:

Returns:

  • bool

    Reference points are equal: true/false

EvaluateEndPoint

EvaluateEndPoint() -> tuple[eGeometryErrorCode, Point3D]

Evaluate end point of bspline

Returns:

EvaluateEndRelPoint

EvaluateEndRelPoint() -> tuple[eGeometryErrorCode, Point3D]

Evaluate relative end (last) point of bspline

Returns:

EvaluatePoint

EvaluatePoint(param: float) -> tuple[eGeometryErrorCode, Point3D]

Evaluate point of b-spline

Parameters:

  • param (float) –

    parameter to evaluate point on b-spline

Returns:

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:

  • list[tuple[Point3D, Vector3D]]

    vector of resulting points and tangents, if calculation failed for any parameter, empty vector is returned

EvaluateStartPoint

EvaluateStartPoint() -> tuple[eGeometryErrorCode, Point3D]

Evaluate start point of bspline

Returns:

EvaluateStartRelPoint

EvaluateStartRelPoint() -> tuple[eGeometryErrorCode, Point3D]

Evaluate relative start point of bspline

Returns:

Get

Set the b-spline data

Returns:

GetDegree

GetDegree() -> int

Gets spline degree

Returns:

  • int

    spline degree

GetEndPoint

GetEndPoint() -> Point3D

Get the end point in world coordinate system.

Returns:

  • Point3D

    end point in world coordinate system

GetEndRelPoint

GetEndRelPoint() -> Point3D

Get the end point

Returns:

GetInterpolatedPoints

GetInterpolatedPoints() -> Point3DList

Function returns interpolated points of b-spline

Returns:

GetInterpolatedPointsParameters

GetInterpolatedPointsParameters() -> VecDoubleList

Function returns list of parameters for interpolated points of b-spline

Returns:

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:

GetKnots

GetKnots() -> VecDoubleList

Get knot vector

Returns:

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

GetPointIndex(point: Point3D) -> tuple[bool, int]

Get index of the given point

Parameters:

  • point (Point3D) –

    Searched point

Returns:

  • tuple[bool, int]

    tuple(True if a point was found, Found index)

GetPointIndexes

GetPointIndexes(point: Point3D) -> tuple[bool, list[int]]

Get indexes of the given point, in case that several points in the spline will have the same coordinates

Parameters:

  • point (Point3D) –

    Searched point

Returns:

  • tuple[bool, list[int]]

    tuple(True if at least one point was found, Found indexes)

GetRefPoint

GetRefPoint() -> Point3D

Get reference point.

Returns:

  • Point3D

    the reference point in the world coordinate system.

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

GetStartRelPoint

GetStartRelPoint() -> Point3D

Get the start point

Returns:

GetWeights

GetWeights() -> VecDoubleList

Get control points weights

Returns:

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

IsClosed() -> bool

Check if spline is closed ( first/last points are equal )

Returns:

  • bool

    closed spline true/false

IsEndClamped

IsEndClamped() -> bool

Function returns whether the bspline is clamped at the end

Returns:

  • bool

    true if clamped on end

IsLine

IsLine() -> bool

Check if bspline is line

Returns:

  • bool

    Returns true if it is line

IsPeriodicClosed

IsPeriodicClosed() -> bool

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

IsRational() -> bool

Check if the spline is rational

Returns:

  • bool

    bool true = rational

IsStartClamped

IsStartClamped() -> bool

Function returns whether the bspline is clamped at the start

Returns:

  • bool

    true if clamped on start

IsValid

IsValid() -> bool

Check spline validity

Returns:

  • bool

    bool valid = true

Remove

Remove(position: int) -> bool

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

RemoveLastPoint() -> bool

Remove the last point

Returns:

  • bool

    Point removed: true/false

Reserve

Reserve(newCount: int)

Reserve container capacity

Parameters:

  • newCount (int) –

    Expected size of container [count of points]

Resize

Resize(newSize: int)

Specifies a new size for the points vector.

Parameters:

  • newSize (int) –

    The new size of the points vector.

Reverse

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

SetDegree

SetDegree(degree: int)

Set spline degree

Parameters:

  • degree (int) –

    desired degree

SetEndPoint

SetEndPoint(endpoint: Point3D)

Set the end point in world coordinates

Parameters:

  • endpoint (Point3D) –

    new end point

SetKnots

SetKnots(knots: VecDoubleList)

Set knot vector

Parameters:

SetPeriodic

SetPeriodic(periodic: bool)

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)

Set the start point in world coordinates

Parameters:

  • startpoint (Point3D) –

    new start point

SetWeights

SetWeights(weights: VecDoubleList)

Set weights for control points

Parameters:

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:

__iadd__

__iadd__(point: Point3D) -> BSpline3D

Addition assignment operator

Parameters:

  • point (Point3D) –

    New Point2D which will be added to the bspline

Returns:

__init__ overloaded

__init__()

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)

Copy constructor.

Parameters:

  • spline (BSpline3D) –

    Spline which will be copied.

__mul__

__mul__(matrix: Matrix3D) -> BSpline3D

3D matrix transformation

Parameters:

  • matrix (Matrix3D) –

    3D transformation matrix

Returns:

__repr__

__repr__() -> str

Convert to string

__setitem__

__setitem__(index: int | slice, value: Point3D)

Set a value at position from index.

Parameters:

  • index (int | slice) –

    index of the value.

  • value (Point3D) –

    value to insert.

Placeholder