Coordinate Frame conversion of coordinates

 From:  bemfarmer
5000.1 
// Michael, this is a Request for information on coordinate frame, and how are coordinates
// converted back and forth with the "world coordinate frame?"

var vM = moi.vectorMath;

// P1 is a point in world coordinates, which is to be the temporary origin in coordinate frame.
// P2 to be a suitable point for creating the frame x axis.
// P3 to be a suitable point for creating the frame y axis.
// The next 4 lines are correct, from Mirror script:
var FrameOrigin = vM.createPoint(P1.x, P1.y, P1.z);
var FrameXAxis = vM.createPoint(P2.x, P2.y, P2.z);
var FrameYAxis = vM.createPoint(P3.x, P3.y, P3.z);
var catFrame = vM.createFrame( FrameOrigin, FrameXAxis, FrameYAxis );


// The first question is, given points P4 and P5, in world coordinates, will the
// following code create points Pt4 and Pt5 in catFrame coordinates?

var Pt4 = moi.coordinateFrame.evaluate.catFrame(P4.x, P4.y, P4.z);
var Pt5 = moi.coordinateFrame.evaluate.catFrame(P5.x, P5.y, P5.z;)


// The second question is, having calculated point Pt6, the vertex of parametric catenary
// curve between Pt4 and Pt5, using cosh, which I already know how to do,
// will the following code convert point Pt6 back into world coordinates?


var x = moi.coodinateFrame.distancex(catFrame.Pt6);
var y = moi.coodinateFrame.distancey(catFrame.Pt6);
var z = moi.coodinateFrame.distancez(catFrame.Pt6);
var vertexPt6 = vM.createPoint( x, y, z );

// (next, point vertexPt6 will then become the new origin in a new coordinate frame...)

Thank you.


EDITED: 2 Apr 2015 by BEMFARMER