Skip to content

Commit d901d55

Browse files
committed
Added NURBS curve control point sensitivity functions
1 parent be19d0f commit d901d55

File tree

4 files changed

+1012
-10
lines changed

4 files changed

+1012
-10
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rust_nurbs"
3-
version = "0.27.0"
3+
version = "0.28.0"
44
edition = "2021"
55
# IMPORTANT: the version must be kept on line 3 to be read properly in docs/source/conf.py
66

rust_nurbs.pyi

Lines changed: 251 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5104,6 +5104,32 @@ def nurbs_curve_eval(p: Iterable[Iterable[float]], w: Iterable[float], k: Iterab
51045104
Value of the NURBS curve at :math:`t`. Has the same size as the inner dimension of ``p``
51055105
"""
51065106

5107+
def nurbs_curve_eval_dp(w: Iterable[float], k: Iterable[float], i: int, q: int, dim: int, t: float) -> List[float]:
5108+
r"""
5109+
Evaluates the derivative of the NURBS curve with respect to an individual control point at a given :math:`t`-value
5110+
5111+
Parameters
5112+
----------
5113+
w: Iterable[float]
5114+
1-D list or array of weights corresponding to each of control points. Must have length
5115+
equal to the outer dimension of ``p``.
5116+
k: Iterable[float]
5117+
1-D list or array of knots
5118+
i: int
5119+
Index of the control point
5120+
q: int
5121+
Degree of the curve
5122+
dim: int
5123+
Number of spatial dimensions in the curve. Usually ``2`` or ``3``
5124+
t: float
5125+
Parameter value at which to evaluate the curve sensitivity
5126+
5127+
Returns
5128+
-------
5129+
List[float]
5130+
1-D list representing the curve sensitivity at :math:`t` to the control point :math:`\mathbf{P}_i`
5131+
"""
5132+
51075133
def nurbs_curve_dcdt(p: Iterable[Iterable[float]], w: Iterable[float], k: Iterable[float], t: float) -> List[float]:
51085134
r"""
51095135
Evaluates a the first derivative with respect to :math:`t` of a Non-Uniform Rational B-Spline (NURBS) curve
@@ -5147,6 +5173,32 @@ def nurbs_curve_dcdt(p: Iterable[Iterable[float]], w: Iterable[float], k: Iterab
51475173
Value of the NURBS curve derivative w.r.t. :math:`t` at :math:`t`. Has the same size as the inner dimension of ``p``
51485174
"""
51495175

5176+
def nurbs_curve_dcdt_dp(w: Iterable[float], k: Iterable[float], i: int, q: int, dim: int, t: float) -> List[float]:
5177+
r"""
5178+
Evaluates the sensitivity of the NURBS curve first derivative with respect to an individual control point at a given :math:`t`-value
5179+
5180+
Parameters
5181+
----------
5182+
w: Iterable[float]
5183+
1-D list or array of weights corresponding to each of control points. Must have length
5184+
equal to the outer dimension of ``p``.
5185+
k: Iterable[float]
5186+
1-D list or array of knots
5187+
i: int
5188+
Index of the control point
5189+
q: int
5190+
Degree of the curve
5191+
dim: int
5192+
Number of spatial dimensions in the curve. Usually ``2`` or ``3``
5193+
t: float
5194+
Parameter value at which to evaluate the curve sensitivity
5195+
5196+
Returns
5197+
-------
5198+
List[float]
5199+
1-D list representing the curve first derivative sensitivity at :math:`t` to the control point :math:`\mathbf{P}_i`
5200+
"""
5201+
51505202
def nurbs_curve_d2cdt2(p: Iterable[Iterable[float]], w: Iterable[float], k: Iterable[float], t: float) -> List[float]:
51515203
r"""
51525204
Evaluates a the second derivative with respect to :math:`t` of a Non-Uniform Rational B-Spline (NURBS) curve
@@ -5193,6 +5245,32 @@ def nurbs_curve_d2cdt2(p: Iterable[Iterable[float]], w: Iterable[float], k: Iter
51935245
Value of the NURBS curve second derivative w.r.t. :math:`t` at :math:`t`. Has the same size as the inner dimension of ``p``
51945246
"""
51955247

5248+
def nurbs_curve_d2cdt2_dp(w: Iterable[float], k: Iterable[float], i: int, q: int, dim: int, t: float) -> List[float]:
5249+
r"""
5250+
Evaluates the sensitivity of the NURBS curve second derivative with respect to an individual control point at a given :math:`t`-value
5251+
5252+
Parameters
5253+
----------
5254+
w: Iterable[float]
5255+
1-D list or array of weights corresponding to each of control points. Must have length
5256+
equal to the outer dimension of ``p``.
5257+
k: Iterable[float]
5258+
1-D list or array of knots
5259+
i: int
5260+
Index of the control point
5261+
q: int
5262+
Degree of the curve
5263+
dim: int
5264+
Number of spatial dimensions in the curve. Usually ``2`` or ``3``
5265+
t: float
5266+
Parameter value at which to evaluate the curve sensitivity
5267+
5268+
Returns
5269+
-------
5270+
List[float]
5271+
1-D list representing the curve second derivative sensitivity at :math:`t` to the control point :math:`\mathbf{P}_i`
5272+
"""
5273+
51965274
def nurbs_curve_eval_grid(p: Iterable[Iterable[float]], w: Iterable[float], k: Iterable[float], nt: int) -> List[List[float]]:
51975275
r"""
51985276
Evaluates a Non-Uniform Rational B-Spline (NURBS) curve with :math:`n+1` control points on a
@@ -5226,6 +5304,34 @@ def nurbs_curve_eval_grid(p: Iterable[Iterable[float]], w: Iterable[float], k: I
52265304
:math:`N_t \times d`, where :math:`d` is the spatial dimension (usually ``3``)
52275305
"""
52285306

5307+
def nurbs_curve_eval_dp_grid(w: Iterable[float], k: Iterable[float], i: int, q: int, dim: int, nt: int) -> List[float]:
5308+
r"""
5309+
Evaluates the derivative of the NURBS curve with respect to an individual control point at a given :math:`t`-value
5310+
5311+
Parameters
5312+
----------
5313+
w: Iterable[float]
5314+
1-D list or array of weights corresponding to each of control points. Must have length
5315+
equal to the outer dimension of ``p``.
5316+
k: Iterable[float]
5317+
1-D list or array of knots
5318+
i: int
5319+
Index of the control point
5320+
q: int
5321+
Degree of the curve
5322+
dim: int
5323+
Number of spatial dimensions in the curve. Usually ``2`` or ``3``
5324+
nt: int
5325+
Number of linearly-spaced points in :math:`t`. E.g., ``nt=3`` outputs
5326+
the evaluation of the curve at :math:`t=0.0`, :math:`t=0.5`, and :math:`t=1.0`.
5327+
5328+
Returns
5329+
-------
5330+
List[List[float]]
5331+
Value of the NURBS curve sensitivity w.r.t. :math:`\mathbf{P}_i` at :math:`N_t` linearly-spaced points. Output array has size
5332+
:math:`N_t \times d`, where :math:`d` is the spatial dimension (usually ``3``)
5333+
"""
5334+
52295335
def nurbs_curve_dcdt_grid(p: Iterable[Iterable[float]], w: Iterable[float], k: Iterable[float], nt: int) -> List[List[float]]:
52305336
r"""
52315337
Evaluates a the first derivative with respect to :math:`t` of a Non-Uniform Rational B-Spline (NURBS) curve
@@ -5271,6 +5377,34 @@ def nurbs_curve_dcdt_grid(p: Iterable[Iterable[float]], w: Iterable[float], k: I
52715377
:math:`N_t \times d`, where :math:`d` is the spatial dimension (usually ``3``)
52725378
"""
52735379

5380+
def nurbs_curve_dcdt_dp_grid(w: Iterable[float], k: Iterable[float], i: int, q: int, dim: int, nt: int) -> List[float]:
5381+
r"""
5382+
Evaluates the sensitivity of the NURBS curve first derivative with respect to an individual control point at a given :math:`t`-value
5383+
5384+
Parameters
5385+
----------
5386+
w: Iterable[float]
5387+
1-D list or array of weights corresponding to each of control points. Must have length
5388+
equal to the outer dimension of ``p``.
5389+
k: Iterable[float]
5390+
1-D list or array of knots
5391+
i: int
5392+
Index of the control point
5393+
q: int
5394+
Degree of the curve
5395+
dim: int
5396+
Number of spatial dimensions in the curve. Usually ``2`` or ``3``
5397+
nt: int
5398+
Number of linearly-spaced points in :math:`t`. E.g., ``nt=3`` outputs
5399+
the evaluation of the curve at :math:`t=0.0`, :math:`t=0.5`, and :math:`t=1.0`.
5400+
5401+
Returns
5402+
-------
5403+
List[List[float]]
5404+
Value of the NURBS curve first derivative sensitivity w.r.t. :math:`\mathbf{P}_i` at :math:`N_t` linearly-spaced points. Output array has size
5405+
:math:`N_t \times d`, where :math:`d` is the spatial dimension (usually ``3``)
5406+
"""
5407+
52745408
def nurbs_curve_d2cdt2_grid(p: Iterable[Iterable[float]], w: Iterable[float], k: Iterable[float], nt: int) -> List[List[float]]:
52755409
r"""
52765410
Evaluates a the second derivative with respect to :math:`t` of a Non-Uniform Rational B-Spline (NURBS) curve
@@ -5319,7 +5453,36 @@ def nurbs_curve_d2cdt2_grid(p: Iterable[Iterable[float]], w: Iterable[float], k:
53195453
:math:`N_t \times d`, where :math:`d` is the spatial dimension (usually ``3``)
53205454
"""
53215455

5322-
def nurbs_curve_eval_tvec(p: Iterable[Iterable[float]], w: Iterable[float], k: Iterable[float], t: List[float]) -> List[List[float]]:
5456+
def nurbs_curve_d2cdt2_dp_grid(w: Iterable[float], k: Iterable[float], i: int, q: int, dim: int, nt: int) -> List[float]:
5457+
r"""
5458+
Evaluates the sensitivity of the NURBS curve second derivative with respect to an individual control point at a given :math:`t`-value
5459+
5460+
Parameters
5461+
----------
5462+
w: Iterable[float]
5463+
1-D list or array of weights corresponding to each of control points. Must have length
5464+
equal to the outer dimension of ``p``.
5465+
k: Iterable[float]
5466+
1-D list or array of knots
5467+
i: int
5468+
Index of the control point
5469+
q: int
5470+
Degree of the curve
5471+
dim: int
5472+
Number of spatial dimensions in the curve. Usually ``2`` or ``3``
5473+
1-D list or array of knots
5474+
nt: int
5475+
Number of linearly-spaced points in :math:`t`. E.g., ``nt=3`` outputs
5476+
the evaluation of the curve at :math:`t=0.0`, :math:`t=0.5`, and :math:`t=1.0`.
5477+
5478+
Returns
5479+
-------
5480+
List[List[float]]
5481+
Value of the NURBS curve second derivative sensitivity w.r.t. :math:`\mathbf{P}_i` at :math:`N_t` linearly-spaced points. Output array has size
5482+
:math:`N_t \times d`, where :math:`d` is the spatial dimension (usually ``3``)
5483+
"""
5484+
5485+
def nurbs_curve_eval_tvec(p: Iterable[Iterable[float]], w: Iterable[float], k: Iterable[float], t: Iterable[float]) -> List[List[float]]:
53235486
r"""
53245487
Evaluates a Non-Uniform Rational B-Spline (NURBS) curve with :math:`n+1` control points on a
53255488
grid of linearly-spaced :math:`t`-values according to
@@ -5342,8 +5505,7 @@ def nurbs_curve_eval_tvec(p: Iterable[Iterable[float]], w: Iterable[float], k: I
53425505
k: Iterable[float]
53435506
1-D list or array of knots
53445507
t: Iterable[float]
5345-
Number of linearly-spaced points in :math:`t`. E.g., ``nt=3`` outputs
5346-
the evaluation of the curve at :math:`t=0.0`, :math:`t=0.5`, and :math:`t=1.0`.
5508+
Vector of parameter values
53475509
53485510
Returns
53495511
-------
@@ -5352,7 +5514,34 @@ def nurbs_curve_eval_tvec(p: Iterable[Iterable[float]], w: Iterable[float], k: I
53525514
:math:`\text{len}(t) \times d`, where :math:`d` is the spatial dimension (usually ``3``)
53535515
"""
53545516

5355-
def nurbs_curve_dcdt_tvec(p: Iterable[Iterable[float]], w: Iterable[float], k: Iterable[float], t: List[float]) -> List[List[float]]:
5517+
def nurbs_curve_eval_dp_tvec(w: Iterable[float], k: Iterable[float], i: int, q: int, dim: int, t: Iterable[float]) -> List[float]:
5518+
r"""
5519+
Evaluates the derivative of the NURBS curve with respect to an individual control point at a given :math:`t`-value
5520+
5521+
Parameters
5522+
----------
5523+
w: Iterable[float]
5524+
1-D list or array of weights corresponding to each of control points. Must have length
5525+
equal to the outer dimension of ``p``.
5526+
k: Iterable[float]
5527+
1-D list or array of knots
5528+
i: int
5529+
Index of the control point
5530+
q: int
5531+
Degree of the curve
5532+
dim: int
5533+
Number of spatial dimensions in the curve. Usually ``2`` or ``3``
5534+
t: Iterable[float]
5535+
Vector of parameter values
5536+
5537+
Returns
5538+
-------
5539+
List[List[float]]
5540+
Value of the NURBS curve sensitivity w.r.t. :math:`\mathbf{P}_i` along a vector of :math:`t`-values. Output array has size
5541+
:math:`\text{len}(t) \times d`, where :math:`d` is the spatial dimension (usually ``3``)
5542+
"""
5543+
5544+
def nurbs_curve_dcdt_tvec(p: Iterable[Iterable[float]], w: Iterable[float], k: Iterable[float], t: Iterable[float]) -> List[List[float]]:
53565545
r"""
53575546
Evaluates a the first derivative with respect to :math:`t` of a Non-Uniform Rational B-Spline (NURBS) curve
53585547
with :math:`n+1` control points on a grid of linearly-spaced :math:`t`-values according to
@@ -5387,8 +5576,7 @@ def nurbs_curve_dcdt_tvec(p: Iterable[Iterable[float]], w: Iterable[float], k: I
53875576
k: Iterable[float]
53885577
1-D list or array of knots
53895578
t: Iterable[float]
5390-
Number of linearly-spaced points in :math:`t`. E.g., ``nt=3`` outputs
5391-
the evaluation of the curve at :math:`t=0.0`, :math:`t=0.5`, and :math:`t=1.0`.
5579+
Vector of parameter values
53925580
53935581
Returns
53945582
-------
@@ -5397,7 +5585,34 @@ def nurbs_curve_dcdt_tvec(p: Iterable[Iterable[float]], w: Iterable[float], k: I
53975585
:math:`\text{len}(t) \times d`, where :math:`d` is the spatial dimension (usually ``3``)
53985586
"""
53995587

5400-
def nurbs_curve_d2cdt2_tvec(p: Iterable[Iterable[float]], w: Iterable[float], k: Iterable[float], t: List[float]) -> List[List[float]]:
5588+
def nurbs_curve_dcdt_dp_tvec(w: Iterable[float], k: Iterable[float], i: int, q: int, dim: int, t: Iterable[float]) -> List[float]:
5589+
r"""
5590+
Evaluates the sensitivity of the NURBS curve first derivative with respect to an individual control point at a given :math:`t`-value
5591+
5592+
Parameters
5593+
----------
5594+
w: Iterable[float]
5595+
1-D list or array of weights corresponding to each of control points. Must have length
5596+
equal to the outer dimension of ``p``.
5597+
k: Iterable[float]
5598+
1-D list or array of knots
5599+
i: int
5600+
Index of the control point
5601+
q: int
5602+
Degree of the curve
5603+
dim: int
5604+
Number of spatial dimensions in the curve. Usually ``2`` or ``3``
5605+
t: Iterable[float]
5606+
Vector of parameter values
5607+
5608+
Returns
5609+
-------
5610+
List[List[float]]
5611+
Value of the NURBS curve first derivative sensitivity w.r.t. :math:`\mathbf{P}_i` along a vector of :math:`t`-values. Output array has size
5612+
:math:`\text{len}(t) \times d`, where :math:`d` is the spatial dimension (usually ``3``)
5613+
"""
5614+
5615+
def nurbs_curve_d2cdt2_tvec(p: Iterable[Iterable[float]], w: Iterable[float], k: Iterable[float], t: Iterable[float]) -> List[List[float]]:
54015616
r"""
54025617
Evaluates a the second derivative with respect to :math:`t` of a Non-Uniform Rational B-Spline (NURBS) curve
54035618
with :math:`n+1` control points on a grid of linearly-spaced :math:`t`-values according to
@@ -5435,8 +5650,7 @@ def nurbs_curve_d2cdt2_tvec(p: Iterable[Iterable[float]], w: Iterable[float], k:
54355650
k: Iterable[float]
54365651
1-D list or array of knots
54375652
t: Iterable[float]
5438-
Number of linearly-spaced points in :math:`t`. E.g., ``nt=3`` outputs
5439-
the evaluation of the curve at :math:`t=0.0`, :math:`t=0.5`, and :math:`t=1.0`.
5653+
Vector of parameter values
54405654
54415655
Returns
54425656
-------
@@ -5445,6 +5659,34 @@ def nurbs_curve_d2cdt2_tvec(p: Iterable[Iterable[float]], w: Iterable[float], k:
54455659
:math:`\text{len}(t) \times d`, where :math:`d` is the spatial dimension (usually ``3``)
54465660
"""
54475661

5662+
def nurbs_curve_d2cdt2_dp_tvec(w: Iterable[float], k: Iterable[float], i: int, q: int, dim: int, t: Iterable[float]) -> List[float]:
5663+
r"""
5664+
Evaluates the sensitivity of the NURBS curve second derivative with respect to an individual control point at a given :math:`t`-value
5665+
5666+
Parameters
5667+
----------
5668+
w: Iterable[float]
5669+
1-D list or array of weights corresponding to each of control points. Must have length
5670+
equal to the outer dimension of ``p``.
5671+
k: Iterable[float]
5672+
1-D list or array of knots
5673+
i: int
5674+
Index of the control point
5675+
q: int
5676+
Degree of the curve
5677+
dim: int
5678+
Number of spatial dimensions in the curve. Usually ``2`` or ``3``
5679+
1-D list or array of knots
5680+
t: Iterable[float]
5681+
Vector of parameter values
5682+
5683+
Returns
5684+
-------
5685+
List[List[float]]
5686+
Value of the NURBS curve second derivative sensitivity w.r.t. :math:`\mathbf{P}_i` along a vector of :math:`t`-values. Output array has size
5687+
:math:`\text{len}(t) \times d`, where :math:`d` is the spatial dimension (usually ``3``)
5688+
"""
5689+
54485690
def nurbs_surf_eval(p: Iterable[Iterable[Iterable[float]]], w: Iterable[Iterable[float]], ku: Iterable[float], kv: Iterable[float], u: float, v: float) -> List[float]:
54495691
r"""
54505692
Evaluates a Non-Uniform Rational B-Spline (NURBS) surface with :math:`n+1` control points in the :math:`u`-direction

0 commit comments

Comments
 (0)