Grasshopper

algorithmic modeling for Rhino

moving a mesh with galapagos until it clears other meshes

Hi there,

I have a bunch of randomly sized meshes which are strung up and down vertical lines - To begin with, they are randomly placed, but I want to shift their vertical positions to avoid the clashes that are currently happening. Can I do this with Galapagos? Pic attached of current, clashing condition.

Views: 643

Attachments:

Replies to This Discussion

It sounds like the problem isn't very continuous, which means Galapagos won't be particularly efficient at finding a solution. The specific distribution of meshes either intersects or it doesn't, so a solution is either good or bad. Galapagos likes to work in the grey area where a solution can be improved upon incrementally.

You may be able to formulate the problem in a more continuous way, for example by measuring the amount of overlap of meshes, but it's not entirely clear to me what a good way to do that would be.

Looks interresting, what is it for?

Why don't avoid the clashes in the first place?

Simple greedy algorithm, randomly populating the lines using the bounding box of the meshes as collision detection. Would need some VB / C# / Python...

 

Richard

That's a classic island making problem (some sort of flat hard clustering).

Provide the meshes.

See the clustering working on polylines based on the curve intersection rule:  RegionContainment ro = Curve.PlanarClosedCurveRelationship(curveA, curveB, plane, tol); - this means that an appropriate other "rule" (say: mesh intersection) should used in this particular case for your meshes. Meaning: sample in DataTrees all the "rule complying" meshes (or use any other "rule" [ for instance: some centroid to centroid distance doing a K-Means clustering]) and then do whatever required.

Say like this:

After the clustering some recursive translation (per cluster) is required:

On each branch that has more that one item ... sort them using their BoundingBoxes (by Z)  then get the "top" (Z) one as the current and move the prox down in "smallish steps" (+ the rest) until no ccx occurs (or better: their min distance < tol) ... then bounce  (up/ down) using increasingly "smaller steps" per recursion loop ... and if the first is OK with the prox make the prox the current and continue  ...

I'll test something similar later on.

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