Grasshopper

algorithmic modeling for Rhino

Hallo,

first I want to explain my question. I have an digital image, which I want a pattern of it by creating lines in a specific rectangular. 

The dimension of the image and the regtangular is 3:4. 

The boundary of each  side is divided by several points. So the endpoints of the lines which should create the pattern shell cross these points.

In the attachment there is an example of what I want to create.

It would be great if anybody can help me

THX

Views: 5924

Attachments:

Reply to This

Replies to This Discussion

awesome

Thanks Laurent, that's awesome

I have another question.

How is it possible to define the grey tones of the image if the image is black-white? Is it the same process?

Hi Laurent, great work thank you.

May I ask you to try the same process with a black-white picture? Is it possible to define the grey tones of an image?

You need to play with 'Image Sampler'.  Yes, it returns "grey tones" (color brightness) or RGBA colors.

I'm not sure to understand your algorithm... Could you please communicate some more details?

(This is quite funny I'm trying to do the same thing since yesterday, Grasshopper is a very small world)

This is fantastic. I've recently had the same idea but had no idea where to start. The application I thought of is actually to achieve this in 3 dimensions to eventually be printed using a robot arm and extruder. The result would essentially be similar to perspective murals that are only visible from a specific vantage point. I'd be most appreciative if I could chat with you about your process. I'm quite new to GH and even moreso with raw scripting. Great work! Cheers. 

Took your pseudo code and tried to mock it out using anemone for the loop.  Doesn't seem to have the same success as yours at 400 iterations (i think i see a face).  I noticed if I limit the the number of test lines it can draw to test to a random set of N rather than all possible lines I got better results as it wont always go to the darkest spot on the image. 

Takes about 12 seconds to run the loop. 

hello,could you share the grasshopper file?

Cooincidentally, look at what I walked past today

After one week, here is a quite proper solution to your problem. The most difficult part was optimisation as some method for Bitmap are quite long, here it was GetPixel. I first use a fast method but which not so fast. See in the code the references. 

Hot to use the tool 

  1. Put "Calculate" to false => no calculation
  2. Select the filepath of your image, this image will be drawn as a mesh on the canvas
  3. Draw the points of the loom, me I use a curve for that
  4. Choose the number of iterations 
  5. The Image width in pixels is the size used for image calculations (200 pins, 200 pixels, 400 iterations = 1.3 min, 200 pins, 570 pixels, 2000 iterations = 2.3 h)
  6. Alpha if for line drawing is used to mimic less than one pixel line
  7. method 1 : choose the line where there is the biggest proportion of black
  8. method 2 : choose the line where there is the longest proportion of black

Click Calculate, experiment. Normally Escape could work to stop the calculations

Wow, that's great!

Many thanks for sharing.

Thanks for sharing! 

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2019   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service