[osg-users] Getting world coord bounding box
Siddharth Palaniappan
siddharth_univ at yahoo.com
Sat Dec 1 11:56:27 PST 2007
Hi daniel,
Yes thats a good idea..I will definitely try that and let you know how it works out. Thank you.
Siddharth
----- Original Message ----
From: Daniel Holz <danielh at cm-labs.com>
To: OpenSceneGraph Users <osg-users at lists.openscenegraph.org>
Sent: Saturday, December 1, 2007 2:50:11 PM
Subject: Re: [osg-users] Getting world coord bounding box
hi siddharth,
i just started being confused reading the link you sent me when i got
this new email of yours :)
if i am in a situation like this what i usually do is i draw what i
can't see. in your case it is the bounding box PRIOR to your
transformation to world coordinates and the one AFTER transforming.
just
render to boxes or render spheres in two different colors marking the
positions of the corners.
i am sure, having something visually, you will be able to figure out
the
problem.
cheers,
daniel
Siddharth Palaniappan wrote:
> Hi Daniel,
>
> Sorry for the misunderstanding...yes you're right, it has to be done
on the left side. But i still dont get any valid results. Can you
suggest how i can test if the world coordinates of the box after
multiplication is correct or not?
>
> Thank you,
>
> Siddharth
>
> ----- Original Message ----
> From: Siddharth Palaniappan <siddharth_univ at yahoo.com>
> To: OpenSceneGraph Users <osg-users at lists.openscenegraph.org>
> Sent: Saturday, December 1, 2007 2:41:19 PM
> Subject: Re: [osg-users] Getting world coord bounding box
>
>
> Hi daniel,
>
> I read thru this at the osg site :
>
>
http://www.openscenegraph.org/projects/osg/wiki/Support/Maths/MatrixTransformations
>
> In the end , robert says ways are defined ... i initially multiplied
> the matrix on the left side. But after reading this i changed
it...am i
> wrong ?
>
> Siddharth
>
> ----- Original Message ----
> From: Daniel Holz <danielh at cm-labs.com>
> To: OpenSceneGraph Users <osg-users at lists.openscenegraph.org>
> Sent: Saturday, December 1, 2007 2:35:52 PM
> Subject: Re: [osg-users] Getting world coord bounding box
>
>
> hi,
>
> don't you have to multiply the matrix from the left side with the
> vector, like this:
> M * x = x',
> whereas M is your 'WorldCoordsMatrix', x is your local BBox vector
and
> x' is the same in world coords.
>
> hope this helps.
>
> daniel
>
> Siddharth Palaniappan wrote:
>
>> Hi osg users,
>>
>> I'm currently using openscenegraph for my class project to simulate
>>
> traffic. I have a problem in that , i need to find collision
detection
> between consecutive cars and stop the car if there is a collision.
I
> have followed the osgExample- for animation. I have used an
> animationpath and animationpathcallback and i have implemented my
own
> spline
> interpolation for the car to traverse on a spline. I tried to get
the
> world
> coordinate of the bounding box like this..
>
>> * i have a class Vehicle that stores the node to which an openflight
>>
> model is read into.
>
>> * the leaf node is the node having the vehicle, the parent node of
>>
> this node is a transformation node which has an
animationpathcallback
> set
> to, and this also has a parent node to initially set the location
and
> orientation, (just like in the osgExample animation).
>
>> * i have a node visitor that traverses parents..so it goes from the
>>
> current node to the root concatenating all the world coordinates.
>
>> * then i get the local bounding box of the node and get the minimum
>>
> and maximum and multiply the world coord matrix with these points to
> form a new min and max point and create a new bounding box. I do
this
> for
> every two node to check the intersection of two consecutive nodes.
>
>> //getWorldCoords() - forwards to a nodevisitor to get world
>>
> coords matrix.
>
>> osg::Matrixd* WorldCoordsMatrix =
getWorldCoords(this->m_Vehicle)
>>
> ;
>
>> osg::BoundingBox VehicleBBox ;
>>
>> VehicleBBox.expandBy(m_Vehicle->getBound()) ;
>>
>> //Convert the vehicle local coords to world coordinates.
>> osg::Vec3f MinPt(VehicleBBox.xMin() , VehicleBBox.yMin() ,
>>
> VehicleBBox.zMin()) ;
>
>> osg::Vec3f MaxPt(VehicleBBox.xMax() , VehicleBBox.yMax() ,
>>
> VehicleBBox.zMax()) ;
>
>> osg::Vec3f NewMinPt , NewMaxPt ;
>> NewMinPt = MinPt * (*WorldCoordsMatrix) ;
>> NewMaxPt = MaxPt * (*WorldCoordsMatrix) ;
>>
>> this->m_VehicleBoundingBox = new osg::BoundingBox(NewMinPt ,
>>
> NewMaxPt) ;
>
>> I am not getting correct results. I get that the bounding boxes dont
>>
> intersect at all or sometimes intersect at odd places. Please let me
> know if i'm doing something stupid or if i my understanding of
> anything
> wrong.
>
>> Thank you,
>>
>> Yours Sincerely,
>>
>> Siddharth
>>
>>
>>
>>
>>
>>
>>
>>
>
>
____________________________________________________________________________________
>
>> Never miss a thing. Make Yahoo your home page.
>> http://www.yahoo.com/r/hs
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>>
>>
>
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>>
>>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
>
>
>
>
>
____________________________________________________________________________________
> Never miss a thing. Make Yahoo your home page.
> http://www.yahoo.com/r/hs
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
>
>
>
>
____________________________________________________________________________________
> Be a better pen pal.
> Text or chat with friends inside Yahoo! Mail. See how.
http://overview.mail.yahoo.com/
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
____________________________________________________________________________________
Get easy, one-click access to your favorites.
Make Yahoo! your homepage.
http://www.yahoo.com/r/hs
More information about the osg-users
mailing list