/[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.37 by tjl, Thu Oct 10 05:10:21 2002 UTC revision 1.38 by tjl, Thu Oct 10 09:29:51 2002 UTC
# Line 241  namespace Coords { Line 241  namespace Coords {
241          }          }
242      };      };
243    
244        /** Rotate the downwards vector at the origin
245         * towards the given point.
246         * XXX Document somewhere why!
247         * XXX Think: to make more flexible, need separate parent,
248         * nadirorigin, nadirpoint, rotatearoundpoint.
249         * I.e. the point where the downwards vector needs to face
250         * the nadir might not be the center of rotation.
251         * This gets quite hairy then.
252         */
253        class NadirOriginCoords {
254        public:
255            typedef RotateXYCoords BaseTransform;
256            enum { NParams = 0 };
257            void derivedParams(CoordSys *super, CoordSys *nadirCS,
258                                float *params, float *newparams) {
259                ZPt origin = super->transform(ZPt(0,0,0));
260                ZPt nadir = nadirCS->transform(ZPt(0,0,0));
261    
262                float x = origin.x - nadir.x;
263                float y = origin.y - nadir.y;
264                float angle = atan2(x, -y);
265    
266                newparams[0] = angle * 180 / M_PI;
267            }
268        };
269    
270      /** Translation.      /** Translation.
271       * Parameter layout: x, y, z       * Parameter layout: x, y, z
272       */       */
# Line 638  namespace Coords { Line 664  namespace Coords {
664          new TransFactory<TranslateXYZCoords>(), // 6          new TransFactory<TranslateXYZCoords>(), // 6
665          new DerTransFactory<BuoyOnCircleCoords>(), // 7          new DerTransFactory<BuoyOnCircleCoords>(), // 7
666          new NoTransFactory<ConcatCoordSys>(), // 8          new NoTransFactory<ConcatCoordSys>(), // 8
667            new DerTransFactory<NadirOriginCoords>(), // 9
668          0          0
669      };      };
670    

Legend:
Removed from v.1.37  
changed lines
  Added in v.1.38

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