Hi, why don't you use the Ellipse2D classes ?

Il you can't use these classes, you should take a look at this page :

http://www.whizkidtech.redprince.net/bezier/circle/

The following picture illustrates the solution to draw the quadrant AB :




A = (0,R) ; B = (R,0) ; A' = (R*kappa,R) ; B' = (R,R*kappa)
kappa = 0.5522847498

if you want to draw the circle with center (x,y) and radius R with GeneralPath, it gives :

GeneralPath circle = new GeneralPath();

// First quadrant
circle.moveTo(x, y-R); // move to A
circle.curveTo(x+R*kappa, y-R, x+R, y-R*kappa, x+R, y);Â //Â curve to A', B', B

// Second
circle.curveTo(x+R, y+R*kappa, x+R*kappa, y+R, x, y+R );

// Third
circle.curveTo(x-R*kappa, y+R, x-R, y+R*kappa, x-R, y);

// Last
circle.curveTo(x-R, y-R*kappa, x-R*kappa, y-R, x, y-R );

// Ensure closeness of the circle
circle.closePath;


Jérôme Thièvre


[EMAIL PROTECTED] a écrit :
Hi everyone!

  I have to create a circle or a sector using GeneralPath. This class has two methods for draw it: curveTo an quadTo. My problem is that i don´t know how to calculate the controls points. I read some about Bezier curve, but i don´t undertand it very well.

    thanks in advance.
[Message sent by forum member 'fordfarline' (fordfarline)]

http://forums.java.net/jive/thread.jspa?messageID=170756

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

  

=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to