Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I am programatically drawing sectors of a circle with radius 55 on a cartesian plane which runs from -55 to 55 on the x and y axes. I would like the first sector to be drawn at 0,55.

I know I can calculate the x,y values using using:

x=radius * cos(angle) 
y=radius * sin(angle)

Further, I know that I can multiply x * -1 to go in a clockwise fashion around with the remnaing sectors.

This works great however, the first sector is positioned at -55,0 on the plane.

How do I adjust these caculations so that the first sector starts at 0, 55 and subsequent sectors go around in a clockwise fashion from this point?

share|improve this question
    
Negate $y$ instead of $x$. –  Daniel Fischer Jul 3 '13 at 15:26
    
@DanielFischer if I negate y, then I can start my first sector at 55,0 in a clockwise fashion. What do I have to do to start the first sector at 0, 55 –  Art Jul 3 '13 at 15:43
1  
Ah, sorry, I didn't pay attention and thought you wanted to start at $(55,0)$. To start at $(0,55)$, swap $\sin$ and $\cos$, $x = r\cdot \sin \varphi$ and $y = r\cdot \cos \varphi$ for clockwise, negate $x$ for anti-clockwise. –  Daniel Fischer Jul 3 '13 at 15:45
    
@DanielFischer Please post this as an answer so I can assign you credit! Thank you so much! –  Art Jul 3 '13 at 15:55
add comment

1 Answer

It seems like you have incorrectly computed the offsets into your plotting area.

If the center of the area is supposed to be $(0, 0)$ and the array is 111 by 111 (2 x 55+1), when you compute $x$ and $y$, you have to be careful when you map those into your plotting area.

For example, usually $x$ goes left-to-right and $y$ goes bottom-to-top, but your array to be displayed may have its $y$ going top-to-bottom.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.