ReactOS 0.4.15-dev-8116-gf69e256
Trimline Class Reference

#include <trimline.h>

Collaboration diagram for Trimline:

Public Member Functions

 Trimline ()
 
 ~Trimline ()
 
void init (TrimVertex *)
 
void init (long, Arc_ptr, long)
 
void getNextPt (void)
 
void getPrevPt (void)
 
void getNextPts (REAL, Backend &)
 
void getPrevPts (REAL, Backend &)
 
void getNextPts (Arc_ptr)
 
void getPrevPts (Arc_ptr)
 
TrimVertexnext (void)
 
TrimVertexprev (void)
 
TrimVertexfirst (void)
 
TrimVertexlast (void)
 

Private Member Functions

void reset (void)
 
void grow (long)
 
void swap (void)
 
void append (TrimVertex *)
 

Static Private Member Functions

static long interpvert (TrimVertex *, TrimVertex *, TrimVertex *, REAL)
 

Private Attributes

TrimVertex ** pts
 
long numverts
 
long i
 
long size
 
Jarcloc jarcl
 
TrimVertex t
 
TrimVertex b
 
TrimVertextinterp
 
TrimVertexbinterp
 

Detailed Description

Definition at line 46 of file trimline.h.

Constructor & Destructor Documentation

◆ Trimline()

Trimline::Trimline ( )

Definition at line 46 of file trimline.cc.

47{
48 size = 0; pts = 0; numverts = 0;
49 tinterp = &t; binterp = &b;
50}
TrimVertex b
Definition: trimline.h:53
TrimVertex * binterp
Definition: trimline.h:54
TrimVertex t
Definition: trimline.h:53
TrimVertex * tinterp
Definition: trimline.h:54
TrimVertex ** pts
Definition: trimline.h:48
long numverts
Definition: trimline.h:49
GLsizeiptr size
Definition: glext.h:5919

◆ ~Trimline()

Trimline::~Trimline ( )

Definition at line 52 of file trimline.cc.

53{
54 if( pts ) delete[] pts;
55}

Member Function Documentation

◆ append()

void Trimline::append ( TrimVertex v)
inlineprivate

Definition at line 76 of file trimline.cc.

77{
78 assert( numverts != size );
79 pts[numverts++] = v;
80}
#define assert(x)
Definition: debug.h:53
const GLdouble * v
Definition: gl.h:2040

Referenced by getNextPts(), getPrevPts(), and init().

◆ first()

TrimVertex * Trimline::first ( void  )
inline

Definition at line 93 of file trimline.h.

94{
95 i = 0; return pts[i];
96}
long i
Definition: trimline.h:50

Referenced by Hull::init().

◆ getNextPt()

void Trimline::getNextPt ( void  )

Definition at line 98 of file trimline.cc.

99{
100 *binterp = *jarcl.getnextpt();
101}
TrimVertex * getnextpt(void)
Definition: jarcloc.h:63
Jarcloc jarcl
Definition: trimline.h:52

◆ getNextPts() [1/2]

void Trimline::getNextPts ( Arc_ptr  botarc)

Definition at line 159 of file trimline.cc.

160{
161 reset(); swap(); append( tinterp );
162
163#ifndef NDEBUG
164 PwlArc *lastpwl = botarc->prev->pwlArc;
165 TrimVertex *lastpt1 = &lastpwl->pts[lastpwl->npts-1];
166#endif
167 TrimVertex *lastpt2 = botarc->pwlArc->pts;
169 for( append( p ); p != lastpt2; append( p ) ) {
170 assert( p != lastpt1 );
171 p = jarcl.getnextpt();
172 }
173}
Definition: pwlarc.h:44
int npts
Definition: pwlarc.h:47
TrimVertex * pts
Definition: pwlarc.h:46
void append(TrimVertex *)
Definition: trimline.cc:76
void reset(void)
Definition: trimline.h:55
void swap(void)
Definition: trimline.cc:90
GLfloat GLfloat p
Definition: glext.h:8902

