Hello,
Have three vectors X,Y,Z in camera space that form an orthonormal basis.
And vector V also in camera space.
Just need to convert V from camera space to X,Y,Z space.
Tried to do it like this:
vector av = array(X,Y,Z);
matrix A = set(av);
vector res = vtransform(V, A );
but result is wrong.
How can one transform V from camera space to coordinate system defined by X,Y,Z?
Transforming to arbitrary coordinate space
3929 4 1- sergey_sh
- Member
- 22 posts
- Joined: June 2008
- Offline
- rdg
- Member
- 401 posts
- Joined:
- Offline
Maybe like this?
http://forums.odforce.net/index.php?/topic/7724-transform-vop-in-sop-context/page__hl__transform%20space%20object%20support%20__fromsearch__1 [forums.odforce.net]
http://forums.odforce.net/index.php?/topic/7724-transform-vop-in-sop-context/page__hl__transform%20space%20object%20support%20__fromsearch__1 [forums.odforce.net]
this is not a science fair.
- Pagefan
- Member
- 519 posts
- Joined:
- Offline
- sergey_sh
- Member
- 22 posts
- Joined: June 2008
- Offline
Pagefan
Try this piece of code:
Thanks for reply, unfortunately result seems to be wrong.
matrix maketransform(int trs, int xyz, vector t, vector r, vector s)
From the docs:
maketransform builds a general 4×4 transform matrix given an order of transformations (trs), an order for rotations (xyz), a vector representing the translation (t), rotation (r), scale (s)
In my case X,Y,Z are not vectors that represent rotation or scale.
This are just three vectors that form a basis.
TD @ Mr.X Inc
- Pagefan
- Member
- 519 posts
- Joined:
- Offline
Ah I missed that about the X,Y,Z being a custom space…
My matrix math is a bit rusty but give this a shot:
vector V = set(your_x, your_y, your_z);
vector av = array(X,Y,Z);
vector cur_space = ({1,0,0}, {0,1,0}, {0,0,-1});
vector cam_space = (normalize(vtransform(“space:camera”, cur_space)),
normalize(vtransform(“space:camera”, cur_space)),
normalize(vtransform(“space:camera”, cur_space)));
/*since both the vectors are orthonormal you only need to retrieve one rotation*/
matrix3 mat = dhideral(cam_space, av);
vector Vnew = vtransform(V, mat);
If it doesn't work, could you post your hip file?
My matrix math is a bit rusty but give this a shot:
vector V = set(your_x, your_y, your_z);
vector av = array(X,Y,Z);
vector cur_space = ({1,0,0}, {0,1,0}, {0,0,-1});
vector cam_space = (normalize(vtransform(“space:camera”, cur_space)),
normalize(vtransform(“space:camera”, cur_space)),
normalize(vtransform(“space:camera”, cur_space)));
/*since both the vectors are orthonormal you only need to retrieve one rotation*/
matrix3 mat = dhideral(cam_space, av);
vector Vnew = vtransform(V, mat);
If it doesn't work, could you post your hip file?
-
- Quick Links