Data Structures | Typedefs | Functions
Bezier Curve

Data Structures

struct  _Eina_Bezier
 

Typedefs

typedef struct _Eina_Bezier Eina_Bezier
 Floating point cubic bezier curve.
 

Functions

EINA_API void eina_bezier_values_set (Eina_Bezier *b, double start_x, double start_y, double ctrl_start_x, double ctrl_start_y, double ctrl_end_x, double ctrl_end_y, double end_x, double end_y)
 Sets the values of the points of the given floating point cubic bezier curve. More...
 
EINA_API void eina_bezier_values_get (const Eina_Bezier *b, double *start_x, double *start_y, double *ctrl_start_x, double *ctrl_start_y, double *ctrl_end_x, double *ctrl_end_y, double *end_x, double *end_y)
 Gets the values of the points of the given floating point cubic bezier curve. More...
 
EINA_API double eina_bezier_length_get (const Eina_Bezier *b)
 Calculates the approximate length of the given floating point cubic bezier curve. More...
 
EINA_API double eina_bezier_t_at (const Eina_Bezier *b, double len)
 Returns the relative position on a bezier at a given length. More...
 
EINA_API void eina_bezier_point_at (const Eina_Bezier *b, double t, double *px, double *py)
 Gets the point on the bezier curve at position t. More...
 
EINA_API double eina_bezier_angle_at (const Eina_Bezier *b, double t)
 Determines the slope of the bezier at a given position. More...
 
EINA_API void eina_bezier_split_at_length (const Eina_Bezier *b, double len, Eina_Bezier *left, Eina_Bezier *right)
 Splits the bezier at a given length. More...
 
EINA_API void eina_bezier_bounds_get (const Eina_Bezier *b, double *x, double *y, double *w, double *h)
 Calculates the bounding box for the bezier. More...
 
EINA_API void eina_bezier_on_interval (Eina_Bezier *b, double t0, double t1, Eina_Bezier *result)
 Finds the bezier between the given interval. More...
 

Detailed Description

Function Documentation

◆ eina_bezier_values_set()

EINA_API void eina_bezier_values_set ( Eina_Bezier b,
double  start_x,
double  start_y,
double  ctrl_start_x,
double  ctrl_start_y,
double  ctrl_end_x,
double  ctrl_end_y,
double  end_x,
double  end_y 
)

Sets the values of the points of the given floating point cubic bezier curve.

Parameters
[out]bThe floating point bezier.
[in]start_xThe x coordinate of the start point.
[in]start_yThe y coordinate of the start point.
[in]ctrl_start_xThe x coordinate of the 1st control point.
[in]ctrl_start_yThe y coordinate of the 1st control point.
[in]ctrl_end_xThe X coordinate of the 2nd control point.
[in]ctrl_end_yThe Y coordinate of the 2nd control point.
[in]end_xThe X coordinate of the end point.
[in]end_yThe Y coordinate of the end point.

b. No check is done on b.

Since
1.16

◆ eina_bezier_values_get()

EINA_API void eina_bezier_values_get ( const Eina_Bezier b,
double *  start_x,
double *  start_y,
double *  ctrl_start_x,
double *  ctrl_start_y,
double *  ctrl_end_x,
double *  ctrl_end_y,
double *  end_x,
double *  end_y 
)

Gets the values of the points of the given floating point cubic bezier curve.

Parameters
[in]bThe floating point bezier.
[out]start_xx coordinate of start point.
[out]start_yy coordinate of start point.
[out]ctrl_start_xx coordinate of 1st control point.
[out]ctrl_start_yy coordinate of 1st control point.
[out]ctrl_end_xx coordinate of 2nd control point.
[out]ctrl_end_yy coordinate of 2nd control point.
[out]end_xx coordinate of end point.
[out]end_yy coordinate of end point.

b. No check is done on b.

Since
1.16

◆ eina_bezier_length_get()

EINA_API double eina_bezier_length_get ( const Eina_Bezier b)

Calculates the approximate length of the given floating point cubic bezier curve.

Parameters
[in]bThe floating point bezier.
Returns
The bezier's length.

The curve length is approximated using the Alpha max plus beta min algorithm, which is designed to give fast results with a maximum error of less than 7% compared with the correct value.

No check is done on b.

Since
1.16

Referenced by eina_bezier_t_at().

◆ eina_bezier_t_at()

EINA_API double eina_bezier_t_at ( const Eina_Bezier b,
double  len 
)

Returns the relative position on a bezier at a given length.

Parameters
[in]bThe floating point bezier.
[in]lenThe length along the bezier curve.
Returns
The relative position from 0.0 to 1.0.

Calculates the proportional location on b as a number from 0.0 to 1.0 that corresponds to a distance len along it. Returns 1.0 if len is equal or greater than the bezier's length.

No check is done on b.

Since
1.16

References eina_bezier_length_get(), and EINA_DBL_EQ.

Referenced by eina_bezier_split_at_length().

◆ eina_bezier_point_at()

EINA_API void eina_bezier_point_at ( const Eina_Bezier b,
double  t,
double *  px,
double *  py 
)

Gets the point on the bezier curve at position t.

Parameters
[in]bThe floating point bezier.
[in]tThe floating point position between 0.0 and 1.0.
[out]pxThe corresponding point's X coordinate.
[out]pyThe corresponding point's Y coordinate.

No check is done on b.

Since
1.16

References _Eina_Bezier::x, and _Eina_Bezier::y.

◆ eina_bezier_angle_at()

EINA_API double eina_bezier_angle_at ( const Eina_Bezier b,
double  t 
)

Determines the slope of the bezier at a given position.

Parameters
[in]bThe floating point bezier.
[out]tThe position along the bezier between 0.0 and 1.0.

No check is done on b.

Since
1.16

◆ eina_bezier_split_at_length()

EINA_API void eina_bezier_split_at_length ( const Eina_Bezier b,
double  len,
Eina_Bezier left,
Eina_Bezier right 
)

Splits the bezier at a given length.

Parameters
[in]bThe floating point bezier.
[in]lenThe length along the bezier to make the split.
[out]leftThe resultant split's left portion of the bezier.
[out]rightThe resultant split's right portion of the bezier.

No check is done on b.

Since
1.16

References eina_bezier_t_at().

◆ eina_bezier_bounds_get()

EINA_API void eina_bezier_bounds_get ( const Eina_Bezier b,
double *  x,
double *  y,
double *  w,
double *  h 
)

Calculates the bounding box for the bezier.

Parameters
[in]bThe floating point bezier.
[out]xThe X coordinate of the bounding box.
[out]yThe Y coordinate of the bounding box.
[out]wThe width of the bounding box.
[out]hThe height of the bounding box.

No check is done on b.

Since
1.17

◆ eina_bezier_on_interval()

EINA_API void eina_bezier_on_interval ( Eina_Bezier b,
double  t0,
double  t1,
Eina_Bezier result 
)

Finds the bezier between the given interval.

Parameters
[in]bThe floating point bezier.
[in]t0The start of the interval.
[in]t1The end of the interval.
[out]resultThe resulting bezier.

No check is done on b.

Since
1.17

References EINA_DBL_EQ.