matlab矩阵方块网络着色imshow_matlab - 在MATLAB中用小方块填充整个立方体的体积 - 堆栈内存溢出...

这段代码演示了如何在MATLAB中使用imshow_matlab创建一个由小立方体填充的大型立方体。通过调整坐标和颜色,生成一个3D网格结构,每个小立方体都有其独特的颜色。主要改进是通过控制坐标步长而非随机生成来构造立方体。最终可以按需调整小立方体的属性,如透明度和颜色。
摘要由CSDN通过智能技术生成

同样的原则,我们在角落里建造一个大的立方体,然后是一个小立方体,然后我们用一个小的偏移量重复小立方体建筑,直到我们满了。 与旧代码的主要区别在于,这次控制每个坐标集的阶跃变化(小立方体的x,y,z坐标的函数)而不是随机的。

%%

clf; figure(1); format compact

h(1) = axes('Position',[0.2 0.2 0.6 0.6]);

%These are the different 8 vertices of the cube, each is defined by its 3 x y z coordinates:

vert = [ 1 1 -1; -1 1 -1; -1 1 1; 1 1 1; -1 -1 1; 1 -1 1; 1 -1 -1; -1 -1 -1];

%These are the 6 faces of the cube, each is defined by connecting 4 of the available vertices:

fac = [1 2 3 4; 4 3 5 6; 6 7 8 5; 1 2 8 7; 6 7 1 4; 2 3 5 8];

%// How many small cube do we want

MainCubeSide = 2 ; %// dimension of the side of the main cube

nCubeOnSide = 5 ; %// number of small cube in one "row/column" of the main cube

nCubesTotal = nCubeOnSide^3 ; %// total number of s

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值