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

Click For Summary
The discussion focuses on creating a PHP program to generate coordinates for circles to be imported into AutoCAD. The user currently uses a formula involving cosine and sine to calculate X and Y coordinates based on an angle and radius, but struggles to create concentric circles with varying radii from a common center point. The main issue arises from using a common start point instead of a center point for the circles. Suggestions include allowing the radius to be a variable and ensuring the offset represents the center's coordinates. The user seeks clarification on the correct logic to achieve this in their code.
Dazz
Messages
2
Reaction score
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
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.
 
Hmm... i see. Well if it's not the maths (phew) then autocad layers must be screwing with me.

Thanks for your time.
 
Good morning I have been refreshing my memory about Leibniz differentiation of integrals and found some useful videos from digital-university.org on YouTube. Although the audio quality is poor and the speaker proceeds a bit slowly, the explanations and processes are clear. However, it seems that one video in the Leibniz rule series is missing. While the videos are still present on YouTube, the referring website no longer exists but is preserved on the internet archive...

Similar threads

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 4 ·
Replies
4
Views
5K
Replies
1
Views
577
  • · Replies 20 ·
Replies
20
Views
4K