Hi mukul
Do you mean circular arc (or elliptical arc)? If so, read on. I assume 2d here, but easily ported to 3d geometries.
If you already have the code to select full circle, you could modify/extend that to select a part of the circle - ie, a circular arc.
Special cases first:
If the full circle of the arc is inside the selection window, the your arc is selected. If the start or end point of the arc are inside the selection window, then the arc is selected as well.
The general case:
It’ll help a lot if you have some sort of parameterisation for the circle. Any point on the circle can be assigned a unique parameter, typically this is angle, and the full circle run from 0 to 2pi, but this could be something different, depending on how you do your bookkeeping internally. The selection of the point that correcponds to 0 is of no great importance, as long as you have one. For circular arcs, you could set the start point to be at parameter 0. In general the circular arc has start-end parameters, which correspond to the start and end point.
Find the intersections between the selection window and the full circle. In general these would be either 0, 1, 2, 3, 4. 1 means you only have a touching point, 2 means you have 2 clear intersections (ie, the circle goes from outside the window to inside), 3 means you have 2 intersection and a touching point, and 4 means you have 4 intersections. These intersection split your full circle into segments, say Si.
Find the segments of the full circle that are inside the selection window. You must to have a point-inside-selection-window test already. The brute-force way is to get an interior point from each segment Si and do a point-inside-selection-window
test. The smart way is to do this for only one segment, say its inside. Then the next segment will be still be inside if the intersection is actually a touching, other-wise it’ll be outside.
When you have the Si that are inside the selection window, have to test if any of you arc overlaps any of the inside Si’s.
Simple, eh? (not!) I think it’ll look much simpler in math or code, the actual idea is straightfoward but looks tricky in words.
If this is a UI feature, then you shouldn’t have to worry too much about tolerances, but it helps to have a strategy to deal with those.
The same approach should help for elliptic arcs - and actually any type of curve.
I hope this gives you any idea.
Madmortigan