# template<UnsignedInt order, UnsignedInt dimensions, class T>Magnum::Math::Bezier class

Bézier curve.

Template parameters
order Order of Bézier curve
dimensions Dimensions of control points
T Underlying data type

### Contents

• Reference

Represents a M-order N-dimensional Bézier Curve segment.

Cubic Bézier curves are fully interchangeable with cubic Hermite splines, use fromCubicHermite() and CubicHermite::fromBezier() for the conversion.

## Public types

enum (anonymous): UnsignedInt { Order = order, Dimensions = dimensions }
using Type = T
Underlying data type.

## Public static functions

template<class VectorType>
static auto fromCubicHermite(const CubicHermite<VectorType>& a, const CubicHermite<VectorType>& b) -> Bezier<order, dimensions, T>
Create cubic Hermite spline point from adjacent Bézier curve segments.

## Constructors, destructors, conversion operators

ZeroInitT = ZeroInit) constexpr noexcept
Default constructor.
NoInitT) explicit noexcept
Construct Bézier without initializing the contents.
template<typename... U>
const Vector<dimensions, T>& first, U... next) constexpr noexcept
Construct Bézier curve with given array of control points.
template<class U>
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::declval<U>()))>
const U& other) explicit constexpr noexcept
Construct Bézier curve from external representation.
template<class U, class V = decltype(Implementation::BezierConverter<order, dimensions, T, U>::to(std::declval<Bezier<order, dimensions, T>>()))>
) const explicit constexpr
Convert Bézier curve to external representation.

## Public functions

auto data() -> Vector<dimensions, T>*
Raw data.
auto data() const -> const Vector<dimensions, T>* constexpr
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> template<class VectorType> static Bezier<order, dimensions, T> Magnum::Math::Bezier<order, dimensions, T>::fromCubicHermite(const CubicHermite<VectorType>& a, const CubicHermite<VectorType>& b)

Create cubic Hermite spline point from adjacent Bézier curve segments.

Given two cubic Hermite spline points defined by points , in-tangents and out-tangents , the corresponding cubic Bezier curve segment with points , , and is defined as:

Enabled only on CubicBezier for CubicHermite with vector underlying types. See CubicHermite::fromBezier() for the inverse operation.

### 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>::data()

Raw data.

Returns One-dimensional array of order + 1 elements

### template<UnsignedInt order, UnsignedInt dimensions, class T> const Vector<dimensions, T>* Magnum::Math::Bezier<order, dimensions, T>::data() 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>::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.