Bezier Curve
Eina » Tools

## 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.
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.
EINA_API double | eina_bezier_length_get (const Eina_Bezier *b)
| Calculates the approximate length of the given floating point cubic bezier curve.
EINA_API double | eina_bezier_t_at (const Eina_Bezier *b, double len)
| Returns the relative position on a bezier at a given length.
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.
EINA_API double | eina_bezier_angle_at (const Eina_Bezier *b, double t)
| Determines the slope of the bezier at a given position.
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.
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.
EINA_API void | eina_bezier_on_interval (Eina_Bezier *b, double t0, double t1, Eina_Bezier *result)
| Finds the bezier between the given interval.

## 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] | b | The floating point bezier.
  [in] | start_x | The x coordinate of the start point.
  [in] | start_y | The y coordinate of the start point.
  [in] | ctrl_start_x | The x coordinate of the 1st control point.
  [in] | ctrl_start_y | The y coordinate of the 1st control point.
  [in] | ctrl_end_x | The X coordinate of the 2nd control point.
  [in] | ctrl_end_y | The Y coordinate of the 2nd control point.
  [in] | end_x | The X coordinate of the end point.
  [in] | end_y | The 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] | b | The floating point bezier.
  [out] | start_x | x coordinate of start point.
  [out] | start_y | y coordinate of start point.
  [out] | ctrl_start_x | x coordinate of 1st control point.
  [out] | ctrl_start_y | y coordinate of 1st control point.
  [out] | ctrl_end_x | x coordinate of 2nd control point.
  [out] | ctrl_end_y | y coordinate of 2nd control point.
  [out] | end_x | x coordinate of end point.
  [out] | end_y | y 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] | b | The 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] | b | The floating point bezier.
  [in] | len | The 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] | b | The floating point bezier.
  [in] | t | The floating point position between 0.0 and 1.0.
  [out] | px | The corresponding point's X coordinate.
  [out] | py | The 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] | b | The floating point bezier.
  [out] | t | The 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] | b | The floating point bezier.
  [in] | len | The length along the bezier to make the split.
  [out] | left | The resultant split's left portion of the bezier.
  [out] | right | The 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] | b | The floating point bezier.
  [out] | x | The X coordinate of the bounding box.
  [out] | y | The Y coordinate of the bounding box.
  [out] | w | The width of the bounding box.
  [out] | h | The 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] | b | The floating point bezier.
  [in] | t0 | The start of the interval.
  [in] | t1 | The end of the interval.
  [out] | result | The resulting bezier.

No check is done on `b`.

Since
  1.17

References EINA_DBL_EQ.