


Obtain the V-representation of an approximized two-dimensional sphere This is a subfunction used by obtainVrep. Use obtainVrep instead. See also: obtainVRep, obtainHRep


0001 function vrep = obtainSphere(n) 0002 % Obtain the V-representation of an approximized two-dimensional sphere 0003 % 0004 % This is a subfunction used by obtainVrep. Use obtainVrep instead. 0005 % 0006 % See also: obtainVRep, obtainHRep 0007 0008 % The elk-library: convex geometry applied to crystallization modeling. 0009 % Copyright (C) 2012 Alexander Reinhold 0010 % 0011 % This program is free software: you can redistribute it and/or modify it 0012 % under the terms of the GNU General Public License as published by the 0013 % Free Software Foundation, either version 3 of the License, or (at your 0014 % option) any later version. 0015 % 0016 % This program is distributed in the hope that it will be useful, but 0017 % WITHOUT ANY WARRANTY; without even the implied warranty of 0018 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0019 % General Public License for more details. 0020 % 0021 % You should have received a copy of the GNU General Public License along 0022 % with this program. If not, see <http://www.gnu.org/licenses/>. 0023 0024 phi = 0:(pi/n):(pi-pi/n/2); 0025 theta = 0:(pi/n):(2*pi-pi/n/2); 0026 0027 phi = ones(2*n,1)*phi; 0028 theta = theta'*ones(1,n); 0029 0030 X = sin(theta).*cos(phi); 0031 Y = sin(theta).*sin(phi); 0032 Z = cos(theta); 0033 0034 vrep.V(:,1) = X(:); 0035 vrep.V(:,2) = Y(:); 0036 vrep.V(:,3) = Z(:);