Dear Soya users and hackers,

Below is a simple patch to add a 'quaternion' property to a CoordSyst.
I think it is reasonable to add such a property (given the x,y,z, and
scale_* properties), though there is now an uncomfortable overlap with
CoordSystState.

It is possible to eliminate CoordSystState (possibly adding a
_quaternion attribute to CoordSyst). CoordSyst.interpolate would then
take two CoordSyst's as arguments. And, instead of something like

  self.state1=soya.CoordSystState(self)

one could do

  self.state1=self.cloneCoordSyst()

I think having a factory-function might be a good idea regardless of
whether CoordSystState is kept or not.

Let me know what you think.

Regards,

Rory

*** coordsyst.pyx.~1.23.~       2005-10-18 20:03:14.000000000 +0200
--- coordsyst.pyx       2005-12-23 14:44:02.000000000 +0200
***************
*** 338,344 ****
        return self._matrix[18]
      def __set__(self, float x):
        self.scale(1.0, 1.0, x / self._matrix[18])
!       
    def set_scale_factors(self, float scale_x, float scale_y, float scale_z):
      """CoordSyst.set_scale_factors(SCALE_X, SCALE_Y, SCALE_Z)
  
--- 338,355 ----
        return self._matrix[18]
      def __set__(self, float x):
        self.scale(1.0, 1.0, x / self._matrix[18])
! 
!   property quaternion:
!     def __get__(self):
!       cdef GLfloat q[4]
!       quaternion_from_matrix(q, self._matrix)
!       return q[0],q[1],q[2],q[3]
! 
!     def __set__(self, q):
!       cdef GLfloat cq[4]
!       cq[0],cq[1],cq[2],cq[3]=q[0],q[1],q[2],q[3]
!       matrix_from_quaternion(self._matrix, cq)
! 
    def set_scale_factors(self, float scale_x, float scale_y, float scale_z):
      """CoordSyst.set_scale_factors(SCALE_X, SCALE_Y, SCALE_Z)

Reply via email to