Hello Sandra,
Sandra Meid wrote:
> I've got a problem with a matrix. I tried to create it out of three
> orthogonal vectors (x, y and z) and a point (from). Everything seems to
> work, but when I run the program, the last position (avatarmatrix
> [3][3]) was always set to "0". "at" and "from" are Pnt3f.
>
> Vec3f z = at - from;
> Vec3f x = z.cross(up);
> Vec3f y = x.cross(z);
> x.normalize();
> y.normalize();
> z.normalize();
>
> Vec4f v1 = Vec4f(x[0], x[1], x[2], 0.0);
> Vec4f v2 = Vec4f(y[0], y[1], y[2], 0.0);
> Vec4f v3 = Vec4f(z[0], z[1], z[2], 0.0);
> Vec4f v4 = Vec4f(from[0], from[1], from[2], 1.0);
>
> Matrix avatarmatrix;
> avatarmatrix.setIdentity();
> avatarmatrix = Matrix(v1, v2, v3, v4);
>
> // workaround
> avatarmatrix[3][3] = 1.0f;
>
> Does anybody know about this problem ?
there is no constructor for Matrix that takes 4 Vec4 only one that takes
4 Vec3 (your Vec4 are auto converted to Vec3 to make this work).
As to why there is no constructor taking 4 Vec4, I don't really know.
I can add one, but first I'd like to hear if anyone recalls a reason for
not having it in the first place ?
Hope it helps,
Carsten
BTW: it is a bit more efficient to create and initialize the
avatermatrix like this:
Matrix avatarmatrix(v1, v2, v3, v4);
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users