Can i know the formula or way of finding a rectangle intersect with LINE,ARC,RECTANGLE and SPLINE
Regards,
ALGATES
Yes, you can.
Or maybe you can't.
I'm not being sarcastic; I'm just not aware of your capabilities.
Plus, I'm sure if you're implying a question or simply making a statement.
Do you have a specific problem that can be generalized?
A wild guess is that you have a view port (A RECTANGLE) and you want to know the clipping limit for viewing the: LINE,ARC,RECTANGLE and SPLINE.
One of you best options is to make a sketch.
A picture is worth more than a few words.
I have a sketch but am not able to attach it.
(I have no idea as how to attach or upload an image.)
There are four possible intersections that can be made from your information: the LINE (a,b)-(c,d) can intersect the two horizontal lines of the rectangle or the two vertical lines of the rectangle.
The intersection points of interest occur on the line segments of the rectangle.
With a sketch you can avoid calculations pertinent to the non interesting points.
The corners of the rectangle:
(x,y) LowerLeftCorner
(x,y+h) UpperLeftCorner
(x+w,y+h) UpperRightCorner
(x+w,y) LowerRightCorner
If the LINE (a,b)-(c,d) intersects the lower line of the rectangle:
It should be obvious that the Y coordinate is going to be y
(if it were the upper line then the Y coord would by y+h)
The X coordinate where the line will intersects the lower line of the rectanangle is:
X = a + (c-a) * (y-b) / (d-b)
The intersection point is:
( a + (c-a) * (y-b) / (d-b) , y)