> On Fri, 3 Mar 2000, pine wrote:
>
> >       t = new Transform3D();
> >       t.setRotation(new Quat4f(0.78f, 0.78f, 0.78f,0.0f));
> >
> > What's the four parameters in Quat4f( ) mean?
>
> Dunno exactly (it's a complex number of some sort), but if you're
> interested in rotation about a particular axis by a particular angle (e.g.
> for a RotPosPathInterpolator), try this FriendlyQuat class. Use it like:
>
> Quat4f myquat = new FriendlyQuat(1, 0, 0, Math.PI * 60/180);
>
> The comments in the class will give more clues about how to do it without
> the class.
>
>     class FriendlyQuat extends Quat4f {
>         // A quat (x,y,z,w) for a rotation about (x,y,z) by angle t is:
>         // (x*sin(t/2),y*sin(t/2),z*sin(t/2),cos(t/2))
>         // (a,b,c) must be a unit vector. This class normalizes the vector for you.
>         public FriendlyQuat(float x, float y, float z, float theta) {
>             this(new Vector3f(x,y,z), theta);
>         }
>
>         public FriendlyQuat(double x, double y, double z, double theta) {
>             this(new Vector3f((float)x,(float)y,(float)z), (float)theta);
>         }
>
>         public FriendlyQuat(Vector3f u, float theta) {
>             super();
>             Vector3f nu = new Vector3f();
>             nu.normalize(u);
>             float[] t = new float[3];
>             nu.get(t);
>             float mst2 = (float) Math.sin(theta/2);
>             set(t[0] * mst2, t[1] * mst2, t[2] * mst2, (float) Math.cos(theta/2));
>         }
>
>         public FriendlyQuat(AxisAngle4f aa) {
>             super();
>             set(aa);
>         }
>     }
>
> Gareth
begin:vcard
n:Boden;Gareth
tel;fax:+44 1223 713641
tel;work:+44 1223 713640
x-mozilla-html:FALSE
url:http://www.human-it.co.uk/
org:Human Information Technology Limited;Software Development
version:2.1
email;internet:[EMAIL PROTECTED]
title:Head of Software Development
adr;quoted-printable:;;Murdoch House=0D=0AStation Road;Cambridge;Cambridgeshire;CB1 2JH;United Kingdom
x-mozilla-cpt:;-29184
fn:Gareth Boden
end:vcard

Reply via email to