Source code for buffalo_wings.airfoil.internal.spline.curve

"""Bezier-backed spline curve runtime for open section geometry."""

from __future__ import annotations

from typing import override

from buffalo_core.numeric import as_float_scalar
from buffalo_core.typing import FloatArray, FloatInput, FloatScalar

from buffalo_wings.airfoil.internal.bezier import BezierCurve2D
from buffalo_wings.airfoil.internal.curve import Curve


[docs] class SplineCurve(Curve): """ Bezier-backed spline curve runtime for open section geometry. Notes ----- This runtime is intentionally backend-neutral in name while the first supported schema slice stores Bezier control points directly. """ def __init__( self, *, curve: BezierCurve2D, ) -> None: """Store one Bezier-backed open curve runtime.""" self._curve = curve @property def curve(self) -> BezierCurve2D: """Return the underlying Bezier curve representation.""" return self._curve
[docs] @override def xy_from_u(self, u: FloatInput) -> tuple[FloatArray, FloatArray]: """Evaluate open-curve coordinates at native parameter values.""" return self.curve.xy(u)
[docs] @override def xy_u(self, u: FloatInput) -> tuple[FloatArray, FloatArray]: """Evaluate first derivatives at native parameter values.""" return self.curve.xy_u(u)
[docs] @override def xy_uu(self, u: FloatInput) -> tuple[FloatArray, FloatArray]: """Evaluate second derivatives at native parameter values.""" return self.curve.xy_uu(u)
[docs] @override def breakpoints(self) -> list[FloatScalar]: """Return the native endpoint breakpoints for the open curve.""" return [as_float_scalar(0.0), as_float_scalar(1.0)]