Lines Matching refs:degree
33 #define DEGREE 3 /* Cubic Bezier curve */
34 #define W_DEGREE 5 /* Degree of eqn to find roots of */
74 Point2 *w; /* Ctl pts for 5th-degree eqn */
79 /* Convert problem to 5th-degree Bezier form */
82 /* Find all possible roots of 5th-degree equation */
100 p = Bezier(V, DEGREE, t_candidate[i],
110 new_dist = V2SquaredLength(V2Sub(&P, &V[DEGREE], &v));
119 return (Bezier(V, DEGREE, t, (Point2 *)NULL, (Point2 *)NULL));
125 * Given a point and a Bezier curve, generate a 5th-degree
135 Vector2 c[DEGREE+1]; /* V(i)'s - P */
136 Vector2 d[DEGREE]; /* V(i+1) - V(i) */
137 Point2 *w; /* Ctl pts of 5th-degree curve */
148 for (i = 0; i <= DEGREE; i++) {
153 for (i = 0; i <= DEGREE - 1; i++) {
159 for (row = 0; row <= DEGREE - 1; row++) {
160 for (column = 0; column <= DEGREE; column++) {
173 n = DEGREE;
174 m = DEGREE-1;
190 * Given a 5th-degree equation in Bernstein-Bezier form, find
194 static int FindRoots(w, degree, t, depth)
196 int degree; /* The degree of the polynomial */
208 switch (CrossingCount(w, degree)) {
219 if (ControlPolygonFlatEnough(w, degree)) {
220 t[0] = ComputeXIntercept(w, degree);
229 Bezier(w, degree, 0.5, Left, Right);
230 left_count = FindRoots(Left, degree, left_t, depth+1);
231 right_count = FindRoots(Right, degree, right_t, depth+1);
253 static int CrossingCount(V, degree)
255 int degree; /* Degreee of Bezier curve */
262 for (i = 1; i <= degree; i++) {
278 static int ControlPolygonFlatEnough(V, degree)
280 int degree; /* Degree of polynomial */
296 /* line connecting V[0] and V[degree] */
297 distance = (double *)malloc((unsigned)(degree + 1) * sizeof(double));
303 a = V[0].y - V[degree].y;
304 b = V[degree].x - V[0].x;
305 c = V[0].x * V[degree].y - V[degree].x * V[0].y;
309 for (i = 1; i < degree; i++) {
325 for (i = 1; i < degree; i++) {
389 static double ComputeXIntercept(V, degree)
391 int degree; /* Degree of curve */
400 XNM = V[degree].x - V[0].x;
401 YNM = V[degree].y - V[0].y;
425 static Point2 Bezier(V, degree, t, Left, Right)
426 int degree; /* Degree of bezier curve */
437 for (j =0; j <= degree; j++) {
442 for (i = 1; i <= degree; i++) {
443 for (j =0 ; j <= degree - i; j++) {
452 for (j = 0; j <= degree; j++) {
457 for (j = 0; j <= degree; j++) {
458 Right[j] = Vtemp[degree-j][j];
462 return (Vtemp[degree][0]);