/[libvob]/libvob/include/vob/LinearPrimitives.hxx
ViewVC logotype

Diff of /libvob/include/vob/LinearPrimitives.hxx

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

revision 1.7 by tjl, Mon Mar 10 11:15:12 2003 UTC revision 1.8 by tjl, Mon Mar 10 16:02:05 2003 UTC
# Line 88  namespace Primitives { Line 88  namespace Primitives {
88          }          }
89      };      };
90    
   
91      /** Expose the vec in TranslateXYZ and ScaleXYZ and possibly      /** Expose the vec in TranslateXYZ and ScaleXYZ and possibly
92       * others explicitly.       * others explicitly.
93       */       */
# Line 110  namespace Primitives { Line 109  namespace Primitives {
109      VOB_PRIMITIVETRANS_DEFINED(TranslateXYZ_Explicit, "translate");      VOB_PRIMITIVETRANS_DEFINED(TranslateXYZ_Explicit, "translate");
110      VOB_PRIMITIVETRANS_DEFINED(ScaleXYZ_Explicit, "scale");      VOB_PRIMITIVETRANS_DEFINED(ScaleXYZ_Explicit, "scale");
111    
112    
113        /** Rotation clockwise.
114         */
115        class RotateXY :
116            public PrimitiveTransform,
117            public GLPerformablePrimitiveTransform
118        {
119        protected:
120            float a;
121            void angleWasSet() {
122                s = sin(a * M_PI / 180);
123                c = cos(a * M_PI / 180);
124            }
125        private:
126            float s, c;
127        public:
128            RotateXY() { }
129            RotateXY(float angle) {
130                a = angle;
131                angleWasSet();
132            }
133            /** Perform the internal transformation of this
134             * coordsys.
135             */
136            void tr(const ZPt &from, ZPt &to) const {
137                to.x = c * from.x + -s * from.y;
138                to.y = s * from.x + c * from.y;
139                to.z = from.z;
140            }
141            void performGL() const {
142                glRotatef(a, 0, 0, 1);
143            }
144            typedef RotateXY InverseType;
145            void inverse(RotateXY &into) const {
146                into.a = -a;
147                into.angleWasSet();
148            }
149        };
150    
151        struct RotateXY_Explicit :
152            public RotateXY,
153            public ParametrizedPrimitiveTransform {
154    
155            enum {NParams = 1 };
156    
157            template<class Ptr> void setParams(Ptr p) {
158                a = p[0];
159                angleWasSet();
160            }
161        };
162        VOB_PRIMITIVETRANS_DEFINED(RotateXY_Explicit, "rotate");
163    
164      /** A no-op: same coords in and out.      /** A no-op: same coords in and out.
165       */       */
166      class Unit :      class Unit :
# Line 298  namespace Primitives { Line 349  namespace Primitives {
349          public DependentPrimitiveTransform          public DependentPrimitiveTransform
350      {      {
351          enum { NDepends = 1 }; // just parent          enum { NDepends = 1 }; // just parent
352          template<class SPtr> void setParams(const Transform *super, SPtr depends) {          template<class SPtr> void setParams(SPtr depends) {
353              Pt p = super->getSqSize();              Pt p = depends[0]->getSqSize();
354              vec.x = p.x;              vec.x = p.x;
355              vec.y = p.y;              vec.y = p.y;
356              vec.z = 1;              vec.z = 1;

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

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