15#ifndef BIFROST_MATH_FCURVE_H
16#define BIFROST_MATH_FCURVE_H
22#include <Amino/Core/internal/ConfigMacros.h>
28class FCurveSerializer;
34#define BIFROST_IGNORE_NAMESPACE AMINO_ANNOTATE("Amino::Namespace ignore")
36#undef BIFROST_IGNORE_NAMESPACE
45class AMINO_ANNOTATE("
Amino::Class") BIFROST_MATH_SHARED_DECL
FCurve {
47 friend class Amino::FCurveSerializer;
125 : m_coords(coords) {}
134 m_spanInterpolation(spanInterpolation),
135 m_curveInterpolation(curveInterpolation),
144 return m_spanInterpolation;
149 return m_curveInterpolation;
164 SpanInterpolationMethod::Curve;
168 CurveInterpolationMethod::Bezier;
171 bool m_locked =
true;
183 explicit FCurve(
bool createDefaultValue =
true);
237 return evaluateCurveSegment(
238 CurveInterpolationMethod::Bezier,
239 x0, y0, x1, y1, x2, y2, x3, y3, x);
250 return m_postExtrapolation;
273 m_preExtrapolation = preExtrapolation;
274 m_postExtrapolation = postExtrapolation;
278 AMINO_INTERNAL_WARNING_PUSH
279 AMINO_INTERNAL_WARNING_DISABLE_MSC(4251)
280 FCurvePoints m_points;
281 ExtrapolationMode m_preExtrapolation = ExtrapolationMode::Constant;
282 ExtrapolationMode m_postExtrapolation = ExtrapolationMode::Constant;
283 AMINO_INTERNAL_WARNING_POP
A resizable container of contiguous elements.
Smart pointers used to allow custom user classes (opaque classes) to be used within Amino graphs....
Header Parser Annotation Macro & Parser Documentation.
Macros used to declare functions and traits about classes exposed to Amino.
AMINO_DECLARE_DEFAULT_CLASS(BIFROST_MATH_SHARED_DECL, Bifrost::Math::FCurve)
Macro for generating the getDefault entry point declaration related to a given opaque type,...
#define BIFROST_IGNORE_NAMESPACE
Use a define, otherwise clang-format gets confused.
Definition of macros for symbol visibility.
Define a Amino array of elements of type T.
static double evaluateCurveSegment(CurveInterpolationMethod interpolation, double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3, double x)
Support function to evaluate a cubic curve segment.
bool defaultValue()
Reset to a default FCurve.
static double evalBezier(double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3, double x)
Short-hand for evaluateCurveSegment with Bezier interpolation.
int numPoints() const
Number of points in the FCurve.
FCurvePoints const & getPoints() const
Get the points of the FCurve.
void setExtrapolationModes(ExtrapolationMode preExtrapolation, ExtrapolationMode postExtrapolation)
Set the extrapolation modes of the regions before the first and after the last point.
FCurve(FCurve const &other)
Copy constructor.
FCurve(bool createDefaultValue=true)
Constructor.
double evalFCurve(double x) const
Evaluate the FCurve at the given x value.
ExtrapolationMode getPreExtrapolation() const
Get the pre-extrapolation mode.
ExtrapolationMode getPostExtrapolation() const
Get the post-extrapolation mode.
void setPoints(FCurvePoints points)
Set the array of segment points.
Struct for previous, current, and next point for a curve.
constexpr SegmentPoint(ControlPoints const &coords)
Constructor with control points and default interpolation methods.
constexpr SegmentPoint()=default
Default constructor.
SpanInterpolationMethod getSpanInterpolation() const
Get the interpolation method for the span between this point and the next point.
bool isLocked() const
Check if this point is locked.
CurveInterpolationMethod getCurveInterpolation() const
Get the interpolation method for the curve segment.
ControlPoints const & getControlPoints() const
Get the control points for the segment.
constexpr SegmentPoint(ControlPoints const &coords, SpanInterpolationMethod spanInterpolation, CurveInterpolationMethod curveInterpolation, bool locked)
Constructor with control points and interpolation methods.