Fun Project: Method for Projecting Custom Objects onto Surface

Hi all,

I am working on a project where I need to cover a form with a set of objects. I am covering a 3d scan of a hand in 3d scans of fruit.

The parameters are such that the fruit must be packed as densely as possible, in random order and rotation, but not intersect with one another. Instead of placing each fruit with Gumball, can you propose any suggestions for automating this process?

What I have so far:
I slightly modified a script I found on Designalyze (a super great website) so that it would project identical spheres onto a surface without intersecting. I was thinking of continuing something along the lines of this basic structure.

In the test script I used the rhinoscriptsyntax method addSphere. One of my thoughts is to define a new method named addFruit. AddFruit would:

  • Pick a fruit from a list of fruit
  • Rotate it randomly on x,y, and z
  • Measure a radius based on where the object has oriented itself (A pineapple on it’s side has a bigger radius than a pineapple standing straight up)
  • Use that radius in an equation that tells Rhino at what coordinates to put the fruit.
  • Check for collisions with other fruit, if the fruit collides, regenerate a new fruit

There are a few things that I have yet to find solutions for:

  • Densely packing fruit on x,y, AND z axis. The script above binds spheres at their x and y axis, but they are not bound at the z axis.
  • Make the radius measurement from the randomly rotated fruit’s furthest boundary.
  • Making a collision check system.

Perhaps there is a physics tool in Rhino that would treat fruit objects as solid and essentially “swarm” the hand surface? I have seen things like this in Maya’s MASH plug-in.
Perhaps there is a good paneling method for this?
If anyone can suggest rhinoscriptsyntax methods, built-in tools, or general advice, I am interested to know.

If you have taken the time to read all of this and have any thoughts, I am thrilled to hear from you, and highly thankful of your interest. Cheers!


1 Like

Hi Dean,
I’m doing, in part, something similar. I auto-fit the upper humerus head (the upper joint of the upper arm) into the joint surface of the shoulder blade (glenoid socket of the scapula). For this I’m generating points on the (irregular) surfaces and, in this case, generate spheres from that. I then check if points are inside, beyond, or whatever, relative to other objects. With an iterative approach I can find the joint center and relative positions between parts (the humerus head and the glenoid socket and…).

“Probing” rays… :slight_smile:

Anyway, using GrassHopper there are components that is somewhat helpful. For example checking for Intersections (of surfaces/solids) and components for checking if a point resides inside a sphere or any so called solid (“Brep” in Rhino lingo). Example:

And so on. Intersections can often be measured, but if not, you could try an iterative approach moving the objects a bit and test for intersections again until no collision occurs. There are even Galapagos components in GH. Also, if you check for “closest points” between two objects, they can hint about how to move to get where you want faster. And so on. Good luck!

// Rolf

1 Like

It looks like also Kangaroo could give you some ideas about how to self organize items om the surface, perhaps using forces.

// Rolf

1 Like


Thanks to Daniel Piker on the Grasshopper forums, I have a circle packing script over the hand mesh form. Link below.

What I have done since, is collect the center points of all those circles into a list, and for every point in that list I generate a random fruit. Inside of that “for loop”, I run checks for intersections with other fruit, and the outer hand mesh shape. If there are intersections, I move those fruit to a different layer. I will attach the code soon.