# Point/ Circle/ Segment

4 messages
Open this post in threaded view
|

## Point/ Circle/ Segment

 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 CarrideMatemática Aplicada e Computação CientíficaInstituto de Ciências Matemáticas e ComputaçãoUSP - São Carlostel: (16) 3411 0877; (11) 4538 3315 ; cel: (11) 71289888
Open this post in threaded view
|

## Re: Point/ Circle/ Segment

 Hi,The answer is no.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 MachadoOn Wed, Nov 12, 2008 at 8:22 PM, Emerson Carride 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 CarrideMatemática Aplicada e Computação CientíficaInstituto de Ciências Matemáticas e ComputaçãoUSP - São Carlostel: (16) 3411 0877; (11) 4538 3315 ; cel: (11) 71289888