Thanks a lot,
I'll try to normailize it, because epsilon is not very little in my
application, so this could make zero-rotation
Thanks :)
Vincent.
2008/3/19, J.P. Delport <[EMAIL PROTECTED]>:
>
> Hi,
>
> the code from makeRotate explains it best:
>
> --8<--
> void Quat::makeRotate( value_type angle, value_type x, value_type y,
> value_type z )
> {
> const value_type epsilon = 0.0000001;
>
> value_type length = sqrt( x*x + y*y + z*z );
> if (length < epsilon)
> {
> // ~zero length axis, so reset rotation to zero.
> *this = Quat();
> return;
> }
>
> value_type inversenorm = 1.0/length;
> value_type coshalfangle = cos( 0.5*angle );
> value_type sinhalfangle = sin( 0.5*angle );
>
> _v[0] = x * sinhalfangle * inversenorm;
> _v[1] = y * sinhalfangle * inversenorm;
> _v[2] = z * sinhalfangle * inversenorm;
> _v[3] = coshalfangle;
> }
> --8<--
>
> You can see that the length of the vector you use for rotation is
> already accounted for, i.e. normalising the vector would not change
> anything.
>
> The only exception is for very small vectors, if length < epsilon you
> will get a zero rotation. If you think your vector with length < epsilon
> is a valid rotation vector, then normalising it before calling
> makeRotate could make a difference.
>
> I'd normally associate such a small rotation vector, if it is coming
> from other code, to indicate a zero rotation anyways, but I don't know
> your application.
>
> regards
> jp
>
>
>
>
> Vincent Bourdier wrote:
> > Hi
> >
> > First, yes it is the vector OF rotation, sorry for the mistake...
> >
> > And when I speak about normalizing, I'm just thinking of making a
> > vector.normalize()... with that operation, length of the vector will be
> > 1, even if the vector is close to 0 0 0...
> >
> > I just want to use this vector to set the rotation vector of the Quat...
> >
> > To be more clear : I have a Quat with a rotation vector which is very
> > very little... I ask if normalizing this vector will make a difference ?
> > and why ?
> >
> > Thanks,
> >
> > Regards,
> > Vincent
> >
> > 2008/3/19, J.P. Delport <[EMAIL PROTECTED]
>
> > <mailto:[EMAIL PROTECTED]>>:
>
> >
> > Hi,
> >
> > I'd like to help, but don't know what you are asking...
> >
> >
> > Vincent Bourdier wrote:
> > > Hi all,
> > >
> > > I just have a little question, because I'm not sure of something
> > about
> > > quat :
> > >
> > > I have to quat q1 and q2
> > >
> > > To pass form q1 to q2 I've made q = q1.inverse()*q2
> > >
> > > But even if the result angle looks correct... the vector or
> rotation
> > > looks very little :
> >
> > Is this vector _of_ rotation? Where is this vector coming from?
> >
> >
> > >
> > > vec : 2.71051e-020, -2.71051e-020, 1.0842e-019
> > >
> > > Sometimes it is 0 0 0...
> > >
> > > Do I have to get the vector, normalize it and set it to the quat
> > ? or is
> > > the vector lenght important ?
> >
> > Normalising 0 0 0 (or something close to it) is bound to give you
> > headaches. What do you want to use the vector for?
> >
> > Please provide more context.
> >
> > jp
> >
> > >
> > > thanks,
> > >
> > > regards,
> > > Vincent
> > >
> > >
> > >
> >
> ------------------------------------------------------------------------
> > >
> > > _______________________________________________
> > > osg-users mailing list
> > > [email protected]
>
> > <mailto:[email protected]>
>
> > >
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> > --
> > This message is subject to the CSIR's copyright terms and
> > conditions, e-mail legal notice, and implemented Open Document
> > Format (ODF) standard.
> > The full disclaimer details can be found at
> > http://www.csir.co.za/disclaimer.html.
> >
> > This message has been scanned for viruses and dangerous content by
> > MailScanner,
> > and is believed to be clean. MailScanner thanks Transtec Computers
> > for their support.
> >
> > _______________________________________________
> > osg-users mailing list
> > [email protected]
>
> > <mailto:[email protected]>
>
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > osg-users mailing list
> > [email protected]
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
> --
> This message is subject to the CSIR's copyright terms and conditions,
> e-mail legal notice, and implemented Open Document Format (ODF) standard.
> The full disclaimer details can be found at
> http://www.csir.co.za/disclaimer.html.
>
> This message has been scanned for viruses and dangerous content by
> MailScanner,
> and is believed to be clean. MailScanner thanks Transtec Computers for
> their support.
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org