ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

arctess.cc
Go to the documentation of this file.
00001 /*
00002 ** License Applicability. Except to the extent portions of this file are
00003 ** made subject to an alternative license as permitted in the SGI Free
00004 ** Software License B, Version 1.1 (the "License"), the contents of this
00005 ** file are subject only to the provisions of the License. You may not use
00006 ** this file except in compliance with the License. You may obtain a copy
00007 ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
00008 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
00009 **
00010 ** http://oss.sgi.com/projects/FreeB
00011 **
00012 ** Note that, as provided in the License, the Software is distributed on an
00013 ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
00014 ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
00015 ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
00016 ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
00017 **
00018 ** Original Code. The Original Code is: OpenGL Sample Implementation,
00019 ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
00020 ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
00021 ** Copyright in any portions created by third parties is as indicated
00022 ** elsewhere herein. All Rights Reserved.
00023 **
00024 ** Additional Notice Provisions: The application programming interfaces
00025 ** established by SGI in conjunction with the Original Code are The
00026 ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
00027 ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
00028 ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
00029 ** Window System(R) (Version 1.3), released October 19, 1998. This software
00030 ** was created using the OpenGL(R) version 1.2.1 Sample Implementation
00031 ** published by SGI, but has not been independently verified as being
00032 ** compliant with the OpenGL(R) version 1.2.1 Specification.
00033 */
00034 
00035 /*
00036  * arctessellator.c++
00037  *
00038  */
00039 
00040 #include "glimports.h"
00041 #include "mystdio.h"
00042 #include "myassert.h"
00043 #include "arctess.h"
00044 #include "bufpool.h"
00045 #include "simplemath.h"
00046 #include "bezierarc.h"
00047 #include "trimvertex.h"
00048 #include "trimvertpool.h"
00049 
00050 #define NOELIMINATION
00051 
00052 #define steps_function(large, small, rate) (max(1, 1+ (int) ((large-small)/rate)));
00053 
00054 /*-----------------------------------------------------------------------------
00055  * ArcTessellator - construct an ArcTessellator
00056  *-----------------------------------------------------------------------------
00057  */
00058 
00059 ArcTessellator::ArcTessellator( TrimVertexPool& t, Pool& p ) 
00060     : pwlarcpool(p), trimvertexpool(t)
00061 {
00062 }
00063 
00064 /*-----------------------------------------------------------------------------
00065  * ~ArcTessellator - destroy an ArcTessellator
00066  *-----------------------------------------------------------------------------
00067  */
00068 
00069 ArcTessellator::~ArcTessellator( void )
00070 {
00071 }
00072 
00073 /*-----------------------------------------------------------------------------
00074  * bezier - construct a bezier arc and attach it to an Arc
00075  *-----------------------------------------------------------------------------
00076  */
00077 
00078 void
00079 ArcTessellator::bezier( Arc *arc, REAL s1, REAL s2, REAL t1, REAL t2 )
00080 {
00081     assert( arc != 0 );
00082     assert( ! arc->isTessellated() );
00083 
00084 #ifndef NDEBUG
00085     switch( arc->getside() ) {
00086     case arc_left:
00087         assert( s1 == s2 );
00088         assert( t2 < t1 );
00089         break;
00090     case arc_right:
00091         assert( s1 == s2 );
00092         assert( t1 < t2 );
00093         break;
00094     case arc_top:
00095         assert( t1 == t2 );
00096         assert( s2 < s1 );
00097         break;
00098     case arc_bottom:
00099         assert( t1 == t2 );
00100         assert( s1 < s2 );
00101         break;
00102     case arc_none:
00103         (void) abort();
00104         break;
00105     }
00106 #endif
00107     
00108     TrimVertex *p = trimvertexpool.get(2);
00109     arc->pwlArc = new(pwlarcpool) PwlArc( 2, p );
00110     p[0].param[0] = s1;
00111     p[0].param[1] = t1;
00112     p[1].param[0] = s2;
00113     p[1].param[1] = t2;
00114     assert( (s1 == s2) || (t1 == t2) );
00115     arc->setbezier();
00116 }
00117 
00118 
00119 /*-----------------------------------------------------------------------------
00120  * pwl_left - construct a left boundary pwl arc and attach it to an arc
00121  *-----------------------------------------------------------------------------
00122  */
00123 
00124 void
00125 ArcTessellator::pwl_left( Arc *arc, REAL s, REAL t1, REAL t2, REAL rate )
00126 {
00127     assert( t2 < t1 );
00128 
00129 /*    if(rate <= 0.06) rate = 0.06;*/
00130 /*    int nsteps = 1 + (int) ((t1 - t2) / rate ); */
00131     int nsteps = steps_function(t1, t2, rate);
00132 
00133 
00134     REAL stepsize = (t1 - t2) / (REAL) nsteps;
00135 
00136     TrimVertex *newvert = trimvertexpool.get( nsteps+1 );
00137     int i;
00138     for( i = nsteps; i > 0; i-- ) {
00139     newvert[i].param[0] = s;
00140     newvert[i].param[1] = t2;
00141     t2 += stepsize;
00142     }
00143     newvert[i].param[0] = s;
00144     newvert[i].param[1] = t1;
00145 
00146     arc->makeSide( new(pwlarcpool) PwlArc( nsteps+1, newvert ), arc_left );
00147 }
00148 
00149 /*-----------------------------------------------------------------------------
00150  * pwl_right - construct a right boundary pwl arc and attach it to an arc
00151  *-----------------------------------------------------------------------------
00152  */
00153 
00154 void
00155 ArcTessellator::pwl_right( Arc *arc, REAL s, REAL t1, REAL t2, REAL rate )
00156 {
00157     assert( t1 < t2 );
00158 
00159 /*    if(rate <= 0.06) rate = 0.06;*/
00160 
00161 /*    int nsteps = 1 + (int) ((t2 - t1) / rate ); */
00162     int nsteps = steps_function(t2,t1,rate);
00163     REAL stepsize = (t2 - t1) / (REAL) nsteps;
00164 
00165     TrimVertex *newvert = trimvertexpool.get( nsteps+1 );
00166     int i;
00167     for( i = 0; i < nsteps; i++ ) {
00168     newvert[i].param[0] = s;
00169     newvert[i].param[1] = t1;
00170     t1 += stepsize;
00171     }
00172     newvert[i].param[0] = s;
00173     newvert[i].param[1] = t2;
00174 
00175     arc->makeSide( new(pwlarcpool) PwlArc( nsteps+1, newvert ), arc_right );
00176 }
00177 
00178 
00179 /*-----------------------------------------------------------------------------
00180  * pwl_top - construct a top boundary pwl arc and attach it to an arc
00181  *-----------------------------------------------------------------------------
00182  */
00183 
00184 void
00185 ArcTessellator::pwl_top( Arc *arc, REAL t, REAL s1, REAL s2, REAL rate )
00186 {
00187     assert( s2 < s1 );
00188 
00189 /*    if(rate <= 0.06) rate = 0.06;*/
00190 
00191 /*    int nsteps = 1 + (int) ((s1 - s2) / rate ); */
00192     int nsteps = steps_function(s1,s2,rate);
00193     REAL stepsize = (s1 - s2) / (REAL) nsteps;
00194 
00195     TrimVertex *newvert = trimvertexpool.get( nsteps+1 );
00196     int i;
00197     for( i = nsteps; i > 0; i-- ) {
00198     newvert[i].param[0] = s2;
00199     newvert[i].param[1] = t;
00200     s2 += stepsize;
00201     }
00202     newvert[i].param[0] = s1;
00203     newvert[i].param[1] = t;
00204 
00205     arc->makeSide( new(pwlarcpool) PwlArc( nsteps+1, newvert ), arc_top );
00206 }
00207 
00208 /*-----------------------------------------------------------------------------
00209  * pwl_bottom - construct a bottom boundary pwl arc and attach it to an arc
00210  *-----------------------------------------------------------------------------
00211  */
00212 
00213 void
00214 ArcTessellator::pwl_bottom( Arc *arc, REAL t, REAL s1, REAL s2, REAL rate )
00215 {
00216     assert( s1 < s2 );
00217 
00218 /*    if(rate <= 0.06) rate = 0.06;*/
00219 
00220 /*    int nsteps = 1 + (int) ((s2 - s1) / rate ); */
00221     int nsteps = steps_function(s2,s1,rate);
00222     REAL stepsize = (s2 - s1) / (REAL) nsteps;
00223 
00224     TrimVertex *newvert = trimvertexpool.get( nsteps+1 );
00225     int i;
00226     for( i = 0; i < nsteps; i++ ) {
00227     newvert[i].param[0] = s1;
00228     newvert[i].param[1] = t;
00229     s1 += stepsize;
00230     }
00231     newvert[i].param[0] = s2;
00232     newvert[i].param[1] = t;
00233 
00234     arc->makeSide( new(pwlarcpool) PwlArc( nsteps+1, newvert ), arc_bottom );
00235 }
00236 
00237 /*-----------------------------------------------------------------------------
00238  * pwl - construct a pwl arc and attach it to an arc
00239  *-----------------------------------------------------------------------------
00240  */
00241 
00242 void
00243 ArcTessellator::pwl( Arc *arc, REAL s1, REAL s2, REAL t1, REAL t2, REAL rate )
00244 {
00245 
00246 /*    if(rate <= 0.06) rate = 0.06;*/
00247 
00248     int snsteps = 1 + (int) (glu_abs(s2 - s1) / rate );
00249     int tnsteps = 1 + (int) (glu_abs(t2 - t1) / rate );
00250     int nsteps = max(1,max( snsteps, tnsteps ));
00251 
00252     REAL sstepsize = (s2 - s1) / (REAL) nsteps;
00253     REAL tstepsize = (t2 - t1) / (REAL) nsteps;
00254     TrimVertex *newvert = trimvertexpool.get( nsteps+1 );
00255     long i;
00256     for( i = 0; i < nsteps; i++ ) {
00257     newvert[i].param[0] = s1;
00258     newvert[i].param[1] = t1;
00259     s1 += sstepsize;
00260     t1 += tstepsize;
00261     }
00262     newvert[i].param[0] = s2;
00263     newvert[i].param[1] = t2;
00264 
00265     /* arc->makeSide( new(pwlarcpool) PwlArc( nsteps+1, newvert ), arc_bottom ); */
00266     arc->pwlArc = new(pwlarcpool) PwlArc( nsteps+1, newvert );
00267 
00268     arc->clearbezier();
00269     arc->clearside( );
00270 }
00271 
00272 
00273 /*-----------------------------------------------------------------------------
00274  * tessellateLinear - constuct a linear pwl arc and attach it to an Arc
00275  *-----------------------------------------------------------------------------
00276  */
00277 
00278 void
00279 ArcTessellator::tessellateLinear( Arc *arc, REAL geo_stepsize, REAL arc_stepsize, int isrational )
00280 {
00281     assert( arc->pwlArc == NULL );
00282     REAL s1, s2, t1, t2;
00283 
00284     //we don't need to scale by arc_stepsize if the trim curve
00285     //is piecewise linear. Reason: In pwl_right, pwl_left, pwl_top, pwl_left,
00286     //and pwl, the nsteps is computed by deltaU (or V) /stepsize. 
00287     //The quantity deltaU/arc_stepsize doesn't have any meaning. And
00288     //it causes problems: see bug 517641
00289     REAL stepsize = geo_stepsize; /* * arc_stepsize*/;
00290 
00291     BezierArc *b = arc->bezierArc;
00292 
00293     if( isrational ) {
00294     s1 = b->cpts[0] / b->cpts[2];
00295     t1 = b->cpts[1] / b->cpts[2];
00296     s2 = b->cpts[b->stride+0] / b->cpts[b->stride+2];
00297     t2 = b->cpts[b->stride+1] / b->cpts[b->stride+2];
00298     } else {
00299     s1 = b->cpts[0];
00300     t1 = b->cpts[1];
00301     s2 = b->cpts[b->stride+0];
00302     t2 = b->cpts[b->stride+1];
00303     }
00304     if( s1 == s2 )
00305     if( t1 < t2 )
00306         pwl_right( arc, s1, t1, t2, stepsize );
00307     else
00308         pwl_left( arc, s1, t1, t2, stepsize );
00309     else if( t1 == t2 )
00310     if( s1 < s2 ) 
00311         pwl_bottom( arc, t1, s1, s2, stepsize );
00312     else
00313         pwl_top( arc, t1, s1, s2, stepsize );
00314     else
00315     pwl( arc, s1, s2, t1, t2, stepsize );
00316 }
00317 
00318 /*-----------------------------------------------------------------------------
00319  * tessellateNonlinear - constuct a nonlinear pwl arc and attach it to an Arc
00320  *-----------------------------------------------------------------------------
00321  */
00322 
00323 void
00324 ArcTessellator::tessellateNonlinear( Arc *arc, REAL geo_stepsize, REAL arc_stepsize, int isrational )
00325 {
00326     assert( arc->pwlArc == NULL );
00327 
00328     REAL stepsize   = geo_stepsize * arc_stepsize;
00329 
00330     BezierArc *bezierArc = arc->bezierArc;
00331 
00332     REAL size; //bounding box size of the curve in UV 
00333     {
00334       int i,j;
00335       REAL min_u, min_v, max_u,max_v;
00336       min_u = max_u = bezierArc->cpts[0];
00337       min_v = max_v = bezierArc->cpts[1];
00338       for(i=1, j=2; i<bezierArc->order; i++, j+= bezierArc->stride)
00339     {
00340       if(bezierArc->cpts[j] < min_u)
00341         min_u = bezierArc->cpts[j];
00342       if(bezierArc->cpts[j] > max_u)
00343         max_u = bezierArc->cpts[j];
00344       if(bezierArc->cpts[j+1] < min_v)
00345         min_v = bezierArc->cpts[j+1];     
00346       if(bezierArc->cpts[j+1] > max_v)
00347         max_v = bezierArc->cpts[j+1]; 
00348     }
00349 
00350       size = max_u - min_u;
00351       if(size < max_v - min_v)
00352     size = max_v - min_v;
00353     }
00354       
00355     /*int   nsteps      = 1 + (int) (1.0/stepsize);*/
00356 
00357     int nsteps = (int) (size/stepsize);
00358     if(nsteps <=0)
00359       nsteps=1;
00360 
00361     TrimVertex *vert    = trimvertexpool.get( nsteps+1 );
00362     REAL dp         = 1.0/nsteps;
00363 
00364 
00365     arc->pwlArc     = new(pwlarcpool) PwlArc();
00366     arc->pwlArc->pts    = vert;
00367 
00368     if( isrational ) {
00369         REAL pow_u[MAXORDER], pow_v[MAXORDER], pow_w[MAXORDER];
00370         trim_power_coeffs( bezierArc, pow_u, 0 );
00371         trim_power_coeffs( bezierArc, pow_v, 1 );
00372         trim_power_coeffs( bezierArc, pow_w, 2 );
00373 
00374     /* compute first point exactly */
00375         REAL *b = bezierArc->cpts;
00376     vert->param[0] = b[0]/b[2];
00377     vert->param[1] = b[1]/b[2];
00378 
00379     /* strength reduction on p = dp * step would introduce error */
00380     int step;
00381         register long order =  bezierArc->order;
00382     for( step=1, ++vert; step<nsteps; step++, vert++ ) {
00383         register REAL p = dp * step;
00384             register REAL u = pow_u[0];
00385             register REAL v = pow_v[0];
00386         register REAL w = pow_w[0];
00387         for( register int i = 1; i < order; i++ ) {
00388             u = u * p + pow_u[i];
00389             v = v * p + pow_v[i];
00390             w = w * p + pow_w[i];
00391             }
00392             vert->param[0] = u/w;
00393             vert->param[1] = v/w;
00394 #ifndef NOELIMINATION
00395         REAL ds = glu_abs(vert[0].param[0] - vert[-1].param[0]);
00396         REAL dt = glu_abs(vert[0].param[1] - vert[-1].param[1]);
00397         int canremove = (ds<geo_stepsize && dt<geo_stepsize) ? 1 : 0;
00398         REAL ods=0.0, odt=0.0;
00399 
00400         if( ocanremove && canremove ) {
00401         REAL nds = ds + ods;
00402         REAL ndt = dt + odt;
00403         if( nds<geo_stepsize && ndt<geo_stepsize ) {
00404             // remove previous point
00405             --vert;
00406             vert[0].param[0] = vert[1].param[0];
00407             vert[0].param[1] = vert[1].param[1];
00408             ods = nds;
00409             odt = ndt;
00410             ocanremove = 1;
00411         } else {
00412             ocanremove = canremove;
00413             ods = ds;
00414             odt = dt;
00415         }
00416         } else {
00417         ocanremove = canremove;
00418         ods = ds;
00419         odt = dt;
00420         }
00421 #endif  
00422     }
00423 
00424     /* compute last point exactly */
00425     b += (order - 1) * bezierArc->stride;
00426     vert->param[0] = b[0]/b[2];
00427     vert->param[1] = b[1]/b[2];
00428 
00429     } else {
00430         REAL pow_u[MAXORDER], pow_v[MAXORDER];
00431     trim_power_coeffs( bezierArc, pow_u, 0 );
00432     trim_power_coeffs( bezierArc, pow_v, 1 );
00433 
00434     /* compute first point exactly */
00435         REAL *b = bezierArc->cpts;
00436     vert->param[0] = b[0];
00437     vert->param[1] = b[1];
00438 
00439     /* strength reduction on p = dp * step would introduce error */
00440     int step;
00441         register long order =  bezierArc->order;
00442     for( step=1, ++vert; step<nsteps; step++, vert++ ) {
00443         register REAL p = dp * step;
00444         register REAL u = pow_u[0];
00445             register REAL v = pow_v[0];
00446             for( register int i = 1; i < bezierArc->order; i++ ) {
00447             u = u * p + pow_u[i];
00448             v = v * p + pow_v[i];
00449             }
00450             vert->param[0] = u;
00451         vert->param[1] = v;
00452 #ifndef NOELIMINATION
00453         REAL ds = glu_abs(vert[0].param[0] - vert[-1].param[0]);
00454         REAL dt = glu_abs(vert[0].param[1] - vert[-1].param[1]);
00455         int canremove = (ds<geo_stepsize && dt<geo_stepsize) ? 1 : 0;
00456         REAL ods=0.0, odt=0.0;
00457 
00458         if( ocanremove && canremove ) {
00459         REAL nds = ds + ods;
00460         REAL ndt = dt + odt;
00461         if( nds<geo_stepsize && ndt<geo_stepsize ) {
00462             // remove previous point
00463             --vert;
00464             vert[0].param[0] = vert[1].param[0];
00465             vert[0].param[1] = vert[1].param[1];
00466             ods = nds;
00467             odt = ndt;
00468             ocanremove = 1;
00469         } else {
00470             ocanremove = canremove;
00471             ods = ds;
00472             odt = dt;
00473         }
00474         } else {
00475         ocanremove = canremove;
00476         ods = ds;
00477         odt = dt;
00478         }
00479 #endif  
00480     }
00481 
00482     /* compute last point exactly */
00483     b += (order - 1) * bezierArc->stride;
00484     vert->param[0] = b[0];
00485     vert->param[1] = b[1];
00486     }
00487     arc->pwlArc->npts = vert - arc->pwlArc->pts + 1;
00488 /*
00489     for( TrimVertex *vt=pwlArc->pts; vt != vert-1; vt++ ) {
00490     if( tooclose( vt[0].param[0], vt[1].param[0] ) )
00491         vt[1].param[0] = vt[0].param[0];
00492     if( tooclose( vt[0].param[1], vt[1].param[1] ) )
00493         vt[1].param[1] = vt[0].param[1];
00494     }
00495 */
00496 }
00497 
00498 const REAL ArcTessellator::gl_Bernstein[][MAXORDER][MAXORDER] = {
00499  {
00500   {1, 0, 0, 0, 0, 0, 0, 0 },
00501   {0, 0, 0, 0, 0, 0, 0, 0 },
00502   {0, 0, 0, 0, 0, 0, 0, 0 },
00503   {0, 0, 0, 0, 0, 0, 0, 0 },
00504   {0, 0, 0, 0, 0, 0, 0, 0 },
00505   {0, 0, 0, 0, 0, 0, 0, 0 },
00506   {0, 0, 0, 0, 0, 0, 0, 0 },
00507   {0, 0, 0, 0, 0, 0, 0, 0 }
00508  },
00509  {
00510   {-1, 1, 0, 0, 0, 0, 0, 0 },
00511   {1, 0, 0, 0, 0, 0, 0, 0 },
00512   {0, 0, 0, 0, 0, 0, 0, 0 },
00513   {0, 0, 0, 0, 0, 0, 0, 0 },
00514   {0, 0, 0, 0, 0, 0, 0, 0 },
00515   {0, 0, 0, 0, 0, 0, 0, 0 },
00516   {0, 0, 0, 0, 0, 0, 0, 0 },
00517   {0, 0, 0, 0, 0, 0, 0, 0 }
00518  },
00519  {
00520   {1, -2, 1, 0, 0, 0, 0, 0 },
00521   {-2, 2, 0, 0, 0, 0, 0, 0 },
00522   {1, 0, 0, 0, 0, 0, 0, 0 },
00523   {0, 0, 0, 0, 0, 0, 0, 0 },
00524   {0, 0, 0, 0, 0, 0, 0, 0 },
00525   {0, 0, 0, 0, 0, 0, 0, 0 },
00526   {0, 0, 0, 0, 0, 0, 0, 0 },
00527   {0, 0, 0, 0, 0, 0, 0, 0 }
00528  },
00529  {
00530   {-1, 3, -3, 1, 0, 0, 0, 0 },
00531   {3, -6, 3, 0, 0, 0, 0, 0 },
00532   {-3, 3, 0, 0, 0, 0, 0, 0 },
00533   {1, 0, 0, 0, 0, 0, 0, 0 },
00534   {0, 0, 0, 0, 0, 0, 0, 0 },
00535   {0, 0, 0, 0, 0, 0, 0, 0 },
00536   {0, 0, 0, 0, 0, 0, 0, 0 },
00537   {0, 0, 0, 0, 0, 0, 0, 0 }
00538  },
00539  {
00540   {1, -4, 6, -4, 1, 0, 0, 0 },
00541   {-4, 12, -12, 4, 0, 0, 0, 0 },
00542   {6, -12, 6, 0, 0, 0, 0, 0 },
00543   {-4, 4, 0, 0, 0, 0, 0, 0 },
00544   {1, 0, 0, 0, 0, 0, 0, 0 },
00545   {0, 0, 0, 0, 0, 0, 0, 0 },
00546   {0, 0, 0, 0, 0, 0, 0, 0 },
00547   {0, 0, 0, 0, 0, 0, 0, 0 }
00548  },
00549  {
00550   {-1, 5, -10, 10, -5, 1, 0, 0 },
00551   {5, -20, 30, -20, 5, 0, 0, 0 },
00552   {-10, 30, -30, 10, 0, 0, 0, 0 },
00553   {10, -20, 10, 0, 0, 0, 0, 0 },
00554   {-5, 5, 0, 0, 0, 0, 0, 0 },
00555   {1, 0, 0, 0, 0, 0, 0, 0 },
00556   {0, 0, 0, 0, 0, 0, 0, 0 },
00557   {0, 0, 0, 0, 0, 0, 0, 0 }
00558  },
00559  {
00560   {1, -6, 15, -20, 15, -6, 1, 0 },
00561   {-6, 30, -60, 60, -30, 6, 0, 0 },
00562   {15, -60, 90, -60, 15, 0, 0, 0 },
00563   {-20, 60, -60, 20, 0, 0, 0, 0 },
00564   {15, -30, 15, 0, 0, 0, 0, 0 },
00565   {-6, 6, 0, 0, 0, 0, 0, 0 },
00566   {1, 0, 0, 0, 0, 0, 0, 0 },
00567   {0, 0, 0, 0, 0, 0, 0, 0 }
00568  },
00569  {
00570   {-1, 7, -21, 35, -35, 21, -7, 1 },
00571   {7, -42, 105, -140, 105, -42, 7, 0 },
00572   {-21, 105, -210, 210, -105, 21, 0, 0 },
00573   {35, -140, 210, -140, 35, 0, 0, 0 },
00574   {-35, 105, -105, 35, 0, 0, 0, 0 },
00575   {21, -42, 21, 0, 0, 0, 0, 0 },
00576   {-7, 7, 0, 0, 0, 0, 0, 0 },
00577   {1, 0, 0, 0, 0, 0, 0, 0 }
00578  }};
00579 
00580 
00581 /*-----------------------------------------------------------------------------
00582  * trim_power_coeffs - compute power basis coefficients from bezier coeffients
00583  *-----------------------------------------------------------------------------
00584  */
00585 void
00586 ArcTessellator::trim_power_coeffs( BezierArc *bez_arc, REAL *p, int coord )
00587 {
00588     register int stride = bez_arc->stride;
00589     register int order = bez_arc->order;
00590     register REAL *base = bez_arc->cpts + coord;
00591 
00592     REAL const (*mat)[MAXORDER][MAXORDER] = &gl_Bernstein[order-1];
00593     REAL const (*lrow)[MAXORDER] = &(*mat)[order];
00594 
00595     /* WIN32 didn't like the following line within the for-loop */
00596     REAL const (*row)[MAXORDER] =  &(*mat)[0];
00597     for( ; row != lrow; row++ ) {
00598     register REAL s = 0.0;
00599     register REAL *point = base;
00600     register REAL const *mlast = *row + order;
00601     for( REAL const *m = *row; m != mlast; m++, point += stride ) 
00602         s += *(m) * (*point);
00603     *(p++) = s;
00604     }
00605 }

Generated on Sun May 27 2012 04:23:39 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.