40 #include "glimports.h"
48 size = 0; pts = 0; numverts = 0;
49 tinterp = &t; binterp = &b;
54 if( pts )
delete[] pts;
66 Trimline::grow(
long npts )
70 if( pts )
delete[] pts;
71 pts =
new TrimVertex_p[size];
78 assert( numverts != size );
83 Trimline::init(
long npts, Arc_ptr jarc,
long last )
85 jarcl.init( jarc, 0, last );
100 *binterp = *jarcl.getnextpt();
104 Trimline::getPrevPt()
106 *binterp = *jarcl.getprevpt();
115 Trimline::getNextPts( REAL vval,
Backend& backend )
117 reset(); swap(); append( tinterp );
118 assert( tinterp->param[1] >= vval );
121 for( p=jarcl.getnextpt() ; p->param[1] >= vval; p=jarcl.getnextpt() ) {
126 if( interpvert( last(), p, binterp, vval ) ) {
127 binterp->nuid = p->nuid;
128 backend.triangle( p, binterp, last() );
132 (void) jarcl.getprevpt();
137 Trimline::getPrevPts( REAL vval,
Backend& backend )
139 reset(); swap(); append( tinterp );
140 assert( tinterp->param[1] >= vval );
143 for( q=jarcl.getprevpt(); q->param[1] >= vval; q=jarcl.getprevpt() ) {
148 if( interpvert( q, last(), binterp, vval ) ) {
149 binterp->nuid = q->nuid;
150 backend.triangle( last(), binterp, q );
154 (void) jarcl.getnextpt();
159 Trimline::getNextPts( Arc_ptr botarc )
161 reset(); swap(); append( tinterp );
164 PwlArc *lastpwl = botarc->prev->pwlArc;
165 TrimVertex *lastpt1 = &lastpwl->pts[lastpwl->npts-1];
169 for( append( p ); p != lastpt2; append( p ) ) {
170 assert( p != lastpt1 );
171 p = jarcl.getnextpt();
176 Trimline::getPrevPts( Arc_ptr botarc )
178 reset(); swap(); append( tinterp );
180 PwlArc *lastpwl = botarc->prev->pwlArc;
181 TrimVertex *lastpt1 = &lastpwl->pts[lastpwl->npts-1];
187 for( append( q ); q != lastpt1; append( q ) ) {
188 assert( q != lastpt2 );
189 q = jarcl.getprevpt();
197 REAL denom = a->param[1] - b->param[1];
200 if( vval == a->param[1] ) {
201 c->param[0] = a->param[0];
202 c->param[1] = a->param[1];
205 }
else if( vval == b->param[1] ) {
206 c->param[0] = b->param[0];
207 c->param[1] = b->param[1];
211 REAL r = (a->param[1] - vval)/denom;
212 c->param[0] = a->param[0] - r * (a->param[0] - b->param[0]);
217 c->param[0] = a->param[0];
218 c->param[1] = a->param[1];