📄 mkcube2.m
字号:
%MKCUBE Create vertices of a cube%% xyz = MKCUBE% xyz = MKCUBE(s)% xyz = MKCUBE(s, c)%% [x,y,z] = MKCUBE% [x,y,z] = MKCUBE(s)% [x,y,z] = MKCUBE(s, c)%% Return a 3-column matrix where each row contains the (x,y,z) coordinates% of a cubes vertices. The side length S defaults to 1. The centre% C = (x,y,z) defaults to (0,0,0).%% Alternatively the function can be called with 3 output arguments% which are vectors of X, Y an Z coordinates.%% Copyright (c) Peter Corke, 1999 Machine Vision Toolbox for Matlabfunction xyz = mkcube2(s, c) if nargin == 0, s = 1; c = [0 0 0]; elseif nargin == 1, c = [0 0 0]; end % cube has 12 edges cube = [ 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 0 0 0 1 0 1 1 0 0 1 1 0 1 1 0 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 1 0 1 0 1 1 0 ]; cube = cube * s; cube = cube - ones(length(cube),1) * [c+s/2 c+s/2]; xyz = cube;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -