buffalo_wings.airfoil.Curve

class buffalo_wings.airfoil.Curve[source]

Bases: ABC

Base class for 1-d curves.

Curves can be interrogated based on their specific parameterization and by their arc-length parameterization. The specific parametrization variable is u, and the arc-length parameterization variable is s and is a measure of the distance from the start of the curve (at the minimum u).

Arc-length queries are more expensive because the mapping from surface distance to the native parameter is not available in closed form for general curve shapes.

Breakpoints are the native-parameter locations where one-sided derivative information matters. Interior breakpoints are reserved for locations where first- or higher-derivative behavior may differ on the two sides. Endpoints are always included as one-sided boundary markers.

The ordinary derivative evaluators, such as xy_u(), xy_uu(), xy_s(), and xy_ss(), use the minus-side value when the query lands exactly on a reported breakpoint. The paired *_breakpoint methods expose both one-sided values explicitly. Subclasses should override the breakpoint methods whenever exact one-sided values are available and should rely on the generic sampled fallback only when no exact representation is available.

Methods

arc_length(u_s, u_e)

Calculate the arc-length distance between two points on surface.

arc_length_breakpoints()

Return the breakpoint locations in arc-length coordinates.

breakpoint_parameter_limits(*, index)

Return parameter limits for one breakpoint.

breakpoints()

Return the sorted locations of any breakpoints in the curve.

k(u)

Calculate the curvature at parameter location.

normal(u)

Calculate the unit normal at parameter location.

tangent(u)

Calculate the unit tangent at parameter location.

u_from_s(s)

Calculate the parametric value for arc-length provided.

xy_from_s(s)

Return curve coordinates at arc-length locations.

xy_from_u(u)

Calculate the coordinates of geometry at parameter location.

xy_s(s)

Calculate first derivatives at arc-length location.

xy_s_breakpoint(*, index)

Return both sides of first derivatives at a breakpoint.

xy_ss(s)

Calculate second derivatives at arc-length location.

xy_ss_breakpoint(*, index)

Return one-sided second derivatives at a breakpoint.

xy_u(u)

Calculate rates of change of the coordinates at parameter location.

xy_u_breakpoint(*, index)

Return both sides of first derivatives at one breakpoint.

xy_uu(u)

Calculate second derivative of the coordinates at parameter location.

xy_uu_breakpoint(*, index)

Return one-sided second derivatives at one breakpoint.

Attributes

length

Return the total curve length.

abstractmethod xy_from_u(u)[source]

Calculate the coordinates of geometry at parameter location.

Parameters:

u (buffalo_core.typing.FloatInput) – Parameter for desired locations.

Returns:

Tuple (x, y) of float64 arrays matching the normalized shape of u.

Return type:

tuple[FloatArray, FloatArray]

abstractmethod xy_u(u)[source]

Calculate rates of change of the coordinates at parameter location.

Parameters:

u (buffalo_core.typing.FloatInput) – Parameter for desired locations.

Returns:

Tuple (dx/du, dy/du) of float64 arrays matching the normalized shape of u.

Return type:

tuple[FloatArray, FloatArray]

Notes

If u matches one of breakpoints() exactly, this method returns the minus-side derivative limit.

abstractmethod xy_uu(u)[source]

Calculate second derivative of the coordinates at parameter location.

Parameters:

u (buffalo_core.typing.FloatInput) – Parameter for desired locations.

Returns:

Tuple (d^2x/du^2, d^2y/du^2) of float64 arrays matching the normalized shape of u.

Return type:

tuple[FloatArray, FloatArray]

Notes

If u matches one of breakpoints() exactly, this method returns the minus-side derivative limit.

tangent(u)[source]

Calculate the unit tangent at parameter location.

Parameters:

u (buffalo_core.typing.FloatInput) – Parameter for desired locations.

Returns:

Tuple (t_x, t_y) of float64 arrays matching the normalized shape of u.

Return type:

tuple[FloatArray, FloatArray]

normal(u)[source]

Calculate the unit normal at parameter location.

Parameters:

u (buffalo_core.typing.FloatInput) – Parameter for desired locations.

Returns:

Tuple (n_x, n_y) of float64 arrays matching the normalized shape of u.

Return type:

tuple[FloatArray, FloatArray]

k(u)[source]

Calculate the curvature at parameter location.

Parameters:

u (buffalo_core.typing.FloatInput) – Parameter for desired locations.

Returns:

Curvature of surface matching the normalized shape of u.

Return type:

buffalo_core.typing.FloatArray

property length: buffalo_core.typing.FloatScalar

Return the total curve length.

Returns:

Arc length measured from the minimum to maximum native parameter.

Return type:

buffalo_core.typing.FloatScalar

xy_u_breakpoint(*, index)[source]

Return both sides of first derivatives at one breakpoint.

Parameters:

index (int) – Index into breakpoints().

Returns:

((x_u_minus, y_u_minus), (x_u_plus, y_u_plus)).

Return type:

CurveBreakpointSides

Notes

Endpoint breakpoints return the same boundary value for both entries. This method is the exact-breakpoint contract that pairs with xy_u(). Subclasses should override it whenever they can return exact one-sided derivative values. The generic implementation evaluates nearby one-sided parameter samples and therefore serves only as an approximation fallback.

