Subject: CGAL users discussion list
List archive
- From: Sylvain Pion <>
- To:
- Subject: Re: [cgal-discuss] Point/ Circle/ Segment
- Date: Wed, 12 Nov 2008 22:09:34 +0100
Pedro Machado Manhães de Castro a écrit :
The answer is no.
No, the answer to the first question is yes. RTFM:
http://www.cgal.org/Manual/3.3/doc_html/cgal_manual/Kernel_23_ref/Class_Circle_2.html
As for the relative position of a segment wrt a circle, there are more cases
to
distinguish, and you may need to do something along the lines of what Pedro
suggests.
See squared_distance(), between the center and the segment and/or the
endpoints
or the supporting line.
http://www.cgal.org/Manual/3.3/doc_html/cgal_manual/Kernel_23_ref/Function_squared_distance.html
However:
You could do that by:
Check whether the supporting line of your segment and the circle intersect (with do_intersect). If it does not intersect, then the segment is completely outside or inside the circle (if it does interest you, you can find which of those two cases are applied by checking whether one end point is inside the circle or not). Otherwise, you check whether the squared_distance between the center and the supporting line is equal to the squared_radius of the circle or not. If yes, then you project the center onto the supporting line of the segment and check if the segment contains that point (with Has_on_2) (I am assuming that a 'tangent segment' is the one such that its supporting line is tangent to the circle + the segment intersects the circle). And now, if the distance is not equal to the radius, check whether both end points of the segment are outside/on the circle or not (so you are able to decide whether it divides or not the circle).
Search the manual index for Has_on_2, Do_intersect_2, Has_on_bounded_side_2, Intersect_2 and squared_distance.
Cheers,
Pedro Machado
On Wed, Nov 12, 2008 at 8:22 PM, Emerson Carride < <mailto:>> wrote:
In CGAL has a function that returns if a given point is inside or
outside or in boundary of a circle.
I want to know if CGAL has a function that returns if a given
segment is tangent to a circle or divided the circle into two parts?
-- Emerson Amade Carride
Matemática Aplicada e Computação Científica
Instituto de Ciências Matemáticas e Computação
USP - São Carlos
tel: (16) 3411 0877; (11) 4538 3315 ; cel: (11) 71289888
--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/
- [cgal-discuss] Point/ Circle/ Segment, Emerson Carride, 11/12/2008
- Re: [cgal-discuss] Point/ Circle/ Segment, Pedro Machado Manhães de Castro, 11/12/2008
- Re: [cgal-discuss] Point/ Circle/ Segment, Sylvain Pion, 11/12/2008
- Re: [cgal-discuss] Point/ Circle/ Segment, Pedro Machado Manhães de Castro, 11/12/2008
- Re: [cgal-discuss] Point/ Circle/ Segment, Sylvain Pion, 11/12/2008
- Re: [cgal-discuss] Point/ Circle/ Segment, Pedro Machado Manhães de Castro, 11/12/2008
Archive powered by MHonArc 2.6.16.