Opposites Attract - Dynamo

February 14, 2017

Not that kind of attraction! I’m talking point attraction in Dynamo of course.

Here is what we are going to make when all is said and done.

 

Now we’ll break it down.

 

First, we need to find a source image and break it down a bit. Luckily, I found a perfectly square image which made life easier. Also, for some reason it makes life easier to rotate the image like shown below. In this case, we will go ahead and grab an even number of pixels from the image’s height and width.

 

 

After grabbing those pixels, we go ahead and break down the colors to use in Dynamo!

 

 

 

Next, we need to generate a surface to work with to process the “directions” from the image. For this example, I used a line to extrude a surface that is the same dimensions as my image.

 

I also went ahead and placed points on this surface at the same spacing and logic as my image from before, (25x25).

 

 

 

Next, we need to generate something called an attractor point. This means we measure distance between one item, (in our case a point), and several other items, (in our case 625 other points). The way this is achieved is through a node called, “Geometry.DistanceTo”. It is important to keep in mind that this node will return the literal length from the attractor point to the other points, we’ll fix that next.

 

To fix this situation, we will use something called “Math.RemapRange”. This beautiful node will redefine all the numbers in a list, based on a minimum and maximum value. Once again, this means Dynamo is doing math on 625 numbers way quicker than I can.

 

 

When we are all done with the geometry we can now override the cubes based on the colors from the image.

 

 

 

And here it is in action using the direct movement of a point in Dynamo.

 

 If you have enjoyed this, please comment/share!

 

 

John Pierson is a Computational BIM Specialist at EvolveLAB.  John has presented at Revit Technology Conference where he was rated as one of the top 5 speakers. He is an active member in the Dynamo community and currently manages Rhythm; which is among the top 10 most downloaded Dynamo packages. 

 

 

 

Please reload

Featured Posts

Rhino Inside Revit

October 30, 2019

1/10
Please reload

Recent Posts

October 30, 2019

Please reload

Search By Tags