Grasshopper

algorithmic modeling for Rhino

Hi all, I have the following problem: I want to select rectangles based on points generated by a bitmap. I have a definition that is sort of working but it is not automated enough. That means that I still have to do a lot manually.

 


I have a herringbone pattern of rectangles and a dithered gradient that marks part of the pattern. It should look like herringbone_detail.png but I get stuck if I want to couple the output of the dithered gradient and the rectangles. One way could be to make a list out of the rectangles because I use them to generate a point list for the imagesampler. I am stuck there however, although it should be fairly easy.

 

Any help would be greatly appreciated,

 

Casper Le Fèvre

Amsterdam, The Netherlands

Views: 1694

Attachments:

Replies to This Discussion

Hi Casper,

 

the way to approach something like this is to combine both a random and a controlled metric. You'll need to generate a random number between -1.0 and +1.0 for every individual rectangle. Then you need to generate a distance number for every individual rectangle based on distance from your attractor. If the distance is zero, the distance number should equal +1.0, if the distance is maximum, the distance number should equal -1.0. When you then add the random and the distance numbers together you get a value that can be used for culling. For example, you could say all the rectangles with negative sum numbers will removed.

 

By adjusting the Random domain, the Distance domain and the culling threshold you can play around with the amount of randomness and the cut-off etc.

 

In the graph below you see the distance numbers and the random numbers. I've picked a slightly smaller random domain here, which will result in a less 'blurred' boundary between the left and the right side:

 

 

When you add these two together you basically randomize the distance metric:

 

 

If we're culling everything less than zero, we'll end up with the distribution of black boxes.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hi David,

 

Ok, wow thanks. This is quite something else than I expected. The approach of how to do it I mean.

 

I have trouble relating the imagesampling  with the red line that you have drawn. Also I have updated the image to this one (straatHR_01.png), so could you please clarify - if you can spare the time - how to relate the black and white image and the method you described above?

 

Casper Le Fèvre

Amsterdam, The Netherlands

 

Attachments:
Changed a bit in the definition, added the datacomponent.
Attachments:

Well if you already have a bitmap with the culling pattern you don't need to do all this distance/random stuff. You just need to look up the correct pixel in the bitmap. If it's black, you keep the corresponding rectangle, if it's white you cull it.

 

You just need to make sure that your grid of tiles has the same dimensions as your image, otherwise you'll start sampling in between pixels and you'll get aliasing effects.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Ok, something like this? Not that it works but I am still stuck... I did all the rest, tiles and bitmap match but this still eludes me.

 

Thanks in advance ,

 

Casper Le Fèvre

Amsterdam, The Netherlands

Attachments:

When you sample the bitmap, make sure that you sample the brightness channel, not the colour channel. 

 

Then the output of the Image Sampler will either be zeros (black) or ones (white). You can then use these zeros and ones to create a list of boolean true/false values that will be the input for the Cull Pattern component.

 

I cannot send you a file that works as your version of Grasshopper won't be able to open files saved by mine, I've broken the forwards compatibility of ghx files in the next release.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hi Casper,

 

If you still haven't got any luck you can check out in the attached file what David is talking about. Although, I think you should go with David's first approach because the gradient image is not going to work so well in terms of producing something like the images you have attached.

 

M.

Attachments:

Hi David and Marios,

 

Thanks for your help. I finally got it to work, needed to add a cull pattern and to ease the rectangles  into that. So thanks again and after my holiday I will post the files. In a hurry now....

 

 

Casper Le Fèvre

Amsterdam, The Netherlands

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service