Grasshopper

algorithmic modeling for Rhino

hi all,

I've been trying to deal with a problem and I don't know if it's possible in grasshopper to create a force field from geometries...

in this case every geometry would be emitting a force/light/heat..., the overlapped parts (in red) would have more strength than the least overlapped (in blue) and the bigger red areas would have more charge than the smaller red areas.

I'm doing all this because I want to generate a series of rings with the forces...

like in this sketch

attatched is a definition that recognizes the overlapped geometries (modified from Kyle Faulkner) with some possible scenarios

any ideas?

cheers,

rbbt

Views: 1911

Attachments:

Replies to This Discussion

What sort of data are you looking for though? Do you need accurate area measurements for each level of exposure? Do you need contour curves? Would you settle for a mesh or a bitmap?

Basically, I don't know what 'force field' means or how it will be used downstream. I realize your sketch shows what you are after, but I don't understand the logical relationship between the lines on the sketch and the diamond shapes areas.

Hi David,

Thank you for taking some time to look into my problem.

The diamond shaped areas are my input geometries, they represent a series of "islands" in my project.

The data I'm looking for are contour curves, no need for super accuracy, just approximate enough so that they show where the "gradient" starts (centers) and how they transform into the perimeter. Something like I sketched... that should look like something like this:

Those contour curves would determine zones inside those islands... so i can later work with those zones...

for example each zone will have different density of "vegetation", more density if nearer to the "force focus"... and so on

and different density of passways that will be drawn with another grasshopper I'm working on, but that's another story... just showing it so you have an idea of how the contours would be used.


so in a nutshell I would use the curves of those contours on one hand, and the areas inside of them on the other hand... to work with them afterwards..

cheers,

rbbt

Ok, I'm getting there I think. You have a collection of (potentially overlapping) regions each of which has a unique 'brightness'. Where regions overlap, the sum of the individual brightnesses is used.

Then you want to create curves that connect points of identical 'brightness' (let's call them isoluminants), however the brightness of a point is the result of all regions in the vicinity of that point, with some control over what exactly 'vicinity' means. So a particularly bright region will raise the brightness all around it, and the brightness on the interior of a region is higher than measured along the boundary of that same region.

Correct?

Yes! It's a really good way of putting it. Exactly a particular bright region will raise the brightness on the regions around it....

Not sure though in that logic, if the areas of two regions of the same category would define if one's center is brighter than the other's?

Not sure though in that logic, if the areas of two regions of the same category would define if one's center is brighter than the other's?

I think it depends on whether a region counts as a single logical object, or as a conglomerate of an infinite amount of infinitesimal regions.

My first approach would be to use Bitmaps if you want to program this using C# or VB or Python, that's probably fastest. If you're looking for a 'pure' grasshopper approach, then you'll need to sample some meshes instead.

How many regions are we talking about btw? A few, dozens, thousands?

It's always less than 10 regions and never more than 4 overlapping geometries.

in another .gh file I grouped the overlapping ones and will be inputing them as separate groups

this is one of the most "complex" of the groups i have

several others look like this, in all there will be like 40 groups:

a grasshopper approach wouldn't be the best option you say? in what manner do you thing the meshes should be sampled?

anyway thanks for the approach I don't want to take that much time from you, I will look into Bitmaps, started using grasshopper some months ago, so never went into C# or Python or VB, will do some research... 

For heavy duty sampling like this 'pure' Grasshopper is almost always slower as it is very difficult to be smart about how much you sample. Code is easier to optimize.

Whether it's bitmaps or meshes though, I suspect they roughly have the same approach:

  1. Create the mesh or the bitmap, this gives you a rectangular grid of sampling points. The density of these points equals the accuracy of your result. The accuracy (i.e. spacing between adjacent sample points) should be significantly smaller than the smallest geometric details on your regions.
  2. For each pixel/vertex in the bitmap/mesh, sum up the contributions of each region. This is obviously quite tricky, because one needs to take the whole region into account, weighing nearby areas of a region more strongly than distant ones.
  3. Elevate the mesh vertices based on the summed illumination, or, if you have a bitmap, create a heightfield mesh.
  4. Contour the mesh.

In code I would in fact take a different approach to step (2). Instead of iterating over all sampling points and summing up all region contributions, I'd iterate over all regions and affect all illuminated sampling points. It's logically the same thing but my gut tells me it'll be easier to optimize this way.

One problem with a bitmap approach is that you'll be limited to the colour accuracy. If you go for greyscale then you'll only have 256 levels to play with. If you're willing to use the full integer range you get a more wiggle room, but your bitmaps will not be 'readable' by human eyes until you map the values back to some smooth gradient. The big benefit of bitmaps is that they're fast and easily storable and shareable as files.

wow thank you!!

that helped a lot.

I guess, for now, I'll optimize my time better doing it in .gh, I posted up a quest in a freelancers blog, maybe someone that knows code is available.

back to us, I will never need more than 256 "levels", I will only need 10-30 contours I guess.

I tried an approach in .gh using your logics... just that I didn't evaluate all points the same, the ones in the stronger "class" I evaluated double, not sure if that's giving me the desired result though. still have a lot to try and only in the simplest of possibilities.

https://www.dropbox.com/s/5avxj7nj26c4cky/isolines.mp4?dl=0

thank you for you help, never thought i'd get this far

Attachments:

I think I better understand now what you were wanting and I might have something. If not, well, it was fun anyway. 

The attached definition essentially assigns a maximum value for each shape, the largest, most overlapped shape as 1 and the smallest least overlapped shape almost 0 (empty space is 0).

Then, a mesh is created and the distance from each vertex to each shape is found and remapped according to the value of the shape. If it is in the shape, it gets the full value. Each vertex now has a value for its relation to each shape, and relative to each shape's value. These values are added up, sent through a graph mapper to exaggerate them, and used to deform the mesh into a heightmap, which is then contoured. 

Attachments:

wow Kyle!! 

I looks beautiful!! And not only that, it does exactly what I wanted to achieve!!

I will play around with it... there's still some things I will need to think, related to unexpected results, specially in how to maintain the "force field" inside the geometries... 

You and David where both really helpful, thanks a lot!

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service