


creates a polytope object in V-representation (vertices)
Syntax: obtainVRep(object, param, dim)
obtainPolytope(object, ..) generates the specified object. Possible
definitions are given as follows, where brackets denote special bodies:
1D - line
2D - square, circle, polygon, (4-polygon-par)
3D - cube, sphere, cone, pyramid, bicone, bipyramid, prism,
(ikosaprism), (mixCubeOctahedron)
More details below.
obtainPolytope(.., param, ..) provides an additional parameter for the
specified object. For example, the number of corners of a polygon. The
parameter can be optional (e.g. number of corners to approximate a
circle) or not defined at all (e.g. for a square). Use param = [], if the
parameter is not required, but one of the following options is required.
obtainPolytope(.., dim, ..) Specifies the dimension of the object. If not
specified or dim = [] is used, the dimension of the object is dim = 3. If
dim is higher than the native dimension of the object (e.g. a 3D line),
the object is stretched with a very small size into this dimension(s).
See the following option for detail.
Comments on available objects:
CIRCLES and POLYGONES: Polygones are approximations of circles.
And polygones are created exactly in this manner from which follows that
polygones fit exactly in the unit-circle.
LINE, SQUARE and CUBE: These objects fill the interval [0 1] in the
appropriate coordinate directions.
PRISMS, ANTIPRISM, CONE, PYRAMID, BIPYRAMID and BICONE: These objects
are created starting with the two-dimensional basis and extended into
z-direction to span either the interval [0 1] (prism, antisprism,
pyramid, cone) or [-1 1] (bipyramid, bicone) on the z-axis.
See also: polytope, identifyPolytope, viewPolytope,
obtainHRep, stretchPolytope, movePolytope, convertPolytope

0001 function vrep = obtainVrep(object, param, dim) 0002 % creates a polytope object in V-representation (vertices) 0003 % 0004 % Syntax: obtainVRep(object, param, dim) 0005 % 0006 % obtainPolytope(object, ..) generates the specified object. Possible 0007 % definitions are given as follows, where brackets denote special bodies: 0008 % 1D - line 0009 % 2D - square, circle, polygon, (4-polygon-par) 0010 % 3D - cube, sphere, cone, pyramid, bicone, bipyramid, prism, 0011 % (ikosaprism), (mixCubeOctahedron) 0012 % More details below. 0013 % 0014 % obtainPolytope(.., param, ..) provides an additional parameter for the 0015 % specified object. For example, the number of corners of a polygon. The 0016 % parameter can be optional (e.g. number of corners to approximate a 0017 % circle) or not defined at all (e.g. for a square). Use param = [], if the 0018 % parameter is not required, but one of the following options is required. 0019 % 0020 % obtainPolytope(.., dim, ..) Specifies the dimension of the object. If not 0021 % specified or dim = [] is used, the dimension of the object is dim = 3. If 0022 % dim is higher than the native dimension of the object (e.g. a 3D line), 0023 % the object is stretched with a very small size into this dimension(s). 0024 % See the following option for detail. 0025 % 0026 % Comments on available objects: 0027 % 0028 % CIRCLES and POLYGONES: Polygones are approximations of circles. 0029 % And polygones are created exactly in this manner from which follows that 0030 % polygones fit exactly in the unit-circle. 0031 % 0032 % LINE, SQUARE and CUBE: These objects fill the interval [0 1] in the 0033 % appropriate coordinate directions. 0034 % 0035 % PRISMS, ANTIPRISM, CONE, PYRAMID, BIPYRAMID and BICONE: These objects 0036 % are created starting with the two-dimensional basis and extended into 0037 % z-direction to span either the interval [0 1] (prism, antisprism, 0038 % pyramid, cone) or [-1 1] (bipyramid, bicone) on the z-axis. 0039 % 0040 % See also: polytope, identifyPolytope, viewPolytope, 0041 % obtainHRep, stretchPolytope, movePolytope, convertPolytope 0042 0043 % The elk-library: convex geometry applied to crystallization modeling. 0044 % Copyright (C) 2012 Alexander Reinhold 0045 % 0046 % This program is free software: you can redistribute it and/or modify it 0047 % under the terms of the GNU General Public License as published by the 0048 % Free Software Foundation, either version 3 of the License, or (at your 0049 % option) any later version. 0050 % 0051 % This program is distributed in the hope that it will be useful, but 0052 % WITHOUT ANY WARRANTY; without even the implied warranty of 0053 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0054 % General Public License for more details. 0055 % 0056 % You should have received a copy of the GNU General Public License along 0057 % with this program. If not, see <http://www.gnu.org/licenses/>. 0058 0059 %% No object error 0060 if nargin < 1 || ~ischar(object) 0061 error('No object name is specified, try: help obtainPolytope');end 0062 0063 %% default parameters 0064 if ~exist('param', 'var'), param = [];end 0065 if ~exist('dim', 'var'), dim = 3;end 0066 0067 %% Generate object with specified dimension 0068 switch dim 0069 case 1 0070 vrep = obtainVrep1d(object); 0071 case 2 0072 vrep = obtainVrep2d(object, param); 0073 case 3 0074 vrep = obtainVrep3d(object, param); 0075 otherwise 0076 error(['I cannot obtain polytopes in dimension ' num2str(dim) '.']) 0077 end