How to draw a circluar arc of given radius say 20 passing from two Given points. I have seen the function Arc2D.Float but can figure out how to find the required parameters for the contructor and also for QuadCurve2D cant figure out the control point.

Recommended Answers

All 3 Replies

to see the parameters required use javap command with the class file whose method u r looking for......

for this particular problem see the link
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/geom/Arc2D.Float.html

I now what I have to enter to draw an Arc using Arc2D.Float. But I dont know how to calculate those paramemters. It asks for the upper left corner of the ellipse, width and height and the start and extent of arc. I only know its a circular arc therefore it will same width and height as diameter of arc required but I dont know how to calulate the upper left corner of ellipse and start and extent of arc. For this I will probally require the center of the circle whose part is this arc. But I dont know how to do this.

as far as i know, the arc will be drawn in a rectangle in which u will have to give the starting coordinates(x and y,according to the link given in previous post) of the rectangle,its height(height) ,width(width), the starting angle(starting) and the ending angle(extent) of the arc.

i think all rest u will make out(coordinates ,height ,width) if problem in angle
then take an example,say,u want to draw a semicircle(upper)
then the statting angle will be 0 and the ending angle(or extent in java terms) will be 180

note that the arc will be formed in anticlockwise direction

so in this the arc will start from 0 degree and will go in anticlock direction and trace a 180 degree angle.....and here u go arc is formed...

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.