We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am trying to rotate text to shift a it a few degrees clockwise to that it protrudes from the middle section of each arc. However, any time I use the rotate function it throws it way off. Any tips on what to use. I know it's the 'rotate()' function but I'm not getting it right.
Thanks in advance :)
float delta = TWO_PI / childrenA.length;
float xPos = width/2+scaler/2*arrayDueTimes.get(i) * cos(i* delta);
float yPos = height/2+scaler/2*arrayDueTimes.get(i) * sin(i* delta);
pushMatrix();
translate(xPos, yPos);
rotate(delta * i);
fill(0);
text(i + "--------------------", 0, 0);
popMatrix();
Answers
Please post a complete sketch that illustrates your problem. At the moment, you are expecting everyone to fill-in code to get a working sketch. ;)
Sorry, @Niels. Here's the full code. The code above is contains from the lines 208 to 217. Thank you :)
Yikes. No. That's not what he meant. Post a working sketch that demonstrates only your issue. Remove any code from it that isn't related. We aren't going to trudge through 250 lines of code to help you with rotating text.
Post a complete, working sketch that just shows your text. Also post maybe a mock-up image of what you wish your rotated text looked like.
Roger that. Sorry I was sleep deprived when I posted. Will condense and re-post.
OP stated the line numbers though.....
Line 189 posing a problem?
Here we go, apologies once again.
I basically want to rotate it so that the writing just moves clockwise! around the circle so that it lies in the middle of each segment. So in the screen shot, the red lines are where I want the text to be. I also want to make it so that the text will remain in the middle of each segment no matter how many arcs I add to that circle. (6 are added in the code below but this number will be changing in my larger script)
Below is only the relevant code. I hope I mad more sense this time.
Full working example below.
Kf
Thank you, @kfrajer, sir :) Works a treat within my original code too. Shall I post the full (large) working code?
That looks great. If you want to share your code, yes please do. With this image, people would be interested to see and learn from your approach.
Kf
This just occurred to me. This is due for an assignment shortly, so I don't want to risk plagiarising myself if the lecturer find this code online. (I know I already posted some of the code)
I can post a link to it separately in a google doc and post the code as text to this thread after it has been corrected?
Here's the code on my google drive: https://drive.google.com/open?id=1IAIHDlMw6DEDidqNPuzuCm97KhvwzCue
Thanks for sharing and good luck with the assignment. ;)