Hi Frans,
What you need to use is (from include/osg/Quat):
/** Make a rotation Quat which will rotate vec1 to vec2.
Generally take a dot product to get the angle between these
and then use a cross product to get the rotation axis
Watch out for the two special cases when the vectors
are co-incident or opposite in direction.*/
void makeRotate( const Vec3f& vec1, const Vec3f& vec2 );
vec1 will be the (0,0,1) vector, vec2 will be the new axis.
Robert.
On 1/28/07, Frans Fürst <[EMAIL PROTECTED]> wrote:
Hi all,
I know it's no dedicated OSG-question I have but I'm looking for the easiest
OSG-solution, so perhaps you can forgive me..
And I think it's very simple question too - I'm just not into quaternions
I'm afraid..
I want to draw a cylinder between given points osg::Vec3 p1, p2. By default
an osg::Cylinder points to ( 0, 0, 1 ) and I want to rotate it using
osg::PositionAttitudeTransform::setAttitude(
osg::Quaternion & );
The solution I'm using is based on 4x4 matrix-rotation and it's very
complicated and there have to be many conversions between matrices and
quaternions.
But what would be the most straightforward quaterion based solution?
thanks in advance
Frans
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/