xy_uu_breakpoint(*, index)[source]

Return one-sided second derivatives at one breakpoint.

Parameters:

index (int) – Index into breakpoints().

Returns:

((x_uu_minus, y_uu_minus), (x_uu_plus, y_uu_plus)).

Return type:

CurveBreakpointSides

Notes

Endpoint breakpoints return the same boundary value for both entries. This method is the exact-breakpoint contract that pairs with xy_uu(). Subclasses should override it whenever they can return exact one-sided second-derivative values. The generic implementation evaluates nearby one-sided parameter samples and therefore serves only as an approximation fallback.

abstractmethod breakpoints()[source]

Return the sorted locations of any breakpoints in the curve.

The resulting list must be in ascending parameter order and contain any parametric locations where one-sided derivative information may be needed, such as slope, curvature, or higher-derivative changes, as well as the end points for the curve (if they exist). Endpoints are included as boundary markers even though they are only one-sided breakpoints. Interior breakpoints are the locations where two-sided derivative information may differ.

Returns:

Parametric coordinates of any breakpoints.

Return type:

list[FloatScalar]

breakpoint_parameter_limits(*, index)[source]

Return parameter limits for one breakpoint.

Notes

Endpoint breakpoints return the exact boundary parameter. Interior breakpoints return nearby one-sided parameters chosen within the neighboring breakpoint interval for the current generic breakpoint-side implementation. These limits exist to support the sampled fallback in the generic *_breakpoint methods and should not be treated as the primary source of truth when a subclass can provide exact one-sided values directly.

Return type:

tuple[TypeAliasForwardRef(‘buffalo_core.typing.FloatScalar’), TypeAliasForwardRef(‘buffalo_core.typing.FloatScalar’)]

arc_length(u_s, u_e)[source]

Calculate the arc-length distance between two points on surface.

Parameters:
  • u_s (buffalo_core.typing.FloatScalar) – Start point of distance calculation.

  • u_e (buffalo_core.typing.FloatInput) – End point of distance calculation.

Returns:

Distance from start point to end point.

Return type:

buffalo_core.typing.FloatArray

u_from_s(s)[source]

Calculate the parametric value for arc-length provided.

Parameters:

s (buffalo_core.typing.FloatInput) – Arc-length location of point.

Returns:

Parametric value matching the normalized shape of s.

Return type:

buffalo_core.typing.FloatArray

Raises:

ValueError – When arc-length provided lies outside the curve arc-length range.

xy_from_s(s)[source]

Return curve coordinates at arc-length locations.

Parameters:

s (buffalo_core.typing.FloatInput) – Arc length location of point.

Returns:

(x, y) coordinates matching the normalized shape of s.

Return type:

tuple[FloatArray, FloatArray]

xy_s(s)[source]

Calculate first derivatives at arc-length location.

Parameters:

s (buffalo_core.typing.FloatInput) – Arc length location of point.

Returns:

(dx/ds, dy/ds) coordinates matching the normalized shape of s.

Return type:

tuple[FloatArray, FloatArray]

Notes

If s matches one of arc_length_breakpoints() exactly, this method returns the minus-side derivative limit. Subclasses should override xy_s_breakpoint() when exact one-sided breakpoint derivatives are available analytically.

xy_ss(s)[source]

Calculate second derivatives at arc-length location.

Parameters:

s (buffalo_core.typing.FloatInput) – Arc length location of point.

Returns:

(d^2x/ds^2, d^2y/ds^2) coordinates matching the normalized shape of s.

Return type:

tuple[FloatArray, FloatArray]

Notes

If s matches one of arc_length_breakpoints() exactly, this method returns the minus-side derivative limit. Subclasses should override xy_ss_breakpoint() when exact one-sided breakpoint second derivatives are available analytically.

xy_s_breakpoint(*, index)[source]

Return both sides of first derivatives at a breakpoint.

Parameters:

index (int) – Index into arc_length_breakpoints().

Returns:

((x_s_minus, y_s_minus), (x_s_plus, y_s_plus)).

Return type:

CurveBreakpointSides

Notes

Endpoint breakpoints return the same boundary value for both entries. This method is the exact-breakpoint contract that pairs with xy_s(). Subclasses should override it whenever exact one-sided arc-length derivatives are available. The generic implementation evaluates nearby one-sided native- parameter samples and therefore serves only as an approximation fallback.

xy_ss_breakpoint(*, index)[source]

Return one-sided second derivatives at a breakpoint.

Parameters:

index (int) – Index into arc_length_breakpoints().

Returns:

((x_ss_minus, y_ss_minus), (x_ss_plus, y_ss_plus)).

Return type:

CurveBreakpointSides

Notes

Endpoint breakpoints return the same boundary value for both entries. This method is the exact-breakpoint contract that pairs with xy_ss(). Subclasses should override it whenever exact one-sided arc-length second derivatives are available. The generic implementation evaluates nearby one-sided native- parameter samples and therefore serves only as an approximation fallback.

arc_length_breakpoints()[source]

Return the breakpoint locations in arc-length coordinates.

Returns:

Arc-length coordinates measured from the minimum native parameter.

Return type:

list[FloatScalar]

Notes

These values include the two curve endpoints as boundary markers. Interior breakpoints correspond to the native-parameter interior breakpoints returned by breakpoints().