25 #ifndef GVF_PARAMETRIC_2D_BEZIER_SPLINES_KX
26 #define GVF_PARAMETRIC_2D_BEZIER_SPLINES_KX 2.0
29 #ifndef GVF_PARAMETRIC_2D_BEZIER_SPLINES_KY
30 #define GVF_PARAMETRIC_2D_BEZIER_SPLINES_KY 2.0
44 bezier[k].
p0[0] = px[j];
45 bezier[k].
p0[1] = py[j];
46 bezier[k].
p1[0] = px[j + 1];
47 bezier[k].
p1[1] = py[j + 1];
48 bezier[k].
p2[0] = px[j + 2];
49 bezier[k].
p2[1] = py[j + 2];
50 bezier[k].
p3[0] = px[j + 3];
51 bezier[k].
p3[1] = py[j + 3];
63 int n_seg = floorl(t);
70 float p0x = bezier[n_seg].
p0[0];
float p0y = bezier[n_seg].
p0[1];
71 float p1x = bezier[n_seg].
p1[0];
float p1y = bezier[n_seg].
p1[1];
72 float p2x = bezier[n_seg].
p2[0];
float p2y = bezier[n_seg].
p2[1];
73 float p3x = bezier[n_seg].
p3[0];
float p3y = bezier[n_seg].
p3[1];
78 *f1 = (1 - tt) * (1 - tt) * (1 - tt) * p0x + 3 * (1 - tt) * (1 - tt) * tt * p1x + 3 *
79 (1 - tt) * tt * tt * p2x + tt * tt * tt * p3x;
80 *f2 = (1 - tt) * (1 - tt) * (1 - tt) * p0y + 3 * (1 - tt) * (1 - tt) * tt * p1y + 3 *
81 (1 - tt) * tt * tt * p2y + tt * tt * tt * p3y;
84 *f1d = 3 * (1 - tt) * (1 - tt) * (p1x - p0x) + 6 * (1 - tt) * tt * (p2x - p1x) + 3 * tt * tt * (p3x - p2x);
85 *f2d = 3 * (1 - tt) * (1 - tt) * (p1y - p0y) + 6 * (1 - tt) * tt * (p2y - p1y) + 3 * tt * tt * (p3y - p2y);
88 *f1dd = 6 * (1 - tt) * (p2x - 2 * p1x + p0x) + 6 * tt * (p3x - 2 * p2x + p1x);
89 *f2dd = 6 * (1 - tt) * (p2y - 2 * p1y + p0y) + 6 * tt * (p3y - 2 * p2y + p1y);
gvf_parametric_con gvf_parametric_control
Guiding vector field algorithm for 2D and 3D parametric trajectories.
void gvf_parametric_2d_bezier_splines_info(bezier_t *bezier, float *f1, float *f2, float *f1d, float *f2d, float *f1dd, float *f2dd)
#define GVF_PARAMETRIC_2D_BEZIER_SPLINES_KY
gvf_par_2d_bezier_par gvf_parametric_2d_bezier_par
#define GVF_PARAMETRIC_2D_BEZIER_SPLINES_KX
void create_bezier_spline(bezier_t *bezier, float *px, float *py)
#define GVF_PARAMETRIC_2D_BEZIER_N_SEG