I have drawn a cirlce and 2 line which intersects the circle using 2D Graphics. Now I want to draw an arc between the intersection point.
The attached pic can show very clearly wht i want. The black portion is drawn. The red part is to be drawn. The radius of arc can vary. But it need to cut the circle at the same point where the line intersects the circle

I have drawn a cirlce and 2 line which intersects the circle using 2D Graphics. Now I want to draw an arc between the intersection point.
The attached pic can show very clearly wht i want. The black portion is drawn. The red part is to be drawn. The radius of arc can vary. But it need to cut the circle at the same point where the line intersects the circle

You can use QuadCurve2D to accomplish the task.It takes two end points as input and a control point for deviation.

The syntax is as follows :

Graphics2D g;
QuadCurve2D.Double l = new QuadCurve2D.Double(x0,y0,x1,y1,x2,y2);
g.draw(l);

x0,y0 is the first point where line intersects circle and x3,y3 is the other point of line intersection.

x2,y2 is the control point that causes deviation.

You can use QuadCurve2D to accomplish the task.It takes two end points as input and a control point for deviation.

The syntax is as follows :

Graphics2D g;
QuadCurve2D.Double l = new QuadCurve2D.Double(x0,y0,x1,y1,x2,y2);
g.draw(l);

x0,y0 is the first point where line intersects circle and x3,y3 is the other point of line intersection.

x2,y2 is the control point that causes deviation.

How do I calculate the control point. I have been given whats the radius of arc. Also do I have perform all the mathematics to calculate the equation of circle and line then find out their intersection point by solving out the quadratic or is there any other way to get the intersection points.The circle is not centered at origin so its gonna be huge calculation otherwise.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.