buffalo_wings.airfoil.BezierCurve2D
- class buffalo_wings.airfoil.BezierCurve2D(*, control_points)[source]
Bases:
objectTwo-dimensional Bezier curve.
Methods
Return the control polygon as a float64 array.
demote_degree(*[, count, continuity])Lower the Bezier degree with constrained least-squares demotion.
from_coordinate_curves(*, x_curve, y_curve)Build a two-dimensional Bezier curve from coordinate curves.
promote_degree(*[, count])Raise the Bezier degree without changing the represented curve.
xy(u)Evaluate the two-dimensional Bezier curve.
xy_u(u)Evaluate first derivatives of the two-dimensional curve.
xy_uu(u)Evaluate second derivatives of the two-dimensional curve.
Attributes
Return the stored control points.
Return the Bezier degree.
Return the one-dimensional x-coordinate curve.
Return the one-dimensional y-coordinate curve.
- classmethod from_coordinate_curves(*, x_curve, y_curve)[source]
Build a two-dimensional Bezier curve from coordinate curves.
- Parameters:
x_curve (
BezierCurve1D) – One-dimensional Bezier curve for the x-coordinate.y_curve (
BezierCurve1D) – One-dimensional Bezier curve for the y-coordinate.
- Returns:
Two-dimensional Bezier curve composed from the coordinate curves.
- Return type:
- Raises:
ValueError – If
x_curveandy_curvedo not share the same degree.
- property control_points: buffalo_core.typing.FloatArray
Return the stored control points.
- Returns:
Read-only
(n, 2)array of stored planar control points.- Return type:
buffalo_core.typing.FloatArray
- property degree: int
Return the Bezier degree.
- Returns:
Polynomial degree of the two-dimensional Bezier curve.
- Return type:
int
- property x_curve: BezierCurve1D
Return the one-dimensional x-coordinate curve.
- Returns:
One-dimensional Bezier curve for the x-coordinate.
- Return type:
- property y_curve: BezierCurve1D
Return the one-dimensional y-coordinate curve.
- Returns:
One-dimensional Bezier curve for the y-coordinate.
- Return type:
- xy(u)[source]
Evaluate the two-dimensional Bezier curve.
- Parameters:
u (
buffalo_core.typing.FloatInput) – Bezier parameter values.- Returns:
buffalo_core.typing.FloatArray– X-coordinates evaluated atu.buffalo_core.typing.FloatArray– Y-coordinates evaluated atu.
- Return type:
tuple[TypeAliasForwardRef(‘buffalo_core.typing.FloatArray’), TypeAliasForwardRef(‘buffalo_core.typing.FloatArray’)]
- xy_u(u)[source]
Evaluate first derivatives of the two-dimensional curve.
- Parameters:
u (
buffalo_core.typing.FloatInput) – Bezier parameter values.- Returns:
buffalo_core.typing.FloatArray– X-derivatives evaluated atu.buffalo_core.typing.FloatArray– Y-derivatives evaluated atu.
- Return type:
tuple[TypeAliasForwardRef(‘buffalo_core.typing.FloatArray’), TypeAliasForwardRef(‘buffalo_core.typing.FloatArray’)]
- xy_uu(u)[source]
Evaluate second derivatives of the two-dimensional curve.
- Parameters:
u (
buffalo_core.typing.FloatInput) – Bezier parameter values.- Returns:
buffalo_core.typing.FloatArray– Second x-derivatives evaluated atu.buffalo_core.typing.FloatArray– Second y-derivatives evaluated atu.
- Return type:
tuple[TypeAliasForwardRef(‘buffalo_core.typing.FloatArray’), TypeAliasForwardRef(‘buffalo_core.typing.FloatArray’)]
- promote_degree(*, count=1)[source]
Raise the Bezier degree without changing the represented curve.
This operation is exact because it applies exact degree promotion independently to the x-coordinate and y-coordinate Bezier curves.
- Parameters:
count (
int, default1) – Number of degree-elevation steps to apply.- Returns:
Elevated two-dimensional Bezier curve.
- Return type:
- demote_degree(*, count=1, continuity='NOT_CONNECTED')[source]
Lower the Bezier degree with constrained least-squares demotion.
This operation is intentionally approximate. It applies constrained least-squares degree demotion to the shared control-point array and therefore does not guarantee exact preservation of the original curve, except in the special cases where the curve is exactly reducible to the requested lower degree.
- Parameters:
count (
int, default1) – Number of degree-reduction steps to apply.continuity (
{"NOT_CONNECTED", "C0", "C1", "C2"},) – default=”NOT_CONNECTED” Symmetric endpoint continuity to preserve during each demotion step."NOT_CONNECTED"leaves the endpoints unconstrained."C0","C1", and"C2"preserve endpoint value, value-plus-first-derivative, and value-plus-first-two-derivatives, respectively, when the current degree allows it.
- Returns:
Reduced-degree two-dimensional Bezier curve produced by a constrained least-squares approximate demotion.
- Return type: