Plot xy, coords to create a circle with centrepoint and radius

In summary, The conversation discusses the poster's background in math and their current project of creating a PHP program to output coordinates for a circle in Autocad. They are having trouble shortening the radius for a second circle and are seeking assistance with the logic for plotting a circle using a center point.
  • #1
Dazz
2
0
Hey all,

I posted this in a thread with similar discussions but thought to make a new one. Skip to the last two sections if you're in a rush :)

About me
------------
I did maths in high school and stats in university but I can't work some (probably elementary) sin / cos / tan stuff out. I was hoping someone could assist me? Unfortunately, after years of circular neglect, my maths has fallen by the way side on this.

Setting the scene
--------------------
I am looking to write a PHP program to output coords for a circle. I intend to import these into Autocad via .scr file, initially to create the circle using the Atocad 3dpoly command, but later to modify the code to create things like 3d parallel spirals... and other interesting things Autocad doesn't like.

Current usage
----------------
The php code I have works somewhat, but not exactly how I want it. Converting the code into english... I can currently get an X coord by using the following logic (each term is described under the logic).

Offset + (r * cos(Angle * PI / 180))

Offset: A number to move my diagram into positive values in autocad
r: the radius of the circle
Angle: The angle, a value between 0 and 359
PI: the magic circle number (3.14ish)

I can also get the Y coord a similar way using sin

I use this formula, passing an angle of 0 through to 359, to create coords for a circle.

The problem
-------------
The above works fine and I can draw a circle by using the formula, increasing the angle and plotting the point.

What this doesn't do is allow me to shorten the radius for a second circle inside the first with a constant displacement. I believe it's because the technique above creates a circle using a common start point rather than a common centre point.

My Question
-------------
What logic should I use to plot a circle using a centre point so that the radius can be varied?

Thanks in advance for any help.

Darren
 
Mathematics news on Phys.org
  • #2
Dazz said:
Hey all,

I posted this in a thread with similar discussions but thought to make a new one. Skip to the last two sections if you're in a rush :)

About me
------------
I did maths in high school and stats in university but I can't work some (probably elementary) sin / cos / tan stuff out. I was hoping someone could assist me? Unfortunately, after years of circular neglect, my maths has fallen by the way side on this.

Setting the scene
--------------------
I am looking to write a PHP program to output coords for a circle. I intend to import these into Autocad via .scr file, initially to create the circle using the Atocad 3dpoly command, but later to modify the code to create things like 3d parallel spirals... and other interesting things Autocad doesn't like.

Current usage
----------------
The php code I have works somewhat, but not exactly how I want it. Converting the code into english... I can currently get an X coord by using the following logic (each term is described under the logic).

Offset + (r * cos(Angle * PI / 180))

Offset: A number to move my diagram into positive values in autocad
r: the radius of the circle
Angle: The angle, a value between 0 and 359
PI: the magic circle number (3.14ish)

I can also get the Y coord a similar way using sin

I use this formula, passing an angle of 0 through to 359, to create coords for a circle.

The problem
-------------
The above works fine and I can draw a circle by using the formula, increasing the angle and plotting the point.

What this doesn't do is allow me to shorten the radius for a second circle inside the first with a constant displacement. I believe it's because the technique above creates a circle using a common start point rather than a common centre point.

My Question
-------------
What logic should I use to plot a circle using a centre point so that the radius can be varied?

Thanks in advance for any help.

Darren
Allow r to be a variable, of course. In what you have given "Offset" is the x-coordinate of the center of the circle, r is the radius.
 
  • #3
Hmm... i see. Well if it's not the maths (phew) then autocad layers must be screwing with me.

Thanks for your time.
 

What is the formula for creating a circle with centerpoint and radius using plot xy coordinates?

The formula for creating a circle with centerpoint (h,k) and radius r using plot xy coordinates is (x-h)^2 + (y-k)^2 = r^2.

What do the variables in the formula represent?

The variable h represents the x-coordinate of the centerpoint, k represents the y-coordinate of the centerpoint, and r represents the radius of the circle.

How do I plot the points on a graph to create the circle?

To plot points on a graph to create a circle, you can use the formula (x-h)^2 + (y-k)^2 = r^2 to calculate the coordinates for each point. You can then plot these points on the graph and connect them to form the circle.

Can I use any set of coordinates to create a circle with a given centerpoint and radius?

Yes, as long as the coordinates satisfy the formula (x-h)^2 + (y-k)^2 = r^2, you can use them to create a circle with the desired centerpoint and radius. However, keep in mind that the circle may not fit within your graph or may extend beyond it.

Are there any other methods for creating a circle besides using plot xy coordinates?

Yes, in addition to using plot xy coordinates, you can also create a circle by using the equation (x-a)^2 + (y-b)^2 = c, where (a,b) represents the centerpoint and c represents the radius squared. Another method is to use the polar coordinate equation r = a + bcos(theta), where (a,b) represents the centerpoint and theta is the angle from the positive x-axis to the point on the circle.

Similar threads

Replies
1
Views
774
  • Classical Physics
Replies
16
Views
1K
  • Calculus and Beyond Homework Help
Replies
5
Views
843
Replies
4
Views
2K
Replies
20
Views
3K
  • Programming and Computer Science
Replies
3
Views
855
  • General Math
Replies
10
Views
3K
Replies
4
Views
4K
  • General Math
Replies
3
Views
2K
Replies
9
Views
1K
Back
Top