I need help to make a script to place non-linear spaced points along a non-planar curve.
I can of course make evenly spaced points with arraycurve using:
code:
// point factory to create point at start of myCurve.
pointfactory = moi.command.createFactory('point');
pointfactory.setInput(0, myCurve.getStartPt());
var myPtObject = pointfactory.calculate(); // Create the start point.
pointfactory.update();
// arraycurve to evenly space the start point object along the curve.
arrayfactory = moi.command.createFactory('arraycurve');
arrayfactory.setInput(0, myPtObject); // Point added to start of curve
arrayfactory.setInput(1, myCurve); // Curve name.
arrayfactory.setInput(2, 'NumItems'); // Array Mode.
arrayfactory.setInput(3, maxPts); // Number of evenly spaced points along the curve.
arrayfactory.update(); // Generate the points array and add to the geometry database.
myArrayPoints = arrayfactory.getCreatedObjects();
The result needs to be similar as shown in this posting (using ShiftArray.js) , except along myCurve rather than a straight path:
http://moi3d.com/forum/index.php?webtag=MOI&msg=5595.4
I don't care if the last point lands exactly at the end of the curve, or the total number of points. The spacing criteria (defined by a scale factor formula) will determine how many points will fit on the curve.
This script will be part of a larger script, so it's not a one-time event. If making this one-time I'd probably create my non-linear spaced points in a straight line, then Flow onto myCurve.
Any ideas are appreciated.
Ed Ferguson
|