OGLplus  (0.59.0) a C++ wrapper for rendering APIs

eagine::math::bezier_curves< Type, Parameter, Order > Class Template Reference

A sequence of Bezier curves, possibly connected at end points. More...

#include <eagine/math/curve.hpp>

Public Member Functions

auto is_connected () const noexcept -> bool
 Returns true if the individual curves are connected.
 
auto is_separated () const noexcept -> bool
 Returns true if the individual curves are disconnected.
 
 bezier_curves (std::vector< Type > points)
 Creates the bezier curves from the control points. More...
 
 bezier_curves (std::vector< Type > points, bool connected)
 Creates the bezier curves from the control points. More...
 
template<typename P , typename S >
 bezier_curves (memory::basic_span< const Type, P, S > points)
 Creates the bezier curves from the control points. More...
 
template<typename P , typename S >
 bezier_curves (memory::basic_span< const Type, P, S > points, bool connected)
 Creates the bezier curves from the control points. More...
 
auto segment_count () const noexcept -> span_size_t
 Returns the count of individual curves in the sequence.
 
auto control_points () const noexcept -> const std::vector< Type > &
 Returns the contol points of the curve.
 
auto position01 (Parameter t) const noexcept -> Type
 Gets the point on the curve at position t (must be in (0.0, 1.0)).
 
auto position (Parameter t) const noexcept -> Type
 Gets the point on the curve at position t wrapped to [0.0, 1.0].
 
void approximate (std::vector< Type > &dest, valid_if_positive< span_size_t > n) const noexcept
 Makes a sequence of points on the curve (n points per segment).
 
auto approximate (valid_if_positive< span_size_t > n) const -> std::vector< Type >
 Returns a sequence of points on the curve (n points per segment).
 
auto derivative () const noexcept -> bezier_curves< Type, Parameter, Order - 1 >
 Returns a derivative of this curve.
 

Static Public Member Functions

static auto are_connected (const std::vector< Type > &points) noexcept -> bool
 Returns whether the curves made from points are connected.
 
static auto points_are_ok (const std::vector< Type > &points) noexcept -> bool
 checks if the sequence of control points is OK for this curve type.
 
static auto wrap (Parameter t) noexcept -> Parameter
 Wraps the parameter value to [0.0, 1.0].
 

Detailed Description

template<typename Type, typename Parameter, span_size_t Order>
class eagine::math::bezier_curves< Type, Parameter, Order >

A sequence of Bezier curves, possibly connected at end points.

See also
CubicBezierLoop

This class stores the data for a sequence of connected Bezier curves of a given Order. The begin of the i-th curve (segment) is equal to the end of the (i-1)-th curve and the end of the i-th curve is equal to the begin of the (i+1)-th curve. Between the begin and end (control) points there is a fixed number (Order - 1) of curve control points. The curves pass through the begin and end and are influenced by the other control points.

Constructor & Destructor Documentation

◆ bezier_curves() [1/4]

template<typename Type , typename Parameter , span_size_t Order>
eagine::math::bezier_curves< Type, Parameter, Order >::bezier_curves ( std::vector< Type >  points)
inline

Creates the bezier curves from the control points.

Precondition
points_are_ok(points)

The number of points must be ((C * Order) + 1) or (C * (Order + 1)) where C is the number of curves (segments) in the sequence. If both of the above are true then the curves are considered to be connected.

◆ bezier_curves() [2/4]

template<typename Type , typename Parameter , span_size_t Order>
eagine::math::bezier_curves< Type, Parameter, Order >::bezier_curves ( std::vector< Type >  points,
bool  connected 
)
inline

Creates the bezier curves from the control points.

Precondition
points_are_ok(points)
are_connected(points) == connected

The number of points must be ((C * Order) + 1) and connected or (C * (Order + 1)) and not(connected), where C is the number of curves (segments) in the sequence.

◆ bezier_curves() [3/4]

template<typename Type , typename Parameter , span_size_t Order>
template<typename P , typename S >
eagine::math::bezier_curves< Type, Parameter, Order >::bezier_curves ( memory::basic_span< const Type, P, S >  points)
inline

Creates the bezier curves from the control points.

Precondition
points_are_ok(points)

The number of points must be ((C * Order) + 1) or (C * (Order + 1)) where C is the number of curves (segments) in the sequence. If both of the above are true then the curves are considered to be connected.

◆ bezier_curves() [4/4]

template<typename Type , typename Parameter , span_size_t Order>
template<typename P , typename S >
eagine::math::bezier_curves< Type, Parameter, Order >::bezier_curves ( memory::basic_span< const Type, P, S >  points,
bool  connected 
)
inline

Creates the bezier curves from the control points.

Precondition
points_are_ok(points)
are_connected(points) == connected

The number of points must be ((C * Order) + 1) or (C * (Order + 1)) where C is the number of curves (segments) in the sequence. If both of the above are true then the curves are considered to be connected.


The documentation for this class was generated from the following file:

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).