mkcube2.m

来自「来自澳大利亚Qeensland大学的计算机视觉Matlab工具箱。 This 」· M 代码 · 共 53 行

M
53
字号
%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 + =
减小字号Ctrl + -
显示快捷键?