We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I have the following piece of code in my draw function. I want the line segments all to point towards the centre of the circle they create, rather than pointing directly downwards.
I've only been able to make the lines all rotate to the same degree. So, can someone explain how to make each line rotate +6 degrees each time? Thank you.
for(int i = 0; i < 60; i++ ) {
float xPos = 230 * sin(TWO_PI/60 * i);
float yPos = 230 * cos(TWO_PI/60 * i);
line(clockPos + xPos, clockPos + yPos, clockPos + xPos, clockPos + yPos + 10);
}
Answers
It's easier if the two points have the same angle but different radii.
Post a complete, working example. To fix it in a code snippet, I'd have to guess at and write everything else you didn't post just to see what's going wrong, and do all that before I can even think about what's wrong and how to fix it. Effort required? No help for you.
To fix it in a complete, working example, I can run it, see what is wrong, and then make the change needed. Easy. Enjoy being helped.
Always post working examples from now on.
Here's the rest.
like i said, same angle, two different radii.
Thanks, I actually ended up doing this: