Small fix, but cost me alot of time.in debugging. The transform() method of
Number3D should grab a copy of the values of the input Number3D in case it's a
self
referencing call as such as:
myVect.transform(myVect, rotMatrix );
Problems will occur in the current svn version because since we feed itself as
v to the method, once the assignement to the x class member is done it is used
to
subsequently as v.x to calculate the remaining dimensions causing huge
displacement.
/me takes a couple of pills to remove the headache
Same thing is true for the rotate() method of the same class.
Thanks!
Ben
Index: /Users/bbeausej/Documents/DEV/Away3d/src/away3d/core/math/
Number3D.as
===================================================================
--- /Users/bbeausej/Documents/DEV/Away3d/src/away3d/core/math/
Number3D.as (revision 552)
+++ /Users/bbeausej/Documents/DEV/Away3d/src/away3d/core/math/
Number3D.as (working copy)
@@ -180,9 +180,13 @@
*/
public function rotate(v:Number3D, m:Matrix3D):void
{
- x = v.x * m.sxx + v.y * m.sxy + v.z * m.sxz;
- y = v.x * m.syx + v.y * m.syy + v.z * m.syz;
- z = v.x * m.szx + v.y * m.szy + v.z * m.szz;
+ var vx:Number = v.x;
+ var vy:Number = v.y;
+ var vz:Number = v.z;
+
+ x = vx * m.sxx + vy * m.sxy + vz * m.sxz;
+ y = vx * m.syx + vy * m.syy + vz * m.syz;
+ z = vx * m.szx + vy * m.szy + vz * m.szz;
}
/**
@@ -193,9 +197,14 @@
*/
public function transform(v:Number3D, m:Matrix3D):void
{
- x = v.x * m.sxx + v.y * m.sxy + v.z * m.sxz + m.tx;
- y = v.x * m.syx + v.y * m.syy + v.z * m.syz + m.ty;
- z = v.x * m.szx + v.y * m.szy + v.z * m.szz + m.tz;
+ var vx:Number = v.x;
+ var vy:Number = v.y;
+ var vz:Number = v.z;
+
+
+ x = vx * m.sxx + vy * m.sxy + vz * m.sxz + m.tx;
+ y = vx * m.syx + vy * m.syy + vz * m.syz + m.ty;
+ z = vx * m.szx + vy * m.szy + vz * m.szz + m.tz;
}
/**
Original issue reported on code.google.com by bbeau...@gmail.com on 5 Jun 2008 at 6:50
Original issue reported on code.google.com by
bbeau...@gmail.com
on 5 Jun 2008 at 6:50