odgematrix3d/2d translation bug?
odgematrix3d/2d translation bug?
could someone check if the matrix and vector math is working correctly?
odgematrix3d mat; mat.settotranslation( odgevector3d( 10.0, 0.0, 0.0 ) );
odgevector3d vec( 1.0, 0.0, 0.0 );
vec = mat * vec;
my result is vec = { 1.0 , 0.0 , 0.0 } where it should be {11.0, 0.0, 0.0 }
the incorrect result would come from the vector having a value of w that is not 1.0.
am i mistaken here?
last edited by palithius; 20th december 2004 at 12:20 pmfff">.
it's ok. translation does not effect vectors. it effects only points. then vector is transformed by matrix only rotation and scale effect it.
sergey slezkin
why was it designed this way?
because odgepoint class represents geometric point (absolute position) and odgevector represent geometric vector (displacement). this is the main difference between point and vector.
sergey slezkin
following that approach, odgematrix3d::settotranslation should take an odgepoint3d not a odgevector3d.
personally, i see no benefit in removing translation math from the vector. i shall end up making copies of my vectors to points to translate them with my matricies (which contain translations) only to convert them back. also consider they both contain the same data (x,y,z).
anyhow, thanks for clearing that up.
following that approach, odgematrix3d::settotranslation should take an odgevector3d, because matrix translates points by some displacement.
about no benefits... such behaviour is single difference between point and vector

if you have to translate a vector, then you probably should use point instead.
sincerely yours,
george udov
nevertheless i would have felt more comfortable if i could have made all my calculations with a matrix = rotation * translation, and then apply a simple oddbblockreferenceptr foo->setblocktransform(matrix), instead of using that method just for rotating and then foo->setposition(). perhaps i should care less about symmetry
however, may some method overloading help anyone use his/her own approach? hopefully mr. stroustrup implemented it as the key for solving such topics
well, imho even an explicit note in the documentation would be enough