How do I write a formula that rotates a point around the coordination systems center?

I have a 3D coordination system where x, y, and z dimensions span from 0 to 1000. I have a point randomly placed within these coordinates, and want it to rotate around the center (x, y and z = 500) by a given angle. I want to recalculate the point coordinates instead of relying on the translate(), or rotateX()/rotateY()/rotateZ() methods.

What is the mathematical formula for each of the x, y, and z coordinates? How can i express the formulas in code? (The searches I’ve done doesn’t come up with answers specific to my case).

1 Like

Hello @Erik,

Some references to peruse:

Also numerous Wikipedia topics on this:
wikipedia rotation - Google Search
Every topic has an also section to explore.

I was on the same adventure years ago exploring transformations… have fun! The adventure continues…

You need to rotate about an axis or a line.

This may be of interest as a starting point if you are rotating about one the x, y or z axes:

I have a strong foundation in mathematics (which helps) and I can adapt what I find in the resources provided. It can certainly be a challenge.

There used to be a tutorial in trigonometry but link is now dead.
You can find these old tutorials (including trigonometry) here:
processing-docs/content/static/tutorials at master · processing/processing-docs · GitHub
You will have to download to view as a web page.

:)

3 Likes

See also What's the equivalent of using cos() and sin() to find points on the edge of a circle to find points on a sphere? - #5 by KumuPaul

2 Likes

This is certainly a good way to learn.

Do you have other reasons to avoid them?

If so:
When you use translate and rotate, you can still retrieve the resulting position by modelX, modelY and modelZ, check reference.

Happy new year!

Chrisir

1 Like