POV-Ray : Newsgroups : povray.off-topic : Bounding circle intersection : Re: Bounding circle intersection Server Time
5 Sep 2024 01:25:10 EDT (-0400)
  Re: Bounding circle intersection  
From: Slime
Date: 11 Dec 2009 05:45:53
Message: <4b2222e1$1@news.povray.org>
> So let me understand this, you are constructing two circles, one around 
> the line and one around the triangle, then seeing the circles intersect, 
> and if they do proceeding to check if the line actually intersects the 
> triangle?

Well, the one around the triangle is precomputed. Otherwise, yes.

> Wouldn't it be faster to just directly check the line against the 
> triangle?

Honestly, I don't know. I'm not sure my code for the triangle-line check is 
very good. =)

As far as I can tell, to check for an intersection between a triangle and a 
line segment, you need to check that one of the triangle's vertices is on an 
opposite side of the line from the other two, and then check that both of 
the line segment's endpoints are on opposite sides of at least one of the 
triangle's edges, or that both of them are inside the triangle.

I did most of these checks with cross products, and then found I had some 
precision problems in some cases, and the code got more complicated when I 
tried to avoid them. Since intersections are rare, I figured a bounding 
check would be the easiest way to improve performance.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.