summaryrefslogtreecommitdiffstats
path: root/libdimension-python/dimension.pyx
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-06-14 08:37:55 -0600
committerTavian Barnes <tavianator@gmail.com>2011-06-14 08:37:55 -0600
commit9ed4a01ac4305baff9e5ee1484691e78def105a1 (patch)
treea8b5c556baf7053546e188e42278c6b88c7b0543 /libdimension-python/dimension.pyx
parent9b758508df283a533a4cfc605545a35f77bc9d5f (diff)
downloaddimension-9ed4a01ac4305baff9e5ee1484691e78def105a1.tar.xz
Fix rotational alignment.
Diffstat (limited to 'libdimension-python/dimension.pyx')
-rw-r--r--libdimension-python/dimension.pyx24
1 files changed, 6 insertions, 18 deletions
diff --git a/libdimension-python/dimension.pyx b/libdimension-python/dimension.pyx
index 9a5fd80..54b7e66 100644
--- a/libdimension-python/dimension.pyx
+++ b/libdimension-python/dimension.pyx
@@ -643,11 +643,7 @@ cdef class Cone(Object):
cdef Matrix trans = translate(Y)
trans = scale(1.0, dir.norm()/2, 1.0)*trans
-
- cdef double thetaX = dmnsn_vector_axis_angle(dmnsn_y, dir._v, dmnsn_x)
- cdef double thetaZ = dmnsn_vector_axis_angle(dmnsn_y, dir._v, dmnsn_z)
- trans = _rawRotate(thetaX*X)*_rawRotate(thetaZ*Z)*trans
-
+ trans = _rawMatrix(dmnsn_alignment_matrix(dmnsn_y, dir._v, dmnsn_x, dmnsn_z))*trans
trans = translate(bottom)*trans
self._intrinsicTransform(trans)
@@ -786,22 +782,14 @@ cdef class PerspectiveCamera(Camera):
cdef Vector vsky = Vector(sky)
# Line up the top of the viewport with the sky vector
- cdef double thetaSkyX = dmnsn_vector_axis_angle(dmnsn_y, vsky._v, dmnsn_x)
- cdef double thetaSkyZ = dmnsn_vector_axis_angle(dmnsn_y, vsky._v, dmnsn_z)
- cdef Matrix alignSky = _rawRotate(thetaSkyX*X)*_rawRotate(thetaSkyZ*Z)
- self.transform(alignSky)
- cdef Vector right = alignSky*X
+ cdef Matrix alignSky = _rawMatrix(dmnsn_alignment_matrix(dmnsn_y, vsky._v,
+ dmnsn_z, dmnsn_x))
cdef Vector forward = alignSky*Z
+ cdef Vector right = alignSky*X
# Line up the look at point with lookAt
- cdef double thetaLookAtSky = dmnsn_vector_axis_angle(
- forward._v, dir._v, vsky._v
- )
- cdef double thetaLookAtRight = dmnsn_vector_axis_angle(
- forward._v, dir._v, right._v
- )
- self.transform(_rawRotate(thetaLookAtSky*vsky))
- self.transform(_rawRotate(thetaLookAtRight*right))
+ self.transform(_rawMatrix(dmnsn_alignment_matrix(forward._v, dir._v,
+ vsky._v, right._v)))
# Move the camera into position
self.transform(translate(Vector(location)))