Jump to content
• Advertisement

# triangle cylinder intersection test

This topic is 3557 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

hi I want to find a cylinder and triangle intersection. I only need are they intersected.It must be very fast. I have start and finish points of cylinder's axis and cylinder's radius is always 1.and I have triangle's 3 points.Thanks for helps.

#### Share this post

##### Share on other sites
Advertisement
I'll venture a solution, but Cylinders are known to be problematic.

This is just speculation though, I'm not sure if this would work, but I dont see why not. And it would be straight forward to implement and test. Ok, so here goes...

cylinder (A, B, r)triangle (V0, V1, V2)1) find closest point from triangle and segment [AB] :-----------------------------------------------------    . find closest point on triangle from infinite line (AB).    . if point in the segment boundaries of [AB], use it.    . if point before A :         -> find closest on triangle from A, and use it.    . if point after B :         -> find closest on triangle from B, and use it.2) check if closest point is in cylinder :------------------------------------------    . well, just a point in cylinder check, easy.

Note that going through the steps, you could optimise it relatively by quite a lot (instead of writing each step as a function).

EDIT : Ignore all that. It's a bit more complicated.

[Edited by - oliii on January 19, 2009 5:10:49 AM]

#### Share this post

##### Share on other sites
Thanks for your help but I couldn't find the closest point between infinity line
and triangle if you can help me about it too, I will be very glad to you.

#### Share this post

##### Share on other sites
it's actually more complicated, as there could be an infinite number of points closest to the triangle (if the infinite line is parallel to the triangle).

so theoretically, you would have to find the segment / point on the triangle the closest to the line / segment.

I suppose using an iterative solution (GJK / MPR) would work better. MPR probably the easiest, it stands for Minkowsky Portal Refinement and works through support functions like GJK.

Molly Rocket, XenoCollide developped and used the MPR. It is quite a (relatively) simple algorithm. I cant give you the code right now, I suppose I'd have to write a demo, something I'm keen on.

#### Share this post

##### Share on other sites
if you need something quick, I can give you a moving sphere algorithm, which can be converted to a capsule test (basically a cylinder with rounded ends).

http://members.gamedev.net/oliii/satpost/3DSpherePolygonCollision.cpp

#### Share this post

##### Share on other sites
Do you have the link for information? It will be very useful for me.
Thanks for helps.

#### Share this post

##### Share on other sites
the MPR is in Game Programming Gems 7 (the MollyRocket chapter).

I suppose you can give this a shot though.

http://jgt.akpeters.com/papers/KarabassiEtAl99/collision.html

as you can see the cylinder test is NASTY.

a blob is basically a capsule test. They seem to use a capsule test, and then constrain the test to cylinder caps.

#### Share this post

##### Share on other sites
Thank you for link.I want to know a triangle's closest point is one of its angle or on one
of its line segments.And it can be parallel like your told.I learnt find the closest point
between line and point.But I don't have any idea for find the closest point when its parallel.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
3. 3
4. 4
Rutin
19
5. 5
• Advertisement

• 14
• 14
• 9
• 9
• 9
• ### Forum Statistics

• Total Topics
632927
• Total Posts
3009251
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!