Home > other >  Help, how to use the program to generate can fill color cube
Help, how to use the program to generate can fill color cube

Time:10-01

Recently in writing graduation thesis
One idea is to use software Python, or MATLAB generated a large cube, the cube is composed of many small cubes,
The key is how to use the coordinates, or index such as to fill color part of the small cube

Surf the Internet to see a lot of posts, baidu, find a better way to
Use of MATLAB, a three-dimensional grid coordinates and slicing function to generate cube
The code below
K=5;
[X, Y, Z]=meshgrid (0: k, 0: k, 0: k);
% grid coordinatesV=(X + Y + Z)/3;
Cube=(X, Y, Z, v, 0: k, 0: k, 0: k);
% generate cubeAlpha transparency. (5) % graphics
Colormap gray
Scope of each coordinate axis equal % equal
Set (gca, 'CameraViewAngleMode', 'manual');
The view (3)

Generated as shown in figure:
(home net... Can only use mobile phone took)

This model is generated by slicing, every small cube is hollow, the inside of the small cubes I didn't find the suitable function or method to use color fill

For help, is there any good method?
Python or MATLAB can be