you are writing this to the person who explicitly said he should not have to you cant teach someone who does not want to be taught.
Basis conversion is, by definition, doing math. We should surely try and make this easy for people⦠but if you want to do graphics programming without using any math, then you have chosen the wrong industry.
One basii might be in inches, and another in feet, and another in Meters.
The basis you are using has nothing to do with the units that you are using. Choice of units is separate to choice of basis.
basii
The plural of basis is bases.
Basii is a kind of mushroom.
It currently is...
But you know, we, the people, decide what words are in a language. Dictionaries adapt to us. As an example (a bad one), āainātā is a word in new dictionaries, but not in old ones.
If you look here, it says āainātā is ānonstandardā, but does have a definition for it.
Who defines if words are standard? Probably not uneducated people. Most likely educated people define the standards; which is probably most of us here (even if self-taught).
Due to the extent that I studied physics in university (and despite being so rusty at it now), it is hard to convince me otherwise that certain conventions we choose define the math we use. An alien species has to figure out what our conventions are before our math will make sense.
On a technical level, yeah. In the end, designers want things from their world to align in the destination world. The overall utility (whatever it may be) would account for everything necessary for the overall conversion.
Iām thinking that the best utility (maybe?) would be a tool that makes a custom build of Three.js so that all APIs are entirely in some specified basis by default (relative to the WebGL screen-space coordinate convention).
This way, if I know Iām working with a team (f.e. a team that wrangles data, like for AI purposes and not graphical purposes) that deals entirely with a basis of X forward (pointing into the display), Y left, and Z up, etc, I would simply plug those numbers into the Three.js objects and everything would just work.
The end result would be the same as if this data team had been working in a basis identical to Three.jsās default basis, with -Z forward (into the screen), X left, and Y up, with all right-handed rotations. If the data team was working in that basis, then I could simply plug their numbers into all Three.js APIs and everything would just work.
So the concept is that a customized build of Three would make it operate in a certain basis, which would make it behave (with the new basis) the same as if instead the external data was all in the original Three.js basis.
Get what I mean? Iām typing fast, gotta get to work, no time to organize the idea more.
How do we compose the change-of-basis for the scene? The desired goal is to convert from left handed Y-up to left-handed Z-up. Is there any latest solutios for this?
Went through this long thread written up by you fine folks. I hope my question is still unique.
Instead of handedness, this-up, that-up, etc., how about something like this.
I have all my coordinates in the standard coordinate system used by THREE.
Letās call that frame-0.
I now want a new frame called frame-1.
And I define it as follows:
(1) Origin of frame-1 = an x,y,z point defined in frame-0
(2) +X direction of frame-1 = a unit vector defined in frame-0
(3) +Y direction of frame-1 = a unit vector defined in frame-0
(4) +Z direction of frame-1 = a unit vector defined in frame-0
We need a function that accepts these 4 quantities and returns a 4 * 4 matrix
It is the userās responsibility to ensure the 3 unit vectors are mutually orthogonal. If not, I donāt know what will happen!
I can then apply this matrix to the frame-0 coordinates of my points and get their coordinates in frame-1
I think this would handle a number of cases in a generic way, including my current need.
Is there anything like this currently?
OLDMAN
Without testing, the coefficients in the 4x4 matrix are exactly the coordinates in (1)ā¦(4) ā i.e. coordinates of 3 vectors + 1 point + additional row of (0,0,0,1). The coordinates are homogeneous coordinates.
If the new axes are not orthogonal, the shapes will be skewed. If they are not unit-length, the shapes will be non-uniformly scaled. If they are co-planar (or 0), the shapes will be smashed to a plane, to a segment or to a point.
Not to unneccesarily bump this thread, but it brought to mind this persons question I hit the other day, and apparently they had success with just flipping the scale of the Scene or Camera to change the handedness of the system:
So, if
(1) Origin of frame-1 = an x,y,z point defined in frame-0 = x1, y1, z1
(2) +X direction of frame-1 = a unit vector defined in frame-0 = a1i + a2j + a3k
(3) +Y direction of frame-1 = a unit vector defined in frame-0 = b1i + b2j + b3k
(4) +Z direction of frame-1 = a unit vector defined in frame-0 = c1i + c2j + c3k
Please confirm if the following is correct:
const M = new THREE.Matrix4();
M.set( a1, b1, c1, 0 ,
a2, b2, c2, 0 ,
a3, b3, c3, 0 ,
x1, y1, z1, 1 );
which produces the following matrix
[ a1, a2, a3, x1,
M = b1, b2, b3, y1,
c1, c2, c3, z1,
0 , 0 , 0 , 1 ]
Then, to take a point defined in frame-0 and determine its coord in frame-1
// aPoint = point location in frame-0
const aPoint = new THREE.Vector3( 22.4, 54.77, -9.002 );
// bPoint = point location in frame-1
const bPoint = new THREE.Vector3();
// do the transform
bPoint = aPoint.applyMatrix4(M) ;
When doing it this way, does it do:
(a) basis transformation followed by translation
OR
(b) translation followed by basis transformation
And does that matter in this case?
OLDMAN
That looks⦠plausible though if its trying to transform from 2 arbitrary coordinate frames⦠there is a missing matrix multiply in there maybe?
I expect your code equates to something like:
frameMatrix1.transpose().multiply(frameMatrix2).applyMatrix4(bPoint.set(22.4, 54.77, -9.002))
butā¦
In practice I would probably use something like:
const bPoint = Object2.worldToLocal(Object1.localToWorld(new THREE.Vector3( 22.4, 54.77, -9.002 ))
I think it is better to keep things simple. I made a short demo. The main coordinate system has a bouncing ball and a 3D model making circles. A new randomly positioned and oriented coordinate system is created and the ball/model movement is replicated there.
The random coordinate system is defined in lines 58-63. Axes are made orthogonal, although this is not obligatory. Skewed coordinate systems (i.e. affine) are also good, but they will skew everything in them, so the ball will look like spheroid.
The transition matrix is constructed in lines 66-70 like this (where X,Y,Z are the axes, O is the origin):
var matrix = new THREE.Matrix4(
X.x, Y.x, Z.x, O.x,
X.y, Y.y, Z.y, O.y,
X.z, Y.z, Z.z, O.z,
0, 0, 0, 1 );