Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] 2D segment-circle intersection?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] 2D segment-circle intersection?


Chronological Thread 
  • From: Malcolm Ryan <>
  • To:
  • Subject: Re: [cgal-discuss] 2D segment-circle intersection?
  • Date: Tue, 30 Jan 2007 10:55:24 +1100


On 29/01/2007, at 3:43 PM, Malcolm Ryan wrote:


else
construct a line perpendicular to the segment, passing through the centre of the circle
if (source and target are on the same side of this line) return 0 solutions
else if (d == radius) return 1
else return 2 solutions.

This should all be doable with existing predicates in the 2d kernel, except for the construction of the perpendicular line in the fourth line from the bottom. I can't see any easy way to avoid that, without resorting to algebra.

Aha. It can be replaced with an angle() test which sees if the angle given by (source, target, centre) is obtuse (no solutions) or acute (1 or 2 solutions).

Actually you need to check that both angle(s,t,c) and angle(t,s,c) are acute.

I'd code this up as part of the library, but I don't grok C++ very well, and all the template stuff CGAL uses scares me.

Malcolm

"Cleanliness is not next to godliness nowadays,
for cleanliness is made an essential
and godliness is regarded as an offence.
- G.K.Chesterton, On Lying in Bed






Archive powered by MHonArc 2.6.16.

Top of Page