nagyistoce / tin-man

Automatically exported from code.google.com/p/tin-man
GNU General Public License v3.0
0 stars 0 forks source link

TransformationMatrix bug #29

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In simspark Wiki, here: 
http://simspark.sourceforge.net/wiki/index.php/Network_Protocol#Transform_Node

documented that:
The typical form of a homogeneous transformation matrix is as follows:
 [nx ox ax Px]
 [ny oy ay Px]
 [nz oz az Pz]
 [ 0  0  0  1]
where the unit vectors n; o; a stand for normal, orientation and approach, 
respectively, and refer to the three vectors that represent a reference frame 
in the three dimensional space.
A transform node in Simspark representing the aforementioned transformation 
matrix is as follows:
 (nd TRF (SLT nx ny nz 0 ox oy oz 0 ax ay az 0 Px Py Pz 1 ))

so if I noticed correctly, the private variables in TransformationMatrix class 
are mapped as bellow:
_m00: nx
_m01: ox
_m02: ax
_m03: px
_m10: ny
_m11: oy
_m12: py
_m20: nz
and so..

So, in TransformationMatrix.cs in TinMan project
from line 131 to 144 must changed to:
_m00 = values[0];
_m10 = values[1];
_m20 = values[2];
_m30 = values[3];
_m01 = values[4];
_m11 = values[5];
_m21 = values[6];
_m31 = values[7];
_m02 = values[8];
_m12 = values[9];
_m22 = values[10];
_m32 = values[11];
_m03 = values[12];
_m13 = values[13];
_m23 = values[14];
_m33 = values[15];

If i'm wrong here, so there must be a bug in "public Vector3 GetTranslation()"  
in line 297
return new Vector3(_m03, _m13, _m23);
must change to:
return new Vector3(_m30, _m31, _m32);
Otherwise the result will always be (0,0,0) as now is (the last row of input 
matrix).

Original issue reported on code.google.com by m.za...@gmail.com on 24 Oct 2011 at 4:24

GoogleCodeExporter commented 9 years ago
From the top of my head, the internal representation of the transformation 
matrix is different to what you're showing, with Px/y/z along the bottom row.  
However, there are still bugs in the implementation that must be solved.

My goal is to improve the set of unit tests against which the 
TransformationMatrix class is proven.

It may make sense to change the internal representation to what you've 
suggested, as there does seem to be a bug after deserialisation.  I'll add a 
unit test for that case in the next day or so.

Thanks for finding and pointing this out.

Original comment by drewnoakes on 24 Oct 2011 at 6:50

GoogleCodeExporter commented 9 years ago
The code in SVN has been updated and appears to be working correctly.  There's 
a sample agent that uses the TransformationMatrix class to rotate a wireframe 
of a cube in 3D above the field via the RoboViz debugger.

This will be included in the next release of the API.

Thanks again for your interest and help.

Original comment by drewnoakes on 19 Apr 2012 at 4:57