Plot points on an arc

1.2k Views Asked by At

I have modified this post with updated information so the problem may be more clear. Because the answer provided does not achieve the results intended, maybe adjusting the content will help adjust the answer...thanks.

I'm writing an application, but will leave out as much code as I can.

I am making radial corners for a rectangle. The size of the corner is equal on each corner in both width and height (25 pixels). For this question I will be referencing the top right corner.

The corners are made in an arc shape, but have to be made with triangles that are connected on one point. Think about 1/4 of a pizza that is cut into (n) pieces. Where the crust connects makes a point, the tips of the slices connect to the center.

I have the center of a $90$ degree angle at $(0, 25)$. My radius is $25$, so my top point is $(x0, y0)$, and my right point is $(x25, y25)$. I have $(n3)$ points going between the top $(0, 0)$ and right $(25, 25)$.

I would like to plot equally spaced points(n) along an arc going between the top and right along a circular arc. The number of points can change, so I would like a method to calculate any number of points along this arc.

What exactly would I do to each of the $(x, y)$ points to increment along the curve?

The first answer provided gives me a good equation to start with, but with it I am uncertain what to start (x, y) out at, if it is the center of the corner at (0, 25), or if I am starting at the top position (0, 0), then increment the (x, y) provided by the equation?

So I am setting my center point (0, 25), then setting my top point (0, 0). With the equation I am doing the following:

For $k$ = $0$ To $points$ - $1$

$t$ = ($k$ / ($points$ - $1$)) * ($PI$ / $2$)

$x$ = $x$ + $radius$ * $Cos(t)$ $y$ = $y$ + $radius$ * $Sin(t)$

After that I am setting my right point (25, 25).

Arc example


Edit on behalf of Recoil

I cannot make comments yet. For Ihf:

Plot the points $(x+Rcos(t),y+Rsin(t))$ where $t=kn−1π2$ for $k=0,\cdots,n−1$

Rcos(t) - does that mean the radius * cos(t)?

Final solution for anyone else who comes across this post:

Please leave answer as is in code block, as this pertained to programming maths.

For i = 0 To points - 1

cx = 0 = center x axis of the arc
cy = 25 = center y axis of the arc
x = 0
y = 0
t = (PI / 2) * (i / points - 1)

x = cx + Cos(t) * (radius)
y = cy + Sin(t) * (radius)

new point along arc = (x, y)

The answer provided got me so close...thanks so much!

1

There are 1 best solutions below

4
On BEST ANSWER

Plot the points $(x+R\cos(t), y+R\sin(t))$ where $t=\dfrac{k}{n-1}\dfrac{\pi}{2}$ for $k=0,\dots,n-1$.