/[gzz]/gzz/gfx/libcoords/Coords.cxx
ViewVC logotype

Diff of /gzz/gfx/libcoords/Coords.cxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.32 by tjl, Mon Oct 7 07:40:03 2002 UTC revision 1.33 by tjl, Mon Oct 7 08:51:24 2002 UTC
# Line 285  namespace Coords { Line 285  namespace Coords {
285      public:      public:
286          BuoyOnCircleCoords() : tr() { }          BuoyOnCircleCoords() : tr() { }
287          BuoyOnCircleCoords(ZVec tr) : tr(tr) { }          BuoyOnCircleCoords(ZVec tr) : tr(tr) { }
288          enum { NParams = 6 };          enum { NParams = 6, NPrevious = 1 };
289          virtual void setParams(float *params) {          virtual void setParams(float *params) {
290              float pointdir = params[5];              float pointdir = params[5];
291              ZVec ctr(params[0], params[1], 0);              ZVec ctr(params[0], params[1], 0);
# Line 517  namespace Coords { Line 517  namespace Coords {
517          }          }
518      };      };
519    
520        class ConcatCoordSys : public CoordSys {
521            CoordSys *super2;
522        public:
523            ConcatCoordSys() : super2(0) { }
524            ConcatCoordSys(CoordSys *a, CoordSys *b)
525                : CoordSys(a), super2(b) {
526            }
527            ConcatCoordSys(CoordSys *a, CoordSys *b, CoordSys *inverse, bool ownInverse)
528                : CoordSys(a, inverse, ownInverse), super2(b) {
529            }
530            virtual void setSuper(CoordSys **super) {
531                CoordSys::setSuper(super);
532                this->super2 = super[1];
533            }
534            enum { NParams = 0, NPrevious = 2 } ;
535            virtual void setParams(float *params) { }
536            virtual CoordSys *createInverse() {
537                return new ConcatCoordSys( super2->getInverse(), super->getInverse(),
538                            this, 0
539                    );
540            }
541            virtual void vertex(const ZPt &p) const {
542                ZPt p2 = super2->transform(p);
543                super->vertex(p2);
544            }
545            virtual ZPt transform(const ZPt &p) const {
546                ZPt p2 = super2->transform(p);
547                return super->transform(p2);
548            }
549            virtual float nonlinearity(const ZPt &p, float radius) {
550                float n1 = super2->nonlinearity(p, radius);
551                float n2 = super->nonlinearity(super2->transform(p), radius);
552                return (n1 > n2 ? n1 : n2);
553            }
554            virtual bool canPerformGL() {
555                return super->canPerformGL() && super2->canPerformGL();
556            }
557            virtual bool performGL() {
558                if(!super2->performGL()) return false;
559                return super->performGL();
560            }
561    
562        };
563    
564      struct SomeFactory {      struct SomeFactory {
565          virtual int nparams() = 0;          virtual int nparams() = 0;
566          virtual int nprevious() = 0;          virtual int nprevious() = 0;
# Line 532  namespace Coords { Line 576  namespace Coords {
576      template<class C> class NoTransFactory : public SomeFactory {      template<class C> class NoTransFactory : public SomeFactory {
577      public:      public:
578          virtual int nparams() { return C::NParams; }          virtual int nparams() { return C::NParams; }
579          virtual int nprevious() { return 1; }          virtual int nprevious() { return C::NPrevious; }
580          virtual CoordSys *create() { return new C(); }          virtual CoordSys *create() { return new C(); }
581      };      };
582    
# Line 543  namespace Coords { Line 587  namespace Coords {
587       */       */
588      SomeFactory* facs[] = {      SomeFactory* facs[] = {
589          0,          0,
590          new Factory<AffineXYCoords>(),          new Factory<AffineXYCoords>(), // 1
591          new Factory<RotateXYCoords>(),          new Factory<RotateXYCoords>(), // 2
592          new Factory<DistortCoords<Fisheye::vector_mag_isotropic<Fisheye::scalar_mag_atan> > >(),          new Factory<DistortCoords<Fisheye::vector_mag_isotropic<Fisheye::scalar_mag_atan> > >(),
593          new Factory<RotateXYZCoords>(),                                          // 3
594          new Factory<ScaleXYZCoords>(),          new Factory<RotateXYZCoords>(), // 4
595          new Factory<TranslateXYZCoords>(),          new Factory<ScaleXYZCoords>(), // 5
596          new NoTransFactory<BuoyOnCircleCoords>(),          new Factory<TranslateXYZCoords>(), // 6
597            new NoTransFactory<BuoyOnCircleCoords>(), // 7
598            new NoTransFactory<ConcatCoordSys>(), // 8
599          0          0
600      };      };
601    

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.33

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26