|
Infinity Engine v0.6.20
C++ API Documentation
|
Two-dimensional spline curve for procedural path and shape generation. More...
#include <Spline.hpp>
Public Types | |
| using | Vec = Math::Vector2 |
Public Member Functions | |
| Spline2D () | |
| Default constructor. | |
| Spline2D (SplineKind kind) | |
| Constructs a spline with specified interpolation type. | |
| Spline2D (const Spline2D &other) | |
| Copy constructor. | |
| virtual | ~Spline2D () |
| Destructor. | |
| std::unique_ptr< Core::Base > | clone () const override |
| Spline2D & | operator= (const Spline2D &other) |
| Copy assignment operator. | |
| Vec | evaluate (float t) const |
| Evaluates the spline position at parameter t. | |
| Vec | tangent (float t) const |
| Computes the tangent vector at parameter t. | |
| void | setCurveKind (SplineKind kind) |
| Changes the spline interpolation type. | |
| SplineKind | type () const |
| Gets the current spline interpolation type. | |
| const Infinity::Types::TypeID & | typeId () const override |
| Gets the TypeID for Spline2D. | |
Public Member Functions inherited from Infinity::Types::Core::Data | |
| Data () | |
| Data (const Data &other) | |
| Data (Data &&other) | |
| Data & | operator= (const Data &other) |
| Data & | operator= (Data &&other) |
| virtual | ~Data () |
| Virtual destructor. | |
| bool | hasProperty (const std::string &key) const |
| template<typename T > | |
| void | setProperty (const std::string &key, T &&value) |
| Sets a typed property value. | |
| template<typename T > | |
| void | setProperty (const std::string &key, const T &value) |
| Sets a typed property value. | |
| void | setProperty (const std::string &key, PropertyValue &&value) |
| Sets a typed property value. | |
| const PropertyValue & | getProperty (const std::string &key) const |
| Gets a property value without type checking. | |
| template<typename T > | |
| const T & | getProperty (const std::string &key) const |
| Gets a typed property value. | |
| void | removeProperty (const std::string &key) |
Public Member Functions inherited from Infinity::Types::Core::Base | |
| virtual | ~Base () |
| Virtual destructor. | |
| virtual std::istream & | legibleDataRead (std::istream &in) override |
| Deserializes the object from a single-line text representation. | |
| virtual std::ostream & | legibleDataWrite (std::ostream &out) const override |
| Serializes the object to a single-line text representation. | |
Public Attributes | |
| Containers::Array< Vec > | points |
| Control points defining the spline curve. | |
Public Attributes inherited from Infinity::Types::Core::Data | |
| std::unordered_map< std::string, PropertyValue > | properties |
| Property storage for arbitrary metadata. | |
Two-dimensional spline curve for procedural path and shape generation.
Spline2D provides smooth curve interpolation through 2D control points using various mathematical methods (Bezier, Catmull-Rom, B-Spline, or Linear). It is fundamental for procedural generation of:
The spline can be evaluated at any parametric position t ∈ [0, 1] to obtain interpolated positions and tangent vectors along the curve. Control points are stored in a public Array for direct manipulation.
Example usage:
| Infinity::Types::Spatial::Spline2D::Spline2D | ( | ) |
Default constructor.
Creates an empty spline with Bezier interpolation.
|
explicit |
Constructs a spline with specified interpolation type.
| kind | Interpolation method to use (Bezier, CatmullRom, BSpline, or Linear). |
| Infinity::Types::Spatial::Spline2D::Spline2D | ( | const Spline2D & | other | ) |
Copy constructor.
Creates a deep copy of the spline, including all control points and settings.
| other | Spline to copy from. |
|
virtual |
Destructor.
|
overridevirtual |
Reimplemented from Infinity::Types::Core::Data.
| Vec Infinity::Types::Spatial::Spline2D::evaluate | ( | float | t | ) | const |
Evaluates the spline position at parameter t.
Computes the interpolated position on the curve at the given parameter value. The curve is parameterized from 0 (start) to 1 (end).
| t | Parameter value in range [0, 1]. |
Copy assignment operator.
| other | Spline to copy from. |
| void Infinity::Types::Spatial::Spline2D::setCurveKind | ( | SplineKind | kind | ) |
Changes the spline interpolation type.
Switches between different curve types (Bezier, Catmull-Rom, B-Spline, Linear) while preserving the control points.
| kind | New interpolation method to use. |
| Vec Infinity::Types::Spatial::Spline2D::tangent | ( | float | t | ) | const |
Computes the tangent vector at parameter t.
Calculates the derivative of the curve at the given parameter, providing the direction of the curve at that point. Useful for:
| t | Parameter value in range [0, 1]. |
| SplineKind Infinity::Types::Spatial::Spline2D::type | ( | ) | const |
Gets the current spline interpolation type.
|
overridevirtual |
Reimplemented from Infinity::Types::Core::Data.
| Containers::Array<Vec> Infinity::Types::Spatial::Spline2D::points |
Control points defining the spline curve.
Public array of Vector2 control points that define the curve shape. Modify this array directly to change the spline geometry.