trace a point on the circumference of a circle that

rotates around a point on the circumference of another circle

Page 1 of 1

6 Replies - 3240 Views - Last Post: 30 August 2009 - 08:37 PM Rate Topic: -----

#1 wartech  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 10
  • View blog
  • Posts: 203
  • Joined: 16-October 06

trace a point on the circumference of a circle that

Posted 30 August 2009 - 06:05 PM

Hello Everyone,

I am working on a problem in java where I need to trace a point on the circumference of a circle that rotates around a point on the circumference of another circle.
I started by making sure I could get a circle first but did not know how to proceed from there. I just need a clearer understanding of what is being asked.

This is what I was thinking:
1) Draw the first circle
2) Pick any point within the first circle
3) Draw all circles based on that same point

Is this the correct logic? Your help is appreciated.

Thanks,

Is This A Good Question/Topic? 0
  • +

Replies To: trace a point on the circumference of a circle that

#2 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8334
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: trace a point on the circumference of a circle that

Posted 30 August 2009 - 06:48 PM

After 159 posts you should know the rules (or you have a serious problem :) )

[rules][/rules]
Was This Post Helpful? 0
  • +
  • -

#3 wartech  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 10
  • View blog
  • Posts: 203
  • Joined: 16-October 06

Re: trace a point on the circumference of a circle that

Posted 30 August 2009 - 07:11 PM

Yeah, I am familiar with the policies. Anyhow I was trying to avoid posting code because it is a homework project. I was not clear what the question was asking. I was simply wondering if I was on the right track. Again I just don't know how to go about tracing a point on the circumference of a circle that rotates around a point on the circumference of another circle. In my first post I explained what I was thinking needed to be done. I am not asking for anyone to write the code for me. Just a clearer understanding of what is being asked. Thanks.


Here is the code for the full circle:


private static void drawCircle()
	{
		double radius = 50;
		double theta = 0;
		double radians;
		double deltaX;
		double deltaY;
		
		Display circle = new Display(350,6);
		
		for (int i = 0; i < 360; i++)
		{
			radians = toRadians(theta);
			deltaX =  radius * cos(radians);
			deltaY = radius * sin(radians);
			circle.drawNextPixel((int)(200 + radius + deltaX), (200 + (int)deltaY));
			theta++;
		}				
	}
	private static double toRadians(double theta) 
	{
		return(Math.toRadians(theta));
	}
	private static double cos(double a)
	{
		return (Math.cos(a));
	}
	private static double sin(double a)
	{
		return (Math.sin(a));
	}
//	private static double Circumference(double radius)
//	{
//		return (Math.PI * 2 * radius);
//	}



Was This Post Helpful? 0
  • +
  • -

#4 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8334
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: trace a point on the circumference of a circle that

Posted 30 August 2009 - 07:19 PM

View Postwartech, on 30 Aug, 2009 - 06:11 PM, said:

Anyhow I was trying to avoid posting code because it is a homework project.

And you are leaving in a country like Albania where posting code is illegal ?


Seriously don't you think that

radians = toRadians(theta);

should be

radians = toRadians(i);
Was This Post Helpful? 0
  • +
  • -

#5 wartech  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 10
  • View blog
  • Posts: 203
  • Joined: 16-October 06

Re: trace a point on the circumference of a circle that

Posted 30 August 2009 - 07:23 PM

You gotta be kidding me...I was just asking for some help here. Whatever man, I'll ask elsewhere.
Was This Post Helpful? 0
  • +
  • -

#6 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8334
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: trace a point on the circumference of a circle that

Posted 30 August 2009 - 07:25 PM

View Postwartech, on 30 Aug, 2009 - 06:23 PM, said:

You gotta be kidding me...I was just asking for some help here. Whatever man, I'll ask elsewhere.

I think you haven't read the second part of my reply :)
You want to check on an Albanian site ?

See how posting code fix a lot of problems

This post has been edited by pbl: 30 August 2009 - 07:29 PM

Was This Post Helpful? 1
  • +
  • -

#7 LynnL  Icon User is offline

  • D.I.C Head

Reputation: 21
  • View blog
  • Posts: 109
  • Joined: 13-April 09

Re: trace a point on the circumference of a circle that

Posted 30 August 2009 - 08:37 PM

View Postwartech, on 30 Aug, 2009 - 06:23 PM, said:

You gotta be kidding me...I was just asking for some help here. Whatever man, I'll ask elsewhere.

Any sense of humour ?
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1