Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

geomlib/bezier.h File Reference

GEOMLIB - Rational Bezier curves. More...

#include "geomlib/curve.h"
#include "geomlib/fpath.h"

Go to the source code of this file.

Data Structures

struct  geom_bezier_subdivision

Defines

#define geom_bezier_VMT   geom_curve_VMT
#define geom_bezier_INIT
#define GEOM_BEZIER_LINEAR   1
#define GEOM_BEZIER_QUADRATIC   2
#define GEOM_BEZIER_CUBIC   3
#define GEOM_BEZIER_NONRATIONAL   0x100
#define GEOM_BEZIER_BBOX_VALID   0x200
#define GEOM_BEZIER_ALENGTH_VALID   0x400
#define GEOM_BEZIER_DEGREE(b)   (*(u8 *)&GEOM_INSTANCE_FLAGS(b))
#define GEOM_BEZIER_SUBDIVISION_MAX   25
#define GEOM_BEZIER_SUBDIVIDE_BEGIN(name, bez, part, depth, left, right, max_depth, test)
 Macro implements recursive subdivision of Bezier curve.

#define GEOM_BEZIER_SUBDIVIDE_END(name)   }} name##_break:; if (0) goto name##_break; }while(0)
#define GEOM_BEZIER_SUBDIVIDE_BREAK(name)   goto name##_break;
#define GEOM_BEZIER_DIRECTION_NOBACK   0x00000100
 Flag used in geom_bezier_direction_times.

#define GEOM_BEZIER_EXTREME_MIN   0x00000001
#define GEOM_BEZIER_EXTREME_MAX   0x00000002
#define GEOM_BEZIER_EXTREME_GLOBAL   0x00000004
#define GEOM_BEZIER_EXTREME_LOCAL   0x00000000
#define GEOM_BEZIER_EXTREME_LIMITS   0x00000008
#define GEOM_BEZIER_EXTREME_ALL   (GEOM_BEZIER_EXTREME_MIN | GEOM_BEZIER_EXTREME_MAX)
#define GEOM_BEZIER_PARAM_TO_CUBIC_NONRATIONAL_BEGIN(_name, _b, _left, _right, _part)
#define GEOM_BEZIER_PARAM_TO_CUBIC_NONRATIONAL_END(_name)   } GEOM_BEZIER_SUBDIVIDE_END(_name##_sub); } \
#define GEOM_BEZIER_SHAPE_TO_CUBIC_NONRATIONAL_BEGIN(_name, _b, _left, _right, _part)   GEOM_BEZIER_PARAM_TO_CUBIC_NONRATIONAL_BEGIN(_name, _b, _left, _right, _part)
#define GEOM_BEZIER_SHAPE_TO_CUBIC_NONRATIONAL_END(_name)   GEOM_BEZIER_PARAM_TO_CUBIC_NONRATIONAL_END(_name)

Functions

 GEOM_CLASS_HEAD (bezier, curve)
void geom_bezier_create (struct geom_bezier *bezier)
 Default Bezier curve constructor.

void geom_bezier_destroy (struct geom_bezier *bezier)
 Destructor.

void geom_bezier_set_linear_nonrational (struct geom_bezier *bezier, struct geom_point *pt0, struct geom_point *pt1)
 Sets nonrational Bezier curve from two control points.

void geom_bezier_set_linear_rational (struct geom_bezier *bezier, struct geom_point_w *pt0, struct geom_point_w *pt1)
 Sets rational Bezier curve from two control points and weights.

void geom_bezier_set_quadratic_nonrational (struct geom_bezier *bezier, struct geom_point *pt0, struct geom_point *pt1, struct geom_point *pt2)
 Sets nonrational Bezier curve from three control points.

void geom_bezier_set_quadratic_rational (struct geom_bezier *bezier, struct geom_point_w *pt0, struct geom_point_w *pt1, struct geom_point_w *pt2)
 Sets rational Bezier curve from three control points.

void geom_bezier_set_cubic_nonrational (struct geom_bezier *bezier, struct geom_point *pt0, struct geom_point *pt1, struct geom_point *pt2, struct geom_point *pt3)
 Sets nonrational Bezier curve from four control points.

void geom_bezier_set_cubic_rational (struct geom_bezier *bezier, struct geom_point_w *pt0, struct geom_point_w *pt1, struct geom_point_w *pt2, struct geom_point_w *pt3)
 Sets rational Bezier curve from four control points.

void geom_bezier_set_rational (struct geom_bezier *bezier)
void geom_bezier_set_nonrational (struct geom_bezier *bezier)
int geom_bezier_valid (struct geom_bezier *bezier)
void geom_bezier_subdump (struct geom_bezier *bezier, uns flags)
void geom_bezier_after_change (struct geom_bezier *bezier)
void geom_bezier_copy (struct geom_bezier *bezier, struct geom_bezier *src)
real geom_bezier_alength (struct geom_bezier *bezier)
real geom_bezier_time_to_atime (struct geom_bezier *bezier, real time)
int geom_bezier_times_to_atimes (struct geom_bezier *bezier, uns count, real *times, real *atimes)
real geom_bezier_atime_to_time (struct geom_bezier *bezier, real atime)
int geom_bezier_atimes_to_times (struct geom_bezier *bezier, uns count, real *atimes, real *times)
int geom_bezier_expansion_append (struct geom_bezier *bezier, struct geom_fpath *expansion)
int geom_bezier_to_bezier (struct geom_bezier *bezier, struct geom_bezier *result)
int geom_bezier_conversion_append (struct geom_bezier *bezier, uns flags, struct geom_fpath *result)
int geom_bezier_transform (struct geom_bezier *bezier, struct geom_transform *transform, struct geom_bezier *result)
int geom_bezier_point_start (struct geom_bezier *bezier, struct geom_point *result)
int geom_bezier_point_end (struct geom_bezier *bezier, struct geom_point *result)
int geom_bezier_point_at_time (struct geom_bezier *bezier, real time, struct geom_point *result)
int geom_bezier_derivation_start (struct geom_bezier *bezier, struct geom_vector *result)
int geom_bezier_derivation_end (struct geom_bezier *bezier, struct geom_vector *result)
int geom_bezier_derivation_at_time (struct geom_bezier *bezier, real time, struct geom_vector *result)
int geom_bezier_bbox (struct geom_bezier *bezier, struct geom_rectangle *bbox)
int geom_bezier_nearest_to_point (struct geom_bezier *bezier, struct geom_point *point, uns flags, struct geom_nearest *nearest)
int geom_bezier_distance_times (struct geom_bezier *bezier, struct geom_point *point, real dist, struct garr *result)
int geom_bezier_split_middle (struct geom_bezier *b, struct geom_bezier *left, struct geom_bezier *right)
void geom_bezier_subdivision_init (struct geom_bezier_subdivision *s, struct geom_bezier *b)
void geom_bezier_subdivision_destroy (struct geom_bezier_subdivision *s)
geom_beziergeom_bezier_subdivision_next (struct geom_bezier_subdivision *s)
void geom_bezier_subdivision_split (struct geom_bezier_subdivision *s)
real geom_bezier_nonrational_error (struct geom_bezier *bezier)
int geom_beziers_intersections (struct geom_bezier *bezier1, struct geom_bezier *bezier2, uns flags, struct garr *result)
 Finds intersections of two given Bezier curves.

void geom_bezier_fill_linear_nonrational (struct geom_bezier *bezier, real x0, real y0, real x1, real y1)
int geom_bezier_direction_times (struct geom_bezier *b, struct geom_point *v, uns flags, real result[])
 Function finds parameters, where the curve is parallel to a given vector. If the whole curve is parallel to v or v is zero vector, no values are returned. Otherwise, there are at most 1, 3, 2 or 5 solutions for quadratic nonrational, quadratic rational, cubic nonrational or cubic rational curves respectively. We can also set flag GEOM_SOLVE_LEFT_ONLY (return only left most solution, if any) and/or GEOM_BEZIER_DIRECTION_NOBACK (skip solutions with negative derivation in the vector direction).

int geom_bezier_split_at (struct geom_bezier *b, real t, struct geom_bezier *left, struct geom_bezier *right)
 Function splits a bezier curve at given parameter t and returns its two parts. Parameters outside the range <0, 1> are aligned to this interval.

int geom_bezier_reverse (struct geom_bezier *b, struct geom_bezier *result)
 Function returns the same bezier curve, but with reversed parametrization.

int geom_bezier_part (struct geom_bezier *b, double t, double s, struct geom_bezier *result)
 Function returns part of bezier curve given by an interval <t, s>. If t > s, parametrization of resulting path is reversed. Parameters outside the range <0, 1> are aligned to this interval.

int geom_bezier_elevate (struct geom_bezier *b, uns degree, struct geom_bezier *result)
 Function increases bezier curve degree to degree. Resulting curve has the same parametrization as the original.

int geom_bezier_control_box (struct geom_bezier *b, struct geom_rectangle *bbox)
 Function returns bounding box of given bezier curve control points. Usually, this region is larger than the exact curve bounding box, but is easier to compute.

double geom_bezier_time_of (struct geom_bezier *b, struct geom_point *p)
 Function returns parameter of a given point very close to curve.

int geom_bezier_intersection_times (struct geom_bezier *b1, struct geom_bezier *b2, uns flags, double result1[], double result2[])
 Function returns sorted list of parameters, where has the curve given y coordinate. If the whole curve is parallel to x axis, no intersections are returned, otherwise, there are at most curve degree intersections. We can also set flags GEOM_SOLVE_LEFT_ONLY (only left most parameter returned, if any) or GEOM_SOLVE_MULTIPLICITY (higher degree intersections are returned as more equal values).

int geom_bezier_center_extreme_times (struct geom_bezier *b, struct geom_point *p, uns flags, double result[])
 Function finds extreme points on bezier curve. Used metric is distance from given center point. It is possible to find global (flag GEOM_BEZIER_EXTREME_GLOBAL) or all local extremes (GEOM_BEZIER_EXTREME_LOCAL). With GEOM_BEZIER_EXTREME_MIN set, result contains global/local minimum(s), with GEOM_BEZIER_EXTREME_MAX maximum(s) and with GEOM_BEZIER_EXTREME_ALL both minimum(s) and maximum(s).

int geom_bezier_center_extreme_points (struct geom_bezier *b, struct geom_point *p, uns flags, struct geom_point result[])
 Function finds extreme points on bezier curve. Used metric is distance from given center point. It is possible to find global (flag GEOM_BEZIER_EXTREME_GLOBAL) or all local extremes (GEOM_BEZIER_EXTREME_LOCAL). With GEOM_BEZIER_EXTREME_MIN set, result contains global/local minimum(s), with GEOM_BEZIER_EXTREME_MAX maximum(s) and with GEOM_BEZIER_EXTREME_ALL both minimum(s) and maximum(s).

int geom_bezier_direction_extreme_times (const struct geom_bezier *b, const struct geom_point *v, uns flags, double result[])
 Function finds extreme points on bezier curve. Used metric is distance in given direction vector. It is possible to find global (flag GEOM_BEZIER_EXTREME_GLOBAL) or all local extremes (GEOM_BEZIER_EXTREME_LOCAL). With GEOM_BEZIER_EXTREME_MIN set, result contains global/local minimum(s), with GEOM_BEZIER_EXTREME_MAX maximum(s) and with GEOM_BEZIER_EXTREME_ALL both minimum(s) and maximum(s).

int geom_bezier_direction_extreme_points (struct geom_bezier *b, const struct geom_point *v, uns flags, struct geom_point result[])
 Function finds extreme points on bezier curve. Used metric is distance in given direction vector. It is possible to find global (flag GEOM_BEZIER_EXTREME_GLOBAL) or all local extremes (GEOM_BEZIER_EXTREME_LOCAL). With GEOM_BEZIER_EXTREME_MIN set, result contains global/local minimum(s), with GEOM_BEZIER_EXTREME_MAX maximum(s) and with GEOM_BEZIER_EXTREME_ALL both minimum(s) and maximum(s).

int geom_bezier_approximate (struct geom_bezier *b, double delta, double **buffer, int *buffer_size, int *points)
 Function returns approximation of bezier curve as a sequence of points (returned in buffer as x, y pairs) with error limited by delta.

int geom_bezier_cubic_nonrational_enough (struct geom_bezier *b)
int geom_bezier_to_cubic_nonrational (struct geom_bezier *b)


Detailed Description

GEOMLIB - Rational Bezier curves.

Copyright (c) 2004-2005 The VRR Team <vrr@ucw.cz> This program is distributed under GNU General Public License, see COPYING.


Define Documentation

#define GEOM_BEZIER_PARAM_TO_CUBIC_NONRATIONAL_BEGIN _name,
_b,
_left,
_right,
_part   ) 
 

Value:

{ struct geom_bezier _name##_cub; \
                geom_bezier_elevate((_b), GEOM_BEZIER_CUBIC, &_name##_cub); \
                GEOM_BEZIER_SUBDIVIDE_BEGIN(_name##_sub, &_name##_cub, _part, _name##_deep, _left, _right, 4, \
                        geom_bezier_cubic_nonrational_enough(_part)) { \
                        _part->pt[0].w = _part->pt[1].w = _part->pt[2].w = _part->pt[3].w = 1; \
                        _part->flags |= GEOM_BEZIER_NONRATIONAL;

#define GEOM_BEZIER_SUBDIVIDE_BEGIN name,
bez,
part,
depth,
left,
right,
max_depth,
test   ) 
 

Value:

do{ struct geom_bezier *part, name##_s[(max_depth) + 2]; \
                uns depth, name##_t, name##_d[(max_depth) + 2]; \
                real left, right, name##_l[(max_depth) + 2]; \
                GEOM_ITEM_ASSERT(bezier, bez); \
                GEOM_INSTANCE_CREATE2(&name##_s[1], bezier, geom_bezier_copy, bez); \
                name##_t = 1; \
                name##_d[1] = 0; name##_l[1] = 0; name##_l[0] = 1; \
                while (name##_t) { \
                        depth = name##_d[name##_t]; \
                        part = &name##_s[name##_t]; \
                        left = name##_l[name##_t]; \
                        right = name##_l[name##_t - 1]; \
                        if (depth < max_depth && !(test)) { \
                                GEOM_INSTANCE_INIT(&name##_s[name##_t + 1], bezier); \
                                geom_bezier_split_middle(&name##_s[name##_t], \
                                        &name##_s[name##_t + 1], &name##_s[name##_t]); \
                                name##_d[name##_t + 1] = ++name##_d[name##_t]; \
                                if (!isfinite(name##_l[name##_t] = 0.5 * (name##_l[name##_t - 1] + \
                                        (name##_l[name##_t + 1] = name##_l[name##_t])))) \
                                        name##_l[name##_t] = name##_l[name##_t - 1]; \
                                name##_t++; } \
                        else { GEOM_INSTANCE_DESTROY2(&name##_s[name##_t], bezier); \
                                name##_t--; \
Macro implements recursive subdivision of Bezier curve.

Given condition statement is evaluated in each node of subdivision tree to decide whether subdivide or not. Main code is executed only for leaf nodes. Description of current node is stored in varriables depth, left, right and part.

Usage:

 struct geom_bezier *bezier = ???;

 GEOM_BEZIER_SUBDIVIDE_BEGIN(walk1, bezier, part, depth, left, right, 3, 1) {

        msg("Depth of subdivision = %d, current interval = (%f, %f)\n", depth, left, right);
        geom_bezier_dump(part);

 } GEOM_BEZIER_SUBDIVIDE_END(walk1);

Parameters:
name Unique prefix in current function (used to generate internal identifiers).
bezier Pointer to bezier curve to subdivide.
part Current bezier subinterval.
depth Current subdivision depth (0 for entire curve).
left Current left TIME subinterval limit.
right Current right TIME subinterval limit.
max_depth Maximum subdivision depth (unsigned int).
test Condition - nonzero value cause subdivision of current curve.


Function Documentation

int geom_bezier_approximate struct geom_bezier b,
double  delta,
double **  buffer,
int *  buffer_size,
int *  points
 

Function returns approximation of bezier curve as a sequence of points (returned in buffer as x, y pairs) with error limited by delta.

Parameters:
b pointer to the curve
delta maximal error
buffer result buffer, if *NULL, buffer is newly allocated
buffer_size buffer size (in doubles), if NULL, buffer is newly allocated and size not returned
points number of computed points
Return values:
0 success
-1 error occured

int geom_bezier_center_extreme_points struct geom_bezier b,
struct geom_point p,
uns  flags,
struct geom_point  result[]
 

Function finds extreme points on bezier curve. Used metric is distance from given center point. It is possible to find global (flag GEOM_BEZIER_EXTREME_GLOBAL) or all local extremes (GEOM_BEZIER_EXTREME_LOCAL). With GEOM_BEZIER_EXTREME_MIN set, result contains global/local minimum(s), with GEOM_BEZIER_EXTREME_MAX maximum(s) and with GEOM_BEZIER_EXTREME_ALL both minimum(s) and maximum(s).

Parameters:
b pointer to the bezier curve
p pointer to center point
flags special flags (see function brief description)
result buffer for resulting points
Returns:
number of found extreme points (-1 for numeric overflow)

int geom_bezier_center_extreme_times struct geom_bezier b,
struct geom_point p,
uns  flags,
double  result[]
 

Function finds extreme points on bezier curve. Used metric is distance from given center point. It is possible to find global (flag GEOM_BEZIER_EXTREME_GLOBAL) or all local extremes (GEOM_BEZIER_EXTREME_LOCAL). With GEOM_BEZIER_EXTREME_MIN set, result contains global/local minimum(s), with GEOM_BEZIER_EXTREME_MAX maximum(s) and with GEOM_BEZIER_EXTREME_ALL both minimum(s) and maximum(s).

Parameters:
b pointer to the bezier curve
p pointer to center point
flags special flags (see function brief description)
result buffer for resulting parameters
Returns:
number of found extreme points (-1 for numeric overflow)

int geom_bezier_control_box struct geom_bezier b,
struct geom_rectangle bbox
 

Function returns bounding box of given bezier curve control points. Usually, this region is larger than the exact curve bounding box, but is easier to compute.

Parameters:
b pointer to the bezier curve
bbox buffer for bounding box
Returns:
0 always

void geom_bezier_create struct geom_bezier bezier  )  [inline, static]
 

Default Bezier curve constructor.

Resulting structure is invalid curve and must be set by geom_bezier_set_x or destroyed.

int geom_bezier_direction_extreme_points struct geom_bezier b,
const struct geom_point v,
uns  flags,
struct geom_point  result[]
 

Function finds extreme points on bezier curve. Used metric is distance in given direction vector. It is possible to find global (flag GEOM_BEZIER_EXTREME_GLOBAL) or all local extremes (GEOM_BEZIER_EXTREME_LOCAL). With GEOM_BEZIER_EXTREME_MIN set, result contains global/local minimum(s), with GEOM_BEZIER_EXTREME_MAX maximum(s) and with GEOM_BEZIER_EXTREME_ALL both minimum(s) and maximum(s).

Parameters:
b pointer to the bezier curve
v pointer to direction vector
flags special flags (see function brief description)
result buffer for resulting points
Returns:
number of found extreme points (-1 for numeric overflow)

int geom_bezier_direction_extreme_times const struct geom_bezier b,
const struct geom_point v,
uns  flags,
double  result[]
 

Function finds extreme points on bezier curve. Used metric is distance in given direction vector. It is possible to find global (flag GEOM_BEZIER_EXTREME_GLOBAL) or all local extremes (GEOM_BEZIER_EXTREME_LOCAL). With GEOM_BEZIER_EXTREME_MIN set, result contains global/local minimum(s), with GEOM_BEZIER_EXTREME_MAX maximum(s) and with GEOM_BEZIER_EXTREME_ALL both minimum(s) and maximum(s).

Parameters:
b pointer to the bezier curve
v pointer to direction vector
flags special flags (see function brief description)
result buffer for resulting parameters
Returns:
number of found extreme points (-1 for numeric overflow)

int geom_bezier_direction_times struct geom_bezier b,
struct geom_point v,
uns  flags,
real  result[]
 

Function finds parameters, where the curve is parallel to a given vector. If the whole curve is parallel to v or v is zero vector, no values are returned. Otherwise, there are at most 1, 3, 2 or 5 solutions for quadratic nonrational, quadratic rational, cubic nonrational or cubic rational curves respectively. We can also set flag GEOM_SOLVE_LEFT_ONLY (return only left most solution, if any) and/or GEOM_BEZIER_DIRECTION_NOBACK (skip solutions with negative derivation in the vector direction).

Parameters:
b pointer to the bezier curve
v pointer to the vector
flags OR combination of GEOM_SOLVE_LEFT_ONLY and GEOM_BEZIER_DIRECTION_NOBACK
result buffer to store result parameters (needed size in brief description, 1 with flag GEOM_SOLVE_LEFT_ONLY)
Returns:
0 always

int geom_bezier_elevate struct geom_bezier b,
uns  degree,
struct geom_bezier result
 

Function increases bezier curve degree to degree. Resulting curve has the same parametrization as the original.

Parameters:
b pointer to the bezier curve
degree wanted degree, b->degree <= degree <= GEOM_BEZIER_CUBIC
result buffer for the resulting curve
Returns:
0 always

int geom_bezier_intersection_times struct geom_bezier b1,
struct geom_bezier b2,
uns  flags,
double  result1[],
double  result2[]
 

Function returns sorted list of parameters, where has the curve given y coordinate. If the whole curve is parallel to x axis, no intersections are returned, otherwise, there are at most curve degree intersections. We can also set flags GEOM_SOLVE_LEFT_ONLY (only left most parameter returned, if any) or GEOM_SOLVE_MULTIPLICITY (higher degree intersections are returned as more equal values).

Parameters:
b pointer to the bezier curve
y y coordinate
flags OR combination of GEOM_SOLVE_LEFT_ONLY and GEOM_SOLVE_MULTIPLICITY
result buffer to store result parameters (of curve degree size or 1 with flag GEOM_SOLVE_LEFT_ONLY)
Returns:
number of intersections found (-1 for numeric overflow)

int geom_bezier_part struct geom_bezier b,
double  t,
double  s,
struct geom_bezier result
 

Function returns part of bezier curve given by an interval <t, s>. If t > s, parametrization of resulting path is reversed. Parameters outside the range <0, 1> are aligned to this interval.

Parameters:
b pointer to the bezier curve
t curve parameter
s curve parameter
result buffer for the result curve (subinterval <t, s> of original curve)
Returns:
0 always

int geom_bezier_reverse struct geom_bezier b,
struct geom_bezier result
 

Function returns the same bezier curve, but with reversed parametrization.

Parameters:
b pointer to the bezier curve
result buffer for the reversed curve
Returns:
0 always

void geom_bezier_set_cubic_nonrational struct geom_bezier bezier,
struct geom_point pt0,
struct geom_point pt1,
struct geom_point pt2,
struct geom_point pt3
[inline, static]
 

Sets nonrational Bezier curve from four control points.

Can be used as constructor.

Parameters:
bezier Bezier instance.
pt0 First control point.
pt1 Second control point.
pt2 Third control point.
pt3 Fouth control point.

void geom_bezier_set_cubic_rational struct geom_bezier bezier,
struct geom_point_w pt0,
struct geom_point_w pt1,
struct geom_point_w pt2,
struct geom_point_w pt3
[inline, static]
 

Sets rational Bezier curve from four control points.

Can be used as constructor.

Parameters:
bezier Bezier instance.
pt0 First control point.
pt1 Second control point.
pt2 Third control point.
pt3 Fouth control point.

void geom_bezier_set_linear_nonrational struct geom_bezier bezier,
struct geom_point pt0,
struct geom_point pt1
[inline, static]
 

Sets nonrational Bezier curve from two control points.

Can be used as constructor.

Parameters:
bezier Bezier instance.
pt0 First control point.
pt1 Second control point.

void geom_bezier_set_linear_rational struct geom_bezier bezier,
struct geom_point_w pt0,
struct geom_point_w pt1
[inline, static]
 

Sets rational Bezier curve from two control points and weights.

Can be used as constructor.

Parameters:
bezier Bezier instance.
pt0 First control point.
pt1 Second control point.

void geom_bezier_set_quadratic_nonrational struct geom_bezier bezier,
struct geom_point pt0,
struct geom_point pt1,
struct geom_point pt2
[inline, static]
 

Sets nonrational Bezier curve from three control points.

Can be used as constructor.

Parameters:
bezier Bezier instance.
pt0 First control point.
pt1 Second control point.
pt2 Third control point.

void geom_bezier_set_quadratic_rational struct geom_bezier bezier,
struct geom_point_w pt0,
struct geom_point_w pt1,
struct geom_point_w pt2
[inline, static]
 

Sets rational Bezier curve from three control points.

Can be used as constructor.

Parameters:
bezier Bezier instance.
pt0 First control point.
pt1 Second control point.
pt2 Third control point.

int geom_bezier_split_at struct geom_bezier b,
real  t,
struct geom_bezier left,
struct geom_bezier right
 

Function splits a bezier curve at given parameter t and returns its two parts. Parameters outside the range <0, 1> are aligned to this interval.

Parameters:
b pointer to the bezier curve
t curve parameter
left buffer for the left curve part (interval <0, t>)
right buffer for the right curve part (interval <t, 1>)
Returns:
0 always

double geom_bezier_time_of struct geom_bezier b,
struct geom_point p
 

Function returns parameter of a given point very close to curve.

Parameters:
b pointer to the bezier curve
p pointer to the point
Returns:
curve parameter (NAN for numeric error)

int geom_beziers_intersections struct geom_bezier bezier1,
struct geom_bezier bezier2,
uns  flags,
struct garr *  result
 

Finds intersections of two given Bezier curves.

Intersections (geom_intersection structures) are added to current position of a growing array structure.

Parameters:
bezier1 First Bezier curve.
bezier2 Second Bezier curve.
flags Flags.
result Growing array, where to store found intersections.
Return values:
>=0 Number of found intersections.
GEOM_ERR_NUMERIC Numeric error.

Todo:
Better code.


Generated on Tue Dec 9 16:30:09 2008 for Vrr by doxygen 1.3.5