--Apple-Mail-1-559241892
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed
On 19/06/2006, at 1:46 AM, Chris Hughes wrote:
> I am looking to write a function to convert the ARToolkit Matrix
> into the
> 'eye position', 'look at point' and 'up vector' used in VTK. Has
> anyone got
> any knowledge about how to do this? Or can you point me towards any
> information about the ARToolkit Matrix in general?
Here's one way of doing it:
float scalef = 1.0f;
GLdouble m[16];
GLdouble eyepos[3], lookat[3], up[3];
// See detection loop in Idle() in simpleLite.c for context of the
line below.
arGetTransMat(&(marker_info[k]), patt_centre, patt_width, patt_trans);
// Make patt_trans into a standard OpenGL HCT matrix (N.B.:column-
major).
arglCameraView(patt_trans, m, scalef);
// This treats the marker as lying in the x-y plane, with the +z axis
pointing towards the observer.
eyepos[0] = m[12]; eyepos[1] = m[13]; eyepos[2] = m[14];
lookat[0] = eyepos[0] - m[8]; lookat[1] = eyepos[1] - m[9]; lookat[2]
= eyepos[2] - m[10];
up[0] = m[4]; up[1] = m[5]; up[2] = m[6];
Cheers,
Phil.
--Apple-Mail-1-559241892
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
charset=ISO-8859-1
<HTML><BODY style=3D"word-wrap: break-word; -khtml-nbsp-mode: space; =
-khtml-line-break: after-white-space; "><DIV>On 19/06/2006, at 1:46 AM, =
Chris Hughes wrote:</DIV><BLOCKQUOTE type=3D"cite"><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">I am looking to write a function to convert the =
ARToolkit Matrix into the</DIV><DIV style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">'eye =
position', 'look at point' and 'up vector' used in VTK. Has anyone =
got</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; ">any knowledge about how to do =
this? Or can you point me towards any</DIV><DIV style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; =
">information about the ARToolkit Matrix in =
general?</DIV></BLOCKQUOTE><FONT class=3D"Apple-style-span" =
face=3D"Monaco" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: 10px;"><DIV><BR =
class=3D"khtml-block-placeholder"></DIV>Here's one way of doing =
it:</SPAN></FONT><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; "></DIV><DIV style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT =
class=3D"Apple-style-span" face=3D"Monaco" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: 10px;"><BR =
class=3D"khtml-block-placeholder"></SPAN></FONT></DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Monaco" =
size=3D"2"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
10px;">float scalef =3D 1.0f;</SPAN></FONT></DIV><DIV style=3D"margin-top:=
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT =
class=3D"Apple-style-span" face=3D"Monaco" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: 10px;">GLdouble =
m[</SPAN></FONT><FONT class=3D"Apple-style-span" color=3D"#0000FF" =
face=3D"Monaco" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: 10px;">16</SPAN></FONT><FONT =
class=3D"Apple-style-span" face=3D"Monaco" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: =
10px;">];</SPAN></FONT></DIV><DIV style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT =
class=3D"Apple-style-span" face=3D"Monaco" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: 10px;">GLdouble =
eyepos[3], lookat[3], up[3];</SPAN></FONT></DIV><DIV style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT =
class=3D"Apple-style-span" face=3D"Monaco" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: 10px;"><BR =
class=3D"khtml-block-placeholder"></SPAN></FONT></DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Monaco" =
size=3D"2"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
10px;">// See detection loop in Idle() in simpleLite.c for context of =
the line below.</SPAN></FONT></DIV><DIV style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT =
class=3D"Apple-style-span" face=3D"Monaco" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: =
10px;">arGetTransMat(&(marker_info[k]), patt_centre, patt_width, =
patt_trans);</SPAN></FONT></DIV><FONT class=3D"Apple-style-span" =
face=3D"Monaco" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: 10px;"><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>// Make patt_trans into a =
standard OpenGL HCT matrix =
(N.B.:column-major).</DIV>arglCameraView(patt_trans, m, =
scalef);</SPAN></FONT><DIV><FONT class=3D"Apple-style-span" =
face=3D"Monaco" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: 10px;"><BR =
class=3D"khtml-block-placeholder"></SPAN></FONT></DIV><DIV><FONT =
class=3D"Apple-style-span" face=3D"Monaco" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: 10px;">// This treats the =
marker as lying in the x-y plane, with the +z axis pointing towards the =
observer.</SPAN></FONT><FONT class=3D"Apple-style-span" face=3D"Monaco" =
size=3D"2"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
10px;"></SPAN></FONT></DIV><DIV><FONT class=3D"Apple-style-span" =
face=3D"Monaco" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: 10px;">eyepos[0] =3D m[12]; eyepos[1] =3D m[13]; =
eyepos[2] =3D m[14];</SPAN></FONT></DIV><DIV><FONT =
class=3D"Apple-style-span" face=3D"Monaco" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: =
10px;"></SPAN></FONT></DIV><DIV></DIV><DIV></DIV><DIV><FONT =
class=3D"Apple-style-span" face=3D"Monaco" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: 10px;">lookat[0] =
=3D=A0eyepos[0] - m[8];=A0lookat[1] =3D=A0eyepos[1] - m[9];=A0lookat[2] =
=3D=A0eyepos[2] - m[10];</SPAN></FONT></DIV><DIV><FONT =
class=3D"Apple-style-span" face=3D"Monaco" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: 10px;">up[0] =3D =
m[4];=A0up[1] =3D m[5];=A0up[2] =3D m[6];=A0</SPAN></FONT></DIV><DIV><FONT=
class=3D"Apple-style-span" face=3D"Monaco" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: 10px;"><BR =
class=3D"khtml-block-placeholder"></SPAN></FONT></DIV><DIV><FONT =
class=3D"Apple-style-span" face=3D"Monaco" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: =
10px;">Cheers,</SPAN></FONT></DIV><DIV><FONT class=3D"Apple-style-span" =
face=3D"Monaco" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: 10px;">Phil.</SPAN></FONT></DIV></BODY></HTML>=
--Apple-Mail-1-559241892--
|