Erik
December 31, 2023, 5:03pm
1
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
glv
December 31, 2023, 5:23pm
2
Hello @Erik ,
Some references to peruse:
This tutorial explores how translation, rotation and scale — taken together under the umbrella term affine transformations — work in…
Reading time: 22 min read
This tutorial introduces how to rotate objects in 3D beyond Euler angles; to do this, it looks at the basics of matrices and quaternions…
Reading time: 19 min read
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:
In mathematics, a spherical coordinate system is a coordinate system for three-dimensional space where the position of a given point in space is specified by three numbers, (r, θ, φ): the radial distance of the radial line r connecting the point to the fixed point of origin (which is located on a fixed polar axis, or zenith direction axis, or z-axis); the polar angle θ of the radial line r; and the azimuthal angle φ of the radial line r.
The polar angle θ is measured between the z-axis and ...
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
Chrisir
December 31, 2023, 5:34pm
3
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