BSpline3DService
Canonical path: NemAll_Python_Geometry.BSpline3DService
Utilities for BSpline
AddControlPoint
AddControlPoint(pointIdx: int, coords: Point3D)
add control point to B-Spline
Parameters:
-
pointIdx
(int
) –index, where new point will be stored
-
coords
(Point3D
) –coordinates of point
AddControlPointOnSegment
AddControlPointOnSegment(
ray: Vector3D, coords: Point3D
) -> tuple[eGeometryErrorCode, int]
add control point to B-Spline's segment given by point
Parameters:
Returns:
-
tuple[eGeometryErrorCode, int]
–segment index
BSplineToSpline
staticmethod
DiffsToKnots
staticmethod
DiffsToKnots(degree: int, startVal: float) -> VecDoubleList
convert knots differences vector to knot vector (size of vector is increased by 1)
Parameters:
-
degree
(int
) –degree of BSpline owning the knots
-
startVal
(float
) –start of parameter interval (returned by knotsToDiffs())
Returns:
-
VecDoubleList
–vector of differences converted to vector of knots
GetControlPointIndex
calculate control point index from parameter on B-Spline
Parameters:
-
param
(float
) –parameter on BSpline
GetPoints
staticmethod
GetPoints(
bSpline: BSpline3D, allInterPoints: bool
) -> tuple[Point3DList, Point3DList]
provide interpolated and control points of BSpline
Parameters:
-
bSpline
(BSpline3D
) –source BSpline
-
allInterPoints
(bool
) –if false, the first and the last interpolated points are excluded, if they match with control points
Returns:
-
tuple[Point3DList, Point3DList]
–tuple(list of control points for handles, list of interpolated points for handles)
InsertKnot
Insert knot into bspline knot vector (compute new control points, preserve geometry)
Parameters:
-
param
(float
) –param to insert
-
numInsertionsMultiplicity
(int
) –multiplicity of new knot
KnotsToDiffs
staticmethod
KnotsToDiffs(degree: int, periodic: bool) -> tuple[float, VecDoubleList]
convert knots vector to knot differences vector (size of vector is decreased by 1)
Parameters:
-
degree
(int
) –degree of BSpline owning the knots
-
periodic
(bool
) –true if bspline is periodic (or closed for degree == 1)
Returns:
-
tuple[float, VecDoubleList]
–tuple(BSpline parameter interval start, vector of knots converted to vector of differences)
MergeKnots
staticmethod
MergeKnots(
newknots: VecDoubleList, newknotMultiplicities: VecSizeTList
) -> tuple[VecDoubleList, VecSizeTList]
merge knot values with their multiplicities into input vector
Parameters:
-
newknots
(VecDoubleList
) –knot values to merge
-
newknotMultiplicities
(VecSizeTList
) –knot multiplicities to merge
Returns:
-
tuple[VecDoubleList, VecSizeTList]
–tuple(knot values, knot multiplicities)
MoveStartPeriodic
Move start point in periodic BSpline
Parameters:
-
startParam
(float
) –start value for knot interval
PointModification
PointModification(
pointsIdx: VecSizeTList,
moveVector: Vector3D,
isInterpolated: bool,
hSet: HealingSettings,
)
move interpolated or control point of B-Spline
Parameters:
-
pointsIdx
(VecSizeTList
) –point indexes
-
moveVector
(Vector3D
) –move vector
-
isInterpolated
(bool
) –true if wanted to handle interpolated points
-
hSet
(HealingSettings
) –healing settings
RefineKnots
RefineKnots(knotvalues: VecDoubleList, knotMultiplicities: VecSizeTList)
Refine knots (insert knots if necessary)
Parameters:
-
knotvalues
(VecDoubleList
) –knot values to refine
-
knotMultiplicities
(VecSizeTList
) –knot multiplicities
RemoveControlPoint
remove control point from B-Spline
Parameters:
-
pointIdx
(int
) –point index to remove
ScaleKnots
staticmethod
ScaleKnots(newStartParam: float, newEndParam: float) -> VecDoubleList
Scale knot vector to new interval
Parameters:
-
newStartParam
(float
) –new interval start
-
newEndParam
(float
) –new interval end
Returns:
-
VecDoubleList
–knot vector
SetControlPoint
SetControlPoint(pointIdx: int, newCoords: Point3D)
set coordinates of control point of B-Spline
Parameters:
-
pointIdx
(int
) –point index
-
newCoords
(Point3D
) –new coordinates of point
SetDegree
set degree of B-Spline
Parameters:
-
degree
(int
) –new degree for B-Spline
SetInterpolatedPoint
SetInterpolatedPoint(pointIdx: int, newCoords: Point3D)
set coordinates of interpolated point of B-Spline
Parameters:
-
pointIdx
(int
) –point index
-
newCoords
(Point3D
) –new coordinates of point
SetPeriodic
set/unset periodic property of B-Spline
Parameters:
-
periodic
(bool
) –it true, B-Spline will be periodic, otherwise B-Spline will be open