orientation matrix to heading tilt roll calculus

87 views
Skip to first unread message

Laurens Nienhaus

unread,
Dec 5, 2008, 2:32:46 PM12/5/08
to KML Developer Support - Google Earth Browser Plugin
Hi there,

I am trying to orientate a Sketchup model along a plane.
The plane is defined by three points.

I am using the math3d.js published with the plugin examples (*).

Given the points a, b and c in cartesian coordinates
I calculated the orientation matrix of the plane.

var ab = V3.sub(b, a)
var ac = V3.sub(c, a)

var dir = V3.sub(c, a)
var up = V3.cross(ab, ac)

// orientation_matrix
var mat = M33.makeOrthonormalFrame(dir, up);

Now, the M33.localOrientationMatrixToHeadingTiltRoll(mat) function of
math3d.js should give me the corresponding heading, tilt and roll
values but I get weird results.

Find an example here: http://l-p-n.de/tmp/ge/argh.html

Help on solving this problem is very appreciatated!

Regards,
Laurens

(*) http://code.google.com/p/earth-api-samples/source/browse/trunk/lib/math3d.js

Markw65

unread,
Dec 5, 2008, 6:52:49 PM12/5/08
to KML Developer Support - Google Earth Browser Plugin
The problem is that your orthonormal frame is in global coordinates,
not local ground coordinates.

To convert to local coordinates:

var lgFrame = M33.makeLocalToGlobalFrame(a);
mat = M33.multiply(M33.transpose(lgFrame), mat);

Mark
> (*)http://code.google.com/p/earth-api-samples/source/browse/trunk/lib/ma...

Laurens N

unread,
Dec 5, 2008, 7:22:08 PM12/5/08
to KML Developer Support - Google Earth Browser Plugin
Thanks a lot!

That did the trick (using a in lat lng alt form)

Laurens
Reply all
Reply to author
Forward
0 new messages