I am sure that the title of the topic is not very accurate but this is my fault.
What I need is to place points on a spline and the points to be at even distance between them. I do not want the spline to be divided.
For example the first point to be at the same position of the first knot of the spline. The second point to lay on the spline but the straight distance to the first point to be 33 units. The third point to lay on the spline and the straight distance to the second point to be 33 units and so on.
On the image below you can see what I mean:
https://drive.google.com/open?id=1ocbdZMAdPJlaua3rlup65T19fdgujCBn
The distance between the knots of the spline is 33 units(shown with green markers).
The code that I use to place the yellow points is:
curSpline = selection[1]
dist = 33.0
curvLength = curveLength curSpline ns
numSpl = numSplines curSpline
for ns = 1 to numSpl do
(
cnt = (floor (curvLength / dist)) as integer
for i = 0 to cnt do
(
point pos:(lengthInterp curSpline ns (i*dist/curvLength)) size:10
)
)
And the result can be seen in the same image with yellow markers. As you see the distance between the points is not 33 units.
Is there are any easy way to place the points so the distance between them to be 33 units and all points to lays on the spline? Mathematical way. Or I have to use some dirty hacks to find the proper position of the points? What comes to my mind as a dirty hack is this:
(
curSpline = selection[1]
dist = 33.0
step = 1.0 / 1000000
stepPointsArr = for i = 0.0 to 1.0 by step collect (in coordsys world (interpCurve3D curSpline 1 i pathParam:false))
pointsPosArr = #()
stopLoop = false
firstPosIdx = 1
while stopLoop == false do
(
for j = firstPosIdx+1 to stepPointsArr.count do
(
if j != stepPointsArr.count then
(
curDist = distance stepPointsArr[firstPosIdx] stepPointsArr[j]
if abs (dist - curDist) < 0.001 do
(
append pointsPosArr stepPointsArr[j]
firstPosIdx = j
)
)
else
(
stopLoop = true
)
)
)
if pointsPosArr.count != 0 do
(
for p in pointsPosArr do
(
point pos:p wirecolor:yellow
)
)
)
If you use the spline in this max(2014) file:https://drive.google.com/open?id=1FqZCp8VLfs8teEY1GHccltLpdR5PM1MR
the code above will create points almost at the same position where the knots of the splines are.


