41 #include "glimports.h"
42 #include "nurbsconsts.h"
44 #include "trimvertex.h"
45 #include "simplemath.h"
53 #define ELIMINATE_REDUNDANT_POINTS
55 #ifdef ELIMINATE_REDUNDANT_POINTS
56 #define equal(x,y) ( glu_abs(x-y) <= 0.00001)
59 #ifdef ELIMINATE_REDUNDANT_POINTS
60 O_pwlcurve::O_pwlcurve(
long _type,
long count, INREAL *array,
long byte_stride,
TrimVertex *trimpts )
76 for(i=0; i<count; i++) {
80 if(equal(prev->param[0], array[0]) && equal(prev->param[1], array[1]))
88 v->param[0] = (REAL) array[0];
89 v->param[1] = (REAL) array[1];
94 array = (INREAL *) (((
char *) array) + byte_stride);
101 for(
TrimVertex *lastv = v + count; v != lastv; v++ ) {
102 v->param[0] = (REAL) array[0] / (REAL) array[2];
103 v->param[1] = (REAL) array[1] / (REAL) array[2];
104 array = (INREAL *) (((
char *) array) + byte_stride);
111 O_pwlcurve::O_pwlcurve(
long _type,
long count, INREAL *array,
long byte_stride,
TrimVertex *trimpts )
123 for(
TrimVertex *lastv = v + count; v != lastv; v++ ) {
124 v->param[0] = (REAL) array[0];
125 v->param[1] = (REAL) array[1];
126 array = (INREAL *) (((
char *) array) + byte_stride);
132 for(
TrimVertex *lastv = v + count; v != lastv; v++ ) {
133 v->param[0] = (REAL) array[0] / (REAL) array[2];
134 v->param[1] = (REAL) array[1] / (REAL) array[2];
135 array = (INREAL *) (((
char *) array) + byte_stride);