View Full Version : a grid of "potential" cubes
11-03-2010, 03:32 AM
I want to create a custom scenario in Maya that may be a bit tough to describe.
Basically I want to create a large 3d grid of cubes, this would entail thousands of cubes. To build this is very easy I suppose, can do. The complicated part is that I would want these to be potential cubes. That is, I would only want them to create or display when a Maya geometry is intersected with xyz coordinates of the particular "potential" cube at this location. Make any sense?
What would be the best way to approach this problem?
Should the cubes be particles, or geometry?
How do I watch for intersection of geometry with 3D grid locations?
Thanks to anyone with the patience to read this or answer the questions.
11-03-2010, 08:01 AM
at first glance, checking if vertex is in cube might sound simple:
(V is vertex coords, Bounds.min is minimum corner of cube bounding box, Bounds.max is maximum corner of cube bounding box)
vertex inside cube = V.x>Bounds.min.x and V.y>Bounds.min.y and V.z>Bounds.min.z and
V.x<Bounds.max.x and V.y<Bounds.max.y and V.z<Bounds.max.z
however, you're not taking into account edges that span from cube 1 to cube 3, intersecting cube 2 in some way - they don't even have to be longer that cube. so if precision is a must, you'll have to use some more sophisticated algorithms.
When it comes to looping through geometries: for each geometry G -> analyze bounding box of G and create cubes it potentially covers, skipping any cubes that are already created (possible when geometries overlap).
the "create cubes it potentially covers" is hardest. I'd go with something like recursively dividing bounding box into BSP tree (using your cube grid as slice guides), in each step discarding leaves that don't contain any vertices and don't have any intersecting edges.
11-05-2010, 09:08 AM
Sounds like you get what I am asking for, in a technical sense, more than I do! Thanks for the info!!
"the "create cubes it potentially covers" is hardest. I'd go with something like recursively dividing bounding box into BSP tree (using your cube grid as slice guides), in each step discarding leaves that don't contain any vertices and don't have any intersecting edges."
Does this mean that I would first actually create the cubes? Or maybe just create an array with the coordinates? Thanks for any help. I really need to accomplish this but not exactly sure where to start.
11-05-2010, 09:08 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.