mataeux wrote:
> i think the first step would be to find code that can return the "convex
> hull" that contains any given solid..... those surfaces that make up the
> convex hull can then be examined to find your smallest box......
>
Seems likely, but maybe not in 3D. Read on:
Search Wikipedia for "Minimum bounding box algorithms"
A brief quote:
===================
"Two dimensions
For the convex polygon, a linear time algorithm for the minimum-area
enclosing rectangle is known. It is based on the observation that a side
of a minimum-area enclosing box must be collinear with a side of the
convex polygon.[1] It is possible to enumerate of the boxes of this kind
in linear time with the approach called rotating calipers by Godfried
Toussaint in 1983 [2] The same approach is applicable for finding the
minimum-perimeter enclosing rectangle. [2]
Three dimensions
In 1985, Joseph O'Rourke published an cubic-time algorithm to find the
minimum-volume enclosing box of a 3-dimensional point set.[3] O'Rourke's
approach uses a 3-dimensional rotating calipers technique. This
algorithm has not been improved on as of August 2008, although heuristic
methods for tackling the same problem have been developed.
Preparatory theorems in O'Rourke's work were proved to the effect that:
* There must exist two neighbouring faces of smallest-volume
enclosing box which both contain an edge of the convex hull of the point
set. This criterion is satisfied by a single convex hull edge collinear
with an edge of the box, or by two distinct hull edges lying in adjacent
box faces.
* The other four faces need only contain a point of the convex
hull. Again, the points which they contain need not be distinct: a
single hull point lying in the corner of the box already satisfies three
of these four criteria.
It follows in the most general case where no convex hull vertices lie in
edges of the minimal enclosing box, that at least 8 convex hull points
must lie within faces of the box: two endpoints of each of the two
edges, and four more points, one for each of the remaining four box
faces. Conversely, if the convex hull consists of 7 or fewer vertices,
at least one of them must lie within an edge of the hull's minimal
enclosing box.
The minimal enclosing box of the regular tetrahedron is a cube, with the
tetrahedron's vertices lying at (0,0,0), (0,1,1), (1,0,1) and (0,1,1)."
==================
There didn't seem to be any AutoLISP code for this on Wikipedia, alas
(what *are* they thinking?), but at least the algorithm does exist.
O'Rourke is a professor of computer science at Smith. He has published
two books:
"Geometric Folding Algorithms: Linkages, Origami, and Polyhedra", with
Erik D. Demaine (2007) ISBN 978-0-521-85757-4
"Computational Geometry in C" (1998) ISBN 0521649765
Give him a call -- I don't think this is going to be a quick LISP hack...