2

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!

  • can you upload diagram – user5954246 May 17 '16 at 15:46
  • Hmm, that should not have been an edit, but did not seem like an unreasonable comment from user Recoil. – mathreadler May 17 '16 at 17:09
  • Yes, $R\cos(t)$ means $R$ times $\cos(t)$. – lhf May 17 '16 at 17:26
  • You have indicated that you have split accounts. Go to the [contact us] link at the bottom of the page, select the reason I need to merge user profiles, and submit. Then your two accounts can be merged. – davidlowryduda May 17 '16 at 18:37
  • Okay, I have merged my accounts, sorry about the confusion. I have modified the original post because I do not think it was clear enough. I am not saying the answer is wrong, but it is not providing the desired result. I hope by modifying the question with an explanation, the answer can be modified. – Nicholas May 17 '16 at 19:07

1 Answers1

2

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$.

lhf
  • 216,483
  • Thank you for this. I modified the original post so maybe it will be more clear. I wanted to see if this is still applicable since I clarified my post, because I am not able to get the correct results when I calculate the vertices. Thanks. – Nicholas May 17 '16 at 19:10
  • If your cos and sin functions accept degrees instead of radians, change $\pi/2$ to $90.0$. – lhf May 17 '16 at 19:27
  • It took me several hours of tinkering with this, but your original solution with pi/2 got me so close. I had to additionally add the center point to each new (x, y) coordinate set. Please see final solution on bottom. I did bump up rep, but it will not be displayed until I have 15 rep in this forum. Thanks so much for your help! – Nicholas May 18 '16 at 02:35
  • @Nicholas, I should have said that $(x,y)$ in my answer is the center of the circle. I'm glad you've figured it out. – lhf May 18 '16 at 02:38