◆ getNextPts() [2/2]

void Trimline::getNextPts ( REAL  vval,
Backend backend 
)

Definition at line 115 of file trimline.cc.

116{
117 reset(); swap(); append( tinterp );
118 assert( tinterp->param[1] >= vval );
119
120 TrimVertex *p;
121 for( p=jarcl.getnextpt() ; p->param[1] >= vval; p=jarcl.getnextpt() ) {
122 append( p );
123 }
124
125 /* compute and copy pointer to final point on left hull */
126 if( interpvert( last(), p, binterp, vval ) ) {
127 binterp->nuid = p->nuid;
128 backend.triangle( p, binterp, last() );
129 append( binterp );
130 }
131 jarcl.reverse();
132 (void) jarcl.getprevpt(); /* reset jarcl to proper position */
133 jarcl.reverse();
134}
void triangle(TrimVertex *, TrimVertex *, TrimVertex *)
Definition: backend.cc:517
void reverse()
Definition: jarcloc.h:54
TrimVertex * getprevpt(void)
Definition: jarcloc.h:76
REAL param[2]
Definition: trimvertex.h:45
long nuid
Definition: trimvertex.h:50
static long interpvert(TrimVertex *, TrimVertex *, TrimVertex *, REAL)
Definition: trimline.cc:195
TrimVertex * last(void)
Definition: trimline.h:99

◆ getPrevPt()

void Trimline::getPrevPt ( void  )

Definition at line 104 of file trimline.cc.

105{
106 *binterp = *jarcl.getprevpt();
107}

◆ getPrevPts() [1/2]

void Trimline::getPrevPts ( Arc_ptr  botarc)

Definition at line 176 of file trimline.cc.

177{
178 reset(); swap(); append( tinterp );
179
180 PwlArc *lastpwl = botarc->prev->pwlArc;
181 TrimVertex *lastpt1 = &lastpwl->pts[lastpwl->npts-1];
182#ifndef NDEBUG
183 TrimVertex *lastpt2 = botarc->pwlArc->pts;
184#endif
185
187 for( append( q ); q != lastpt1; append( q ) ) {
188 assert( q != lastpt2 );
189 q = jarcl.getprevpt();
190 }
191}
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063

◆ getPrevPts() [2/2]

void Trimline::getPrevPts ( REAL  vval,
Backend backend 
)

Definition at line 137 of file trimline.cc.

138{
139 reset(); swap(); append( tinterp );
140 assert( tinterp->param[1] >= vval );
141
142 TrimVertex *q;
143 for( q=jarcl.getprevpt(); q->param[1] >= vval; q=jarcl.getprevpt() ) {
144 append( q );
145 }
146
147 /* compute and copy pointer to final point on right hull */
148 if( interpvert( q, last(), binterp, vval ) ) {
149 binterp->nuid = q->nuid;
150 backend.triangle( last(), binterp, q );
151 append( binterp );
152 }
153 jarcl.reverse();
154 (void) jarcl.getnextpt(); /* reset jarcl to proper position */
155 jarcl.reverse();
156}

◆ grow()

void Trimline::grow ( long  npts)
inlineprivate

Definition at line 66 of file trimline.cc.

67{
68 if( size < npts ) {
69 size = 2 * npts;
70 if( pts ) delete[] pts;
71 pts = new TrimVertex_p[size];
72 }
73}
long size
Definition: trimline.h:51
class TrimVertex * TrimVertex_p
Definition: trimvertex.h:53

Referenced by init().

◆ init() [1/2]

void Trimline::init ( long  npts,
Arc_ptr  jarc,
long  last 
)

Definition at line 83 of file trimline.cc.

84{
85 jarcl.init( jarc, 0, last );
86 grow( npts + 2 );
87}
void init(Arc_ptr a, long first, long last)
Definition: jarcloc.h:47
void grow(long)
Definition: trimline.cc:66

◆ init() [2/2]

void Trimline::init ( TrimVertex v)

Definition at line 58 of file trimline.cc.

