


This is a subfunction. See also: obtainVRep, obtainHRep


0001 function vrep = obtainVrep2d(choice, param) 0002 % This is a subfunction. 0003 % 0004 % See also: obtainVRep, obtainHRep 0005 0006 % The elk-library: convex geometry applied to crystallization modeling. 0007 % Copyright (C) 2012 Alexander Reinhold 0008 % 0009 % This program is free software: you can redistribute it and/or modify it 0010 % under the terms of the GNU General Public License as published by the 0011 % Free Software Foundation, either version 3 of the License, or (at your 0012 % option) any later version. 0013 % 0014 % This program is distributed in the hope that it will be useful, but 0015 % WITHOUT ANY WARRANTY; without even the implied warranty of 0016 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0017 % General Public License for more details. 0018 % 0019 % You should have received a copy of the GNU General Public License along 0020 % with this program. If not, see <http://www.gnu.org/licenses/>. 0021 0022 switch choice 0023 % common bodies 0024 case 'square' 0025 vrep.V = [0 0;0 1;1 0;1 1]; 0026 case 'circle' 0027 if isempty(param), param=20;end 0028 vrep = obtainCircle(param); 0029 case 'polygon' 0030 % polygons are just bad approximation of circles: 0031 vrep = obtainVrep2d('circle', param); 0032 0033 % special bodies 0034 case '4-polygon-par' 0035 vrep.V = [0 0;cos(pi/6) sin(pi/6);cos(pi/6) -sin(pi/6);2*cos(pi/6) 0]; 0036 0037 % recursion into lower dimension 0038 otherwise 0039 vrep = obtainVrep1d(choice); 0040 % extend dimension 0041 vrep.V(:,2) = 0; 0042 end