Thank you for the example Txema. I'm going to need to become a little more 
educated to understand it.
Is A,C the x,y of the bottom left corner of the window, and B,D the top 
right?
What kind of data type is the matrix, some sort of special double precision 
tuple?
What do you use this bit of code for (zooming, panning, etc..)?

Txema Vicente wrote:
>
> I have some code that may help you, the math is in there. 
>
> This is for a hierarchy of planes, and all matrices are calculated 
> "manually". 
>
> _tx, _ty, _tz : Translation 
> _scale: (XY axis) 
> _rotation: (Z axis) 
>
>
> RADIANS=-0.01745 
>
> class Plane(...): 
>
>      def matrix_update(self): 
>          a = self._scale*math.cos(RADIANS*self._rotation) 
>          b = self._scale*math.sin(RADIANS*self._rotation) 
>          if self.parent is None: 
>              self.matrix=(gl.GLdouble * 16)( 
>                              a, -b, 0, 0, 
>                              b, a, 0, 0, 
>                              0, 0, 1, 0, 
>                              self._tx, self._ty, self._tz, 1) 
>          else: 
>              c, d = -b, a 
>              origin=self.parent.matrix 
>              A,C = origin[0], origin[1] #C=-B 
>              B,D = origin[4], origin[5] #D=A 
>              X,Y,Z = origin[12], origin[13], origin[14] 
>              self.matrix=(gl.GLdouble * 16)( 
>                               A*a+B*c, C*a+D*c, 0, 0, 
>                               A*b+B*d, C*b+D*d, 0, 0, 
>                               0, 0, 1, 0, 
>                       X + A*self._tx + B*self._ty, Y + C*self._tx + 
> D*self._ty, 
>                       Z + self._tz, 1) 
>
>          for plane in self.children: plane.matrix_update() 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pyglet-users/-/LGCPXGNx3EoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en.

Reply via email to