Hello,(adsbygoogle = window.adsbygoogle || []).push({});

I am constructing a MATLAB script to tightly pack an arbitrary given geometry with spheres of a predefined radius. Coordinates of the vertices of the geometry (a polyhedral model) are given; I am thereby developing an algorithm to plot/track all spheres that fit within the boundaries of the model (defined only by the provided vertex data).

I have successfully tested a script that eliminates all spheres that are "crossing" the model boundary; my difficulty, however, lies within teaching MATLAB how to distinguish spheres that are fully within the boundary from spheres that lie entirely exterior to it. What conditions/techniques could I use to (relatively simply) tell MATLAB not to track a sphere if it lies completely outside of the given vertex/boundary data? I aim to construct a grid of spheres that entirely encompasses the geometry and thereafter have the code systematically eliminate spheres that lie upon or outside of the given vertex/boundary data. Only the spheres lying completely within are plotted/tracked!

I seem to be pulling my hair out over this one. Any assistance would be greatly appreciated!

Best,

Paul

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Fitting Spheres in Arbitrary Geometry

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

**Physics Forums | Science Articles, Homework Help, Discussion**