function Hrep = obtainHrep(object, param, dim)
% creates a polytope object in H-representation (halfspaces)
%
% Syntax: obtainHRep(object, param, dim, flatness)
% 
% 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, 
%           obtainVRep, stretchPolytope, movePolytope, convertPolytope

% The elk-library: convex geometry applied to crystallization modeling.
%   Copyright (C) 2012 Alexander Reinhold
%
% This program is free software: you can redistribute it and/or modify it 
%   under the terms of the GNU General Public License as published by the 
%   Free Software Foundation, either version 3 of the License, or (at your 
%   option) any later version.
%
% This program is distributed in the hope that it will be useful, but 
%   WITHOUT ANY WARRANTY; without even the implied warranty of 
%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
%   General Public License for more details.
%
% You should have received a copy of the GNU General Public License along 
%   with this program.  If not, see <http://www.gnu.org/licenses/>.

%% No object error
if nargin < 1 || ~ischar(object)
    error('No object name is specified, try: help obtainPolytope');end

%% default parameters
if ~exist('param', 'var'), param = [];end
if ~exist('dim', 'var'), dim = 3;end

%% Generate object
Hrep = convertVrepToHrep(obtainVrep(object, param, dim), elkZerotol);
Hrep = normalizeHrep(Hrep);
