Jump to content
  • Advertisement
Sign in to follow this  
EVIL_ENT

Cut triangle with circle

This topic is 2589 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

I've got a triangle (black) and a circle-shaped n-gon (red).

Question:
How do I get the triangles covering the yellow area?

I tried calculating the triangle-circle-intersections to do something with them but then I noticed that there might be cases with no intersections at all.

[attachment=6090:trianglesWithCircles.gif]

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure, but from looking at your picture I think a good place to start would be:

  • For every edge of the triangle, intersect the n-gon for the first vertex to the second vertex and the other way around. If there's an intersection and the intersection point does not overlap with an existing vertex of the n-gon, add the intersection point to the n-gon.
  • For every edge of the n-gon that lies within the triangle, look for a triangle vertex that makes up a non-intersecting triangle.
  • For every edge of the triangle that does not intersect with the n-gon, look for a n-gon vertex that makes up a non-intersecting triangle.
    Let me know if you find a flaw in there :lol:.

Share this post


Link to post
Share on other sites

I've got a triangle (black) and a circle-shaped n-gon (red).

Question:
How do I get the triangles covering the yellow area?

I tried calculating the triangle-circle-intersections to do something with them but then I noticed that there might be cases with no intersections at all.

[attachment=6090:trianglesWithCircles.gif]


I don't have any experience with this kind of problem myself, but perhaps this article will point you in the right direction.

-Josh

Share this post


Link to post
Share on other sites

I don't have any experience with this kind of problem myself, but perhaps this article will point you in the right direction.

-Josh


perfect key word
thanks :D


Let me know if you find a flaw in there :lol:.


I'll try this first and if it does not work for some reason I'll head on to csg

Share this post


Link to post
Share on other sites

I'll try this first and if it does not work for some reason I'll head on to csg

Great, please let us know if it worked or not. Just to clarify my first post, the order of the list is of importance and when I say non-intersecting triangle I also mean not intersecting with previously generated triangles.

Share this post


Link to post
Share on other sites
You'll probably want to focus your search more towards Boolean operations than CSG. CSG is a rendering algorithm that can be accomplished without any actual geometry, like in the 3D modeler POV-Ray. Boolean operations can generate an object that can be rendered as a CSG object, but not necessarily the other way around.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!