59{
60 reset();
61 grow(1);
62 append(v);
63}

Referenced by Hull::init().

◆ interpvert()

long Trimline::interpvert ( TrimVertex a,
TrimVertex b,
TrimVertex c,
REAL  vval 
)
staticprivate

Definition at line 195 of file trimline.cc.

196{
197 REAL denom = a->param[1] - b->param[1];
198
199 if(denom != 0) {
200 if( vval == a->param[1] ) {
201 c->param[0] = a->param[0];
202 c->param[1] = a->param[1];
203 c->nuid = a->nuid;
204 return 0;
205 } else if( vval == b->param[1] ) {
206 c->param[0] = b->param[0];
207 c->param[1] = b->param[1];
208 c->nuid = b->nuid;
209 return 0;
210 } else {
211 REAL r = (a->param[1] - vval)/denom;
212 c->param[0] = a->param[0] - r * (a->param[0] - b->param[0]);
213 c->param[1] = vval;
214 return 1;
215 }
216 } else {
217 c->param[0] = a->param[0];
218 c->param[1] = a->param[1];
219 c->nuid = a->nuid;
220 return 0;
221 }
222}
float REAL
Definition: types.h:41
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
const GLubyte * c
Definition: glext.h:8905
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by getNextPts(), and getPrevPts().

◆ last()

TrimVertex * Trimline::last ( void  )
inline

Definition at line 99 of file trimline.h.

100{
101 i = numverts; return pts[--i];
102}

Referenced by getNextPts(), getPrevPts(), init(), and Hull::init().

◆ next()

TrimVertex * Trimline::next ( void  )
inline

Definition at line 81 of file trimline.h.

82{
83 if( i < numverts) return pts[i++]; else return 0;
84}

Referenced by Hull::nextlower(), and Hull::nextupper().

◆ prev()

TrimVertex * Trimline::prev ( void  )
inline

Definition at line 87 of file trimline.h.

88{
89 if( i >= 0 ) return pts[i--]; else return 0;
90}

Referenced by Hull::nextlower(), and Hull::nextupper().

◆ reset()

void Trimline::reset ( void  )
inlineprivate

Definition at line 55 of file trimline.h.

55{ numverts = 0; }

Referenced by getNextPts(), getPrevPts(), and init().

◆ swap()

void Trimline::swap ( void  )
inlineprivate

Definition at line 90 of file trimline.cc.

91{
92 TrimVertex *tmp=tinterp;
94 binterp=tmp;
95}

Referenced by getNextPts(), and getPrevPts().

Member Data Documentation

◆ b

TrimVertex Trimline::b
private

Definition at line 53 of file trimline.h.

Referenced by Trimline().

◆ binterp

TrimVertex * Trimline::binterp
private

Definition at line 54 of file trimline.h.

Referenced by getNextPt(), getNextPts(), getPrevPt(), getPrevPts(), swap(), and Trimline().

◆ i

long Trimline::i
private

Definition at line 50 of file trimline.h.

Referenced by first(), last(), next(), and prev().

◆ jarcl

Jarcloc Trimline::jarcl
private

Definition at line 52 of file trimline.h.

Referenced by getNextPt(), getNextPts(), getPrevPt(), getPrevPts(), and init().

◆ numverts

long Trimline::numverts
private

Definition at line 49 of file trimline.h.

Referenced by append(), last(), next(), reset(), and Trimline().

◆ pts

TrimVertex** Trimline::pts
private

Definition at line 48 of file trimline.h.

Referenced by append(), first(), grow(), last(), next(), prev(), Trimline(), and ~Trimline().

◆ size

long Trimline::size
private

Definition at line 51 of file trimline.h.

Referenced by grow().

◆ t

TrimVertex Trimline::t
private

Definition at line 53 of file trimline.h.

Referenced by Trimline().

◆ tinterp

TrimVertex* Trimline::tinterp
private

Definition at line 54 of file trimline.h.

Referenced by getNextPts(), getPrevPts(), swap(), and Trimline().


The documentation for this class was generated from the following files: