Math help

RE: Math help
#4
(2019-03-24, 20:00)Orion Pobursky Wrote: Assume the wold axis in this case. Assume P1 is the axis origin (0,0,0) in the LDraw standard world space.

In that case P2 is your base local (y) vector.
Normalize p2

Cross p2 with world Y   (0, 1, 0)
to Get a second local vector perpendicular to p2 (your local z)
Normalize local z

Then cross p2 and the new local z to get the 3rd vector (your local x)
Normalize local x

Use the 3 local axis to construct the matrix.

There are limits though, depending on the direction of p2 things will flip 180 degrees at some point and if p2 is close to world y it will not solve.
In my path generator I choose world Y or Z as the reference bases on the biggest angle.

There might be a more elegant way of solving this but I'm no math major
« Next Oldest | Next Newest »

 Messages In This Thread Math help - by Orion Pobursky - 2019-03-24, 19:06 RE: Math help - by Roland Melkert - 2019-03-24, 19:31 RE: Math help - by Orion Pobursky - 2019-03-24, 20:00 RE: Math help - by Roland Melkert - 2019-03-24, 21:20 RE: Math help - by Orion Pobursky - 2019-03-24, 21:25

Forum Jump:

Users browsing this thread: 1 Guest(s)