3 Replies - 76431 Views - Last Post: 19 September 2006 - 09:50 PM Rate Topic: -----

#1 fredcs1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 19-September 06

Drawing a Circle

Posted 19 September 2006 - 06:11 PM

How does one make a circle in Java using an equation? I am new at Java, trying to teach myself but this is stumping me.
Is This A Good Question/Topic? 0
  • +

Replies To: Drawing a Circle

#2 oneminizut  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 12
  • Joined: 14-September 06

Re: Drawing a Circle

Posted 19 September 2006 - 08:28 PM

Sounds like the hard way to going about it but here is a link
circle equation

Now, to do it in an applet is very easy;


import java.awt.*;
import javax.swing.*;

public class GraphicsExample extends JApplet 
{
	
	public void paint(Graphics g)
	{
		
		// call superclass version of method paint
		super.paint( g );
		
		
		// draw oval
		g.setColor( new Color(0,0,0));
		g.drawOval(50,75,100,100);
		
	}
		
}




Was This Post Helpful? 1

#3 TexasLonestar  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 14
  • Joined: 10-August 06

Re: Drawing a Circle

Posted 19 September 2006 - 09:07 PM

You might want to look into gBuffer after you learn g, and when you start doing animations be sure to include the paint() class.
Was This Post Helpful? 0
  • +
  • -

#4 Datalus  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 235
  • Joined: 18-December 05

Re: Drawing a Circle

Posted 19 September 2006 - 09:50 PM

heres a hint:


X of a = radius*sin( theta )
Y of a= radius*cos( theta )

X of b = radius*sin( theta + delta )
X of b = radius*cos( theta + delta )
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1