Hello! I finally figured out how to make an ellipse that will rotate without having to use the rotate function on it.
I had had no luck getting solutions using rotate() and push()/pop() to generalize to making multiple copies that are resizable or relocatable. For instance, trying to make a flower function with tilted petals. It just won’t relocate without messing up.
Here’s a link to the function I created to try to fix that issue. It uses angle of rotation as an argument. Feel free to use/modify/redistribute, as needed.
https://editor.p5js.org/mstrain/sketches/sTuvUiSTJ
I’m pretty proud of it, and as soon as I have time, I plan on gathering this and a few other functions and classes into a library to go up on GitHub.
Now for the help:
I understand WHY it doesn’t work, but it’s a pretty significant handicap that you can’t directly use fill() with it. I left a red circle in the program to demonstrate. I feel confident that I can fill the ellipse with colored pixels, myself, but that would limit its usability. Any suggestions?
I’ve looked around for a function to “detect” another function, but I didn’t see it. I wouldn’t know how to begin creating a function to detect if fill() is used.
Honestly, I think the best case scenario might be for the angle of rotation to just be included in the standard ellipse() function, if that’s something that other people are interested in. I know I have been frustrated by not being able to easily rotate an ellipse about its center.
The second best scenario would be to point me to resources to learn how the shape functions use fill(), so I could replicate it in my function.
I’m looking forward to hearing from y’all!