Skip to content

BSpline2D

Canonical path: NemAll_Python_Geometry.BSpline2D

Bases: PolyPoints2D

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

Methods:

  • Clear

    Clear data, getting invalid state

  • CreateLine2D

    Create BSpline2D from Line2D

  • Get

    Return type: tuple(list(Point2D), list(float), list(float), int, bool)

  • GetDegree

    Gets spline degree

  • GetKnots

    Get knot vector

  • GetWeights

    Get control points weights

  • IsClosed

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

  • IsRational

    Check if the spline is rational

  • IsValid

    Check spline validity

  • Reverse

    Reverse of current spline

  • Set

    Get/Set functions

  • SetDegree

    Set spline degree

  • SetKnots

    Set knot vector

  • SetPeriodic

    Set the periodic flag

  • SetWeights

    Set weights for control points

  • __eq__

    Comparison of bsplines without tolerance.

  • __init__

    dummy, is only needed for the creation of the documentation by MkDocs

  • __repr__

    Convert to string

Attributes:

Degree property writable

Degree: int

Gets spline degree

IsPeriodic property writable

IsPeriodic: bool

Check if the spline is periodic

Knots property writable

Get knot vector

Weights property writable

Weights: VecDoubleList

Get control points weights

Clear

Clear()

Clear data, getting invalid state

CreateLine2D staticmethod

CreateLine2D(line: Line2D) -> BSpline2D

Create BSpline2D from Line2D

Parameters:

  • line (Line2D) –

    Input line.

Returns:

Get

Get() -> tuple[list[Point2D], list[float], list[float], int, bool]

Return type: tuple(list(Point2D), list(float), list(float), int, bool)

GetDegree

GetDegree() -> int

Gets spline degree

Returns:

  • int

    spline degree

GetKnots

GetKnots() -> VecDoubleList

Get knot vector

Returns:

GetWeights

GetWeights() -> VecDoubleList

Get control points weights

Returns:

IsClosed

IsClosed() -> bool

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

Returns:

  • bool

    closed spline true/false

IsRational

IsRational() -> bool

Check if the spline is rational

Returns:

  • bool

    bool true = rational

IsValid

IsValid() -> bool

Check spline validity

Returns:

  • bool

    bool valid = true

Reverse

Reverse()

Reverse of current spline

Method reverse Spline using reverse from PolyPoints and swapping tangents.

Set

Set(
    points: Point2DList,
    weights: VecDoubleList,
    knots: VecDoubleList,
    degree: int,
    isPeriodic: bool,
)

Get/Set functions

SetDegree

SetDegree(degree: int)

Set spline degree

Parameters:

  • degree (int) –

    desired degree

SetKnots

SetKnots(knots: VecDoubleList)

Set knot vector

Parameters:

SetPeriodic

SetPeriodic(arg2: bool)

Set the periodic flag

Parameters:

  • flag

    True if BSpline is periodic

SetWeights

SetWeights(weights: VecDoubleList)

Set weights for control points

Parameters:

__eq__

__eq__(bspline: BSpline2D) -> object

Comparison of bsplines without tolerance.

Be careful, this method work without tolerance!

Parameters:

Returns:

  • object

    True when bsplines are equal, otherwise false.

__init__ overloaded

__init__()

Initialize

__init__(
    points: Point2DList,
    weights: VecDoubleList,
    knots: VecDoubleList,
    degree: int,
    isPeriodic: bool,
)

Constructor from b-spline data. Creates b-spline using provided data.

Parameters:

  • points (Point2DList) –

    control points of b-spline.

  • weights (VecDoubleList) –

    weights of b-spline.

  • knots (VecDoubleList) –

    knots of b-spline.

  • degree (int) –

    degree of b-spline.

  • isPeriodic (bool) –

    flag of periodicity of b-spline.

__init__(spline: BSpline2D)

Copy constructor.

Parameters:

  • spline (BSpline2D) –

    Spline which will be copied.

__repr__

__repr__() -> str

Convert to string