|
|
In article <web.3d8cf65cb7cda85de1d0c2220@news.povray.org>,
"archie" <arc### [at] hotmailcom> wrote:
> Yeah, thank you guys. I actually need to calculate the fractal dimension
> (Hausdorf-Besicovich dimension) of a 3D object, so I need to divide a 3D
> object (ANY object) in smaller and smaller cubes, and test the intersection
> of the object with the cubes. I need that (badly) for a project at school.
> I thought it would be easy to do it in pov-ray, but life is'nt so easy...
If edge intersection is fine, use trace() along each edge of the cube.
If trace() returns an intersection closer than the length of the edge,
the shape intersects the cube.
If you need to detect cases where the shape penetrates a cube face but
not an edge, you can't do it exactly, but you can approximate it by
tracing rays along each face of the cube. This will be slow, so you
probably will want to check if the bounding boxes interpenetrate first.
This leaves cases where the shape entirely contains the cube or where
the cube entirely contains the shape. Assuming the surface of the shape
contains a single volume (shapes such as isosurfaces, blobs, meshes, or
CSG don't necessarily have this property), just check the corners of the
shape's bounding box for insideness with the cube, and the corners of
the cube for insideness with the shape. If the shape surface doesn't
intersect the cube surface, it must either be entirely inside the cube
or containing it, so checking a single corner from the cube should do.
--
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/
Post a reply to this message
|
|