template<UnsignedInt order, UnsignedInt dimensions, class T>
Bezier class
Bézier curve.
Template parameters | |
---|---|
order | Order of Bézier curve |
dimensions | Dimensions of control points |
T | Underlying data type |
Contents
Implementation of M-order N-dimensional Bézier Curve.
Public types
- enum (anonymous): UnsignedInt { Order = order, Dimensions = dimensions }
- using Type = T
- Underlying data type.
Constructors, destructors, conversion operators
- Bezier(ZeroInitT = ZeroInit) constexpr noexcept
- Default constructor.
- Bezier(NoInitT) explicit noexcept
- Construct Bézier without initializing the contents.
-
template<typename... U>Bezier(const Vector<dimensions, T>& first, U... next) constexpr noexcept
- Construct Bézier curve with given array of control points.
-
template<class U>Bezier(const Bezier<order, dimensions, U>& other) explicit constexpr noexcept
- Construct Bézier curve from another of different type.
-
template<class U, class V = decltype(Implementation::BezierConverter<order, dimensions, T, U>::from(std::Bezier(const U& other) explicit constexpr noexcept
declval<U>()))> - Construct Bézier from external representation.
-
template<class U, class V = decltype(Implementation::BezierConverter<order, dimensions, T, U>::to(std::operator U() const explicit constexpr
declval<Bezier<order, dimensions, T>>()))> - Convert Bézier to external representation.
Public functions
- auto operator==(const Bezier<order, dimensions, T>& other) const -> bool
- Equality comparison.
- auto operator!=(const Bezier<order, dimensions, T>& other) const -> bool
- Non-equality comparison.
-
auto operator[](std::
size_t i) -> Vector<dimensions, T>& - Control point access.
-
auto operator[](std::
size_t i) const -> const Vector<dimensions, T>& constexpr - auto value(Float t) const -> Vector<dimensions, T>
- Interpolate the curve at given position.
-
auto subdivide(Float t) const -> std::
pair<Bezier<order, dimensions, T>, Bezier<order, dimensions, T>> - Subdivide the curve at given position.
Enum documentation
template<UnsignedInt order, UnsignedInt dimensions, class T>
enum Magnum:: Math:: Bezier<order, dimensions, T>:: (anonymous): UnsignedInt
Enumerators | |
---|---|
Order |
Order of Bézier curve |
Dimensions |
Dimensions of control points |
Function documentation
template<UnsignedInt order, UnsignedInt dimensions, class T>
Magnum:: Math:: Bezier<order, dimensions, T>:: Bezier(ZeroInitT = ZeroInit) constexpr noexcept
Default constructor.
Construct the curve with all control points being zero vectors.
template<UnsignedInt order, UnsignedInt dimensions, class T>
template<class U>
Magnum:: Math:: Bezier<order, dimensions, T>:: Bezier(const Bezier<order, dimensions, U>& other) explicit constexpr noexcept
Construct Bézier curve from another of different type.
Performs only default casting on the values, no rounding or anything else.
template<UnsignedInt order, UnsignedInt dimensions, class T>
Vector<dimensions, T>& Magnum:: Math:: Bezier<order, dimensions, T>:: operator[](std:: size_t i)
Control point access.
i
should not be larger than Order.
template<UnsignedInt order, UnsignedInt dimensions, class T>
const Vector<dimensions, T>& Magnum:: Math:: Bezier<order, dimensions, T>:: operator[](std:: size_t i) const constexpr
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<UnsignedInt order, UnsignedInt dimensions, class T>
Vector<dimensions, T> Magnum:: Math:: Bezier<order, dimensions, T>:: value(Float t) const
Interpolate the curve at given position.
Returns point on the curve for given interpolation factor. Uses the De Casteljau's algorithm.
template<UnsignedInt order, UnsignedInt dimensions, class T>
std:: pair<Bezier<order, dimensions, T>, Bezier<order, dimensions, T>> Magnum:: Math:: Bezier<order, dimensions, T>:: subdivide(Float t) const
Subdivide the curve at given position.
Returns two Bézier curves following the original curve, split at given interpolation factor. Uses the De Casteljau's algorithm.
template<UnsignedInt order, UnsignedInt dimensions, class T>
template<UnsignedInt order, UnsignedInt dimensions, class T>
Corrade:: Utility:: Debug& operator<<(Corrade:: Utility:: Debug& debug,
const Bezier<order, dimensions, T>& value)
Debug output operator.