Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Function "btQuantizedBvh::walkStacklessTreeAgainstRay"
PostPosted: Tue Dec 22, 2009 2:00 am 
Offline

Joined: Wed Jun 10, 2009 4:01 am
Posts: 79
When I read this function I got my selfconfused in the code line;
Quote:
bounds[0] = rootNode->m_aabbMinOrg;
bounds[1] = rootNode->m_aabbMaxOrg;
/* Add box cast extents */
bounds[0] += aabbMin;
bounds[1] += aabbMax;

I think it should be like this:
bounds[0] = rootNode->m_aabbMinOrg;
bounds[1] = rootNode->m_aabbMaxOrg;
/* Add box cast extents */
bounds[0] -= aabbMax;
bounds[1] -= aabbMin;
Or did I miss something,
[img]I%20attach%20a%20png%20file%20to%20show%20this:[/img]


Attachments:
expand.PNG
expand.PNG [ 1.76 KiB | Viewed 150 times ]
Top
 Profile  
 
 Post subject: Re: Function "btQuantizedBvh::walkStacklessTreeAgainstRay"
PostPosted: Tue Dec 22, 2009 2:29 am 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3126
Location: California, USA
Those extends are around the origin, so for a convex cast, aabbMin is a negative value and aabbMax is a positive value, so both need to be added to the current extents.
(for a ray test both values are zero)

Thanks,
Erwin


Top
 Profile  
 
 Post subject: Re: Function "btQuantizedBvh::walkStacklessTreeAgainstRay"
PostPosted: Tue Dec 22, 2009 3:15 am 
Offline

Joined: Wed Jun 10, 2009 4:01 am
Posts: 79
Hi Erwin:
I know we need to add extension to the original node aabb bound ,but take a look at my picture,I think the right formula should be :
bounds[0] -= aabbMax;(left bottom )
bounds[1] -= aabbMin;(right top)


Top
 Profile  
 
 Post subject: Re: Function "btQuantizedBvh::walkStacklessTreeAgainstRay"
PostPosted: Tue Dec 22, 2009 5:36 am 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3126
Location: California, USA
Say we have a box cast from A to B, see picture, with the green arrow the 'aabbMin' and red arrow 'aabbMax'.

Attachment:
s6iCr-mGulvtVIuJahrRQxw_42.png
s6iCr-mGulvtVIuJahrRQxw_42.png [ 7.05 KiB | Viewed 140 times ]


We need the AABB that bounds the swept volume, so we have to add the 'green' arrow to the A and red to B.
Thanks,
Erwin


Top
 Profile  
 
 Post subject: Re: Function "btQuantizedBvh::walkStacklessTreeAgainstRay"
PostPosted: Tue Dec 22, 2009 6:42 am 
Offline

Joined: Wed Jun 10, 2009 4:01 am
Posts: 79
Thanks a lot Erwin, but ...somehow ,what I mean is not the box bound the swept volumn of the convex , but the Box bound the node in the AABB tree , It seems that before perform a ray-AABB intersect :
Quote:
rayBoxOverlap = aabbOverlap ? btRayAabb2 (raySource, rayDirectionInverse, sign, bounds, param, 0.0f, lambda_max) : false;

the bullet will expands the AABB Node's bound box using the code
Quote:
bounds[0] = rootNode->m_aabbMinOrg;
bounds[1] = rootNode->m_aabbMaxOrg;
/* Add box cast extents */
bounds[0] += aabbMin;
bounds[1] += aabbMax;

But I think the code shoud be:
bounds[0] = rootNode->m_aabbMinOrg;
bounds[1] = rootNode->m_aabbMaxOrg;
/* Add box cast extents */
bounds[0] -= aabbMax;
bounds[1] -= aabbMin;
As showed in my picture.
So I agree with the swept volumn box calculation of the convex box ,but I am not agree with the calculation of the box of the AABB Node(which is used to perform a ray test)


Top
 Profile  
 
 Post subject: Re: Function "btQuantizedBvh::walkStacklessTreeAgainstRay"
PostPosted: Tue Dec 22, 2009 7:13 pm 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3126
Location: California, USA
You are right, there seems to be a problem.

I'll look into it further, and filed an issue here: http://code.google.com/p/bullet/issues/detail?id=322

Thanks for the report!
Erwin


Top
 Profile  
 
 Post subject: Re: Function "btQuantizedBvh::walkStacklessTreeAgainstRay"
PostPosted: Tue Dec 22, 2009 9:22 pm 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3126
Location: California, USA
Issue has been fixed in latest trunk.

A reproduction case that show previous failure is attached to this closed issue:
http://code.google.com/p/bullet/issues/detail?id=322

Thanks a lot for the report and fix!
Erwin


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: MSN [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group