Newbie: Frustum to Frustum intersection test

Please don't post Bullet support questions here, use the above forums instead.
supermarioitsme
Posts: 2
Joined: Mon Jan 17, 2011 10:18 am

Newbie: Frustum to Frustum intersection test

Post by supermarioitsme »

Hi all. I'm newbie in Bullet. I want to use this library for frustum to frustum intersection test.

Please, suggest me where i should start. I have already read Bullet_User_Manual.pdf up to 7 article, made some experiments in code, but still don't understand how use library for my specific purpose. I have set of points that represents two frustum shapes. All what i need is to know whether frustums are intersects.

Thanks for you time.
supermarioitsme
Posts: 2
Joined: Mon Jan 17, 2011 10:18 am

Re: Newbie: Frustum to Frustum intersection test

Post by supermarioitsme »

Hi Again,

it seems i have found appropriative functionality for my goals in Bullet. Note, I use BulletSharp .net wrapper for SlimDX.

Code: Select all

public bool IntersectionTest()
{
            Vector3 c11 = new Vector(0, 0, 0);
            Vector3 c12 = new Vector(10, 10, 10);

            Vector3 c21 = new Vector(5, 5, 5);
            Vector3 c22 = new Vector(15, 15, 15);

            ConvexTriangleMeshShape c1 = CreateShape(c11, c12);
            ConvexTriangleMeshShape c2 = CreateShape(c21, c22);

            DebugDraw debugDraw = new DebugDraw { DebugMode = DebugDrawModes.NoDebug };
            DiscreteCollisionDetectorInterface.ClosestPointInput closestPointInput = new DiscreteCollisionDetectorInterface.ClosestPointInput
            {
                TransformA = Matrix.Identity,
                TransformB = Matrix.Identity
            };
            PointCollector result = new PointCollector();

            GjkPairDetector gjkPairDetector = new GjkPairDetector(c1, c2, new VoronoiSimplexSolver(), new MinkowskiPenetrationDepthSolver());
            gjkPairDetector.GetClosestPointsNonVirtual(closestPointInput, result, debugDraw);

            return result.Distance < 0;
}
If anyone has some suggestions or remarks, please post..