I have random uniform distributed points in a 3D plot. How can I subdivide the plot into cube shaped grids with equal volume.
Show older comments
My objective is to randomly and uniformly distribute points in a 3D cube shape. Then break the cube into 27 equal volume small cubes. then determine the density of points in each small cube (grid).
I have distributed points now but struggling to divide the plot into furether 27 sub cubes.
Help please
6 Comments
Walter Roberson
on 4 Sep 2020
Is the cube arbitrarily oriented, or is it aligned with the x, y, z axes?
Tamoor Shafique
on 4 Sep 2020
Tamoor Shafique
on 4 Sep 2020
Walter Roberson
on 4 Sep 2020
100x100x100 m3 volume can be divided into 27 equal volume cubes
That would require that each of the 27 sub-cubes was divided into sides of 33 1/3 m each. That 1/3 is going to present the majority of the complexity in your code; you are going to have to keep fighting it over and over.
Would it be acceptable to redefine from 100 meters per side, to 3936 inches per side? That is approximately 25.65 mm short of 100 meters, but at least then you could subdivide into 1312 inches per face (an integer) instead of having to deal with that pesky 1/3 .
Tamoor Shafique
on 4 Sep 2020
Walter Roberson
on 4 Sep 2020
the code should be adaptive for dividing any cube into 27 small sub cubes is is possible?
It gets messy. When the size of the larger cube is not divisible by 3, then there are 6 cut planes (2 per direction) along which it is necessary to figure out how to fairly count 1/3 or 2/3 of a pixel on each side of the cut plane. As you are calculating volumes, if you were to allocate the boundary pixel to both sides, then you would be over-estimating the volume.
A typical approach to try to be accurate and fair at the boundary involves looking at configurations of pixels at the boundary and saying that certain configurations of pixels count for one side or the other. For example if you have a conformation such as
*
*
**
*
and the boundary runs 1/3 of the way through the vertical line that has the single * then probably the fairest way would be to count it as being entirely on the right hand side, saying that the 1/3 of a pixel on the left of the boundary of what is clearly a surface, has "no significant presense" on the left side of the boundary and should only be counted on the right.
The major alternative is to count whole pixels that are entirely inside, and to count a fraction for one ones that are on the boundary.
Accepted Answer
More Answers (0)
Categories
Find more on WSNs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
