buffalo_wings.airfoil.BezierCurve2D

class buffalo_wings.airfoil.BezierCurve2D(*, control_points)[source]

Bases: object

Two-dimensional Bezier curve.

Methods

control_polygon()

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

control_points

Return the stored control points.

degree

Return the Bezier degree.

x_curve

Return the one-dimensional x-coordinate curve.

y_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:

BezierCurve2D

Raises:

ValueError – If x_curve and y_curve do 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:

BezierCurve1D

property y_curve: BezierCurve1D

Return the one-dimensional y-coordinate curve.

Returns:

One-dimensional Bezier curve for the y-coordinate.

Return type:

BezierCurve1D

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 at u.

  • buffalo_core.typing.FloatArray – Y-coordinates evaluated at u.

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 at u.

  • buffalo_core.typing.FloatArray – Y-derivatives evaluated at u.

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 at u.

  • buffalo_core.typing.FloatArray – Second y-derivatives evaluated at u.

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, default 1) – Number of degree-elevation steps to apply.

Returns:

Elevated two-dimensional Bezier curve.

Return type:

BezierCurve2D

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, default 1) – 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:

BezierCurve2D

control_polygon()[source]

Return the control polygon as a float64 array.

Returns:

(n, 2) array of planar control points.

Return type:

buffalo_core.typing.FloatArray