jonahhawk

11-18-2010, 06:47 AM

For some reason search is down... if this has been covered, I apologize.

Inspired by the hexagon screen forms here. (http://www.notcot.com/archives/2010/11/mercedes-benz-sculpture-experi.php) And by the work of Ali Torabi (http://www.torabiarchitect.com/blog/?page_id=190)

I wrote a scripted controller that finds the shortest distance to a splineShape. In my crude method, I added a Normalize Spl. Mod to the shape then collapsed it to work with the splineShape. The script makes an array of all the distances, sorts the array then uses the first value. I'm sure there is a better/faster way of doing this. And maybe a way to not use the Normalize Spline mod.

Is there a way to get an array of points evenly spaced along a spline without Normalize Spl. mod?

Is there a faster way to find the shortest distance?

This controller goes into hundreds of objects to control properties in proximity to the shape.

theMin, theMax, theFactor are contstants.

nPos is the position track of the object, an ngon in this case.

theDistances = #()

for s = 1 to (numSplines theShape) do

(

for k = 1 to (numKnots theShape s) do

(

knt = getKnotPoint theShape s k

theDist = (distance nPos knt)

append theDistances theDist

)

)

sort theDistances

(

if theDistances[1] < theFactor then

(

if (theDistances[1]/theFactor) < theMin then theMin else (theDistances[1]/theFactor)

)

else theMax

)

Inspired by the hexagon screen forms here. (http://www.notcot.com/archives/2010/11/mercedes-benz-sculpture-experi.php) And by the work of Ali Torabi (http://www.torabiarchitect.com/blog/?page_id=190)

I wrote a scripted controller that finds the shortest distance to a splineShape. In my crude method, I added a Normalize Spl. Mod to the shape then collapsed it to work with the splineShape. The script makes an array of all the distances, sorts the array then uses the first value. I'm sure there is a better/faster way of doing this. And maybe a way to not use the Normalize Spline mod.

Is there a way to get an array of points evenly spaced along a spline without Normalize Spl. mod?

Is there a faster way to find the shortest distance?

This controller goes into hundreds of objects to control properties in proximity to the shape.

theMin, theMax, theFactor are contstants.

nPos is the position track of the object, an ngon in this case.

theDistances = #()

for s = 1 to (numSplines theShape) do

(

for k = 1 to (numKnots theShape s) do

(

knt = getKnotPoint theShape s k

theDist = (distance nPos knt)

append theDistances theDist

)

)

sort theDistances

(

if theDistances[1] < theFactor then

(

if (theDistances[1]/theFactor) < theMin then theMin else (theDistances[1]/theFactor)

)

else theMax

)