I do have endPt of the initial quarter curve, in cplane coordinates, (raw_x, raw_y, z=0).
Need to create cplane2 from these.
[Note: The point (raw_x, raw_y, z=0), in Front and Right Views, would represent (Y2,Z2,X2) and (X3,Z3,Y3), respectively.
I think that I did cplane2 = Frame2, back in 2013:
code:
var FrameOrigin = ptRaw;//ptRaw is the last point of the "half" curve
var x2 = raw_x + 1.0; // raw_z=0
var FrameXAxis = cplane.evaluate( x2, raw_y, raw_z );
var y2 = raw_y + 1.0;
var FrameYAxis = cplane.evaluate( raw_x, y2, raw_z );
var Frame2 = moi.vectorMath.createFrame( FrameOrigin, FrameXAxis, FrameYAxis );
Maybe need to get rid of cplane.evaluate above...?
But qtr curve is in World coordinates...Need Frame2 in World coordinates for Mirror2 and rotate...
I hope some of this makes sense. It is confusing to me.
Will try again tonight...
- Brian
cplane and Frame are related, but are not the same thing?
cplane converts World coordinates to local coordinates? Or vice versa...? evaluate...
code:
//Convert to cplane frame.
var base_x = cplane.distancex( BasePt );
var base_y = cplane.distancey( BasePt );
Frame provides orientations for commands like Mirror and Rotate?
From: Michael Gibson 10 May 2013 (8 of 35)
5878.8 In reply to 5878.6
Hi Brian, ok so I think the problem is the script is not quite getting the correct 2D coordinates for doing your calculations.
At the start of your function buildClothoid you've got some calls to cplane.evaluate() there - but that's probably not right, you use cplane.evaluate() for converting from the frame's "local coordinates" into world coordinates.
At that point in the script for buildClothoid() you actually need the reverse I think - the points given to you by the pointpicker are in world coordinates and you want to get them into 2D coordinates within that cplane's local coordinate system before you start doing calculations with them. Then when you're done doing your calculations that's when you want to use cplane.evaluate() to convert from 2D local cplane coordinates back into world coordinates.
The .evaluate() call is only for doing the last part (2D local into 3D world conversion) - you need something different for the first part (3D world into 2D local cplane conversion).
For doing the 3D world into 2D local conversion you can get the local 2D plane coordinate from a 3D world coordinate by doing cplane.distancex() and cplane.distancey() which get the signed distance of the given 3D point from the x-axis plane and y-axis plane of the frame, something like this:
var localx = cplane.distancex( worldpt );
var localy = cplane.distancey( worldpt );
So if you use that in the start of buildClothoid() it should then give you uniform behavior in all views, here's an updated buildClothoid function that should work: