QhullRidge.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (c) 2008-2011 C.B. Barber. All rights reserved.
00004 ** $Id: //main/2011/qhull/src/libqhullcpp/QhullRidge.h#5 $$Change: 1352 $
00005 ** $DateTime: 2011/03/27 18:16:41 $$Author: bbarber $
00006 **
00007 ****************************************************************************/
00008 
00009 #ifndef QHULLRIDGE_H
00010 #define QHULLRIDGE_H
00011 
00012 #include "QhullSet.h"
00013 #include "QhullVertex.h"
00014 #include "QhullVertexSet.h"
00015 #include "QhullFacet.h"
00016 extern "C" {
00017     #include "libqhull/qhull_a.h"
00018 }
00019 
00020 #include <ostream>
00021 
00022 namespace orgQhull {
00023 
00024 #//ClassRef
00025     class QhullVertex;
00026     class QhullVertexSet;
00027     class QhullFacet;
00028 
00029 #//Types
00030 
00031     class QhullRidge;
00032     typedef QhullSet<QhullRidge>  QhullRidgeSet;
00033     typedef QhullSetIterator<QhullRidge>  QhullRidgeSetIterator;
00034 
00035     // see QhullSets.h for QhullRidgeSet and QhullRidgeSetIterator -- avoids circular references
00036 
00037 /************************
00038 a ridge is hull_dim-1 simplex between two neighboring facets.  If the
00039 facets are non-simplicial, there may be more than one ridge between
00040 two facets.  E.G. a 4-d hypercube has two triangles between each pair
00041 of neighboring facets.
00042 
00043 topological information:
00044     vertices            a set of vertices
00045     top,bottom          neighboring facets with orientation
00046 
00047 geometric information:
00048     tested              True if ridge is clearly convex
00049     nonconvex           True if ridge is non-convex
00050 */
00051 
00052 class QhullRidge {
00053 
00054 #//Fields
00055     ridgeT             *qh_ridge;
00056 
00057 #//Class objects
00058     static ridgeT       s_empty_ridge;
00059 
00060 public:
00061 #//Constants
00062 
00063 #//Constructors
00064                         QhullRidge() : qh_ridge(&s_empty_ridge) {}
00065                         // Creates an alias.  Does not copy QhullRidge.  Needed for return by value and parameter passing
00066                         QhullRidge(const QhullRidge &o) : qh_ridge(o.qh_ridge) {}
00067                         // Creates an alias.  Does not copy QhullRidge.  Needed for vector<QhullRidge>
00068     QhullRidge         &operator=(const QhullRidge &o) { qh_ridge= o.qh_ridge; return *this; }
00069                        ~QhullRidge() {}
00070 
00071 #//Conversion
00072                         //Implicit conversion from ridgeT
00073                         QhullRidge(ridgeT *r) : qh_ridge(r ? r : &s_empty_ridge) {}
00074     ridgeT             *getRidgeT() const { return qh_ridge; }
00075 
00076 #//QhullSet<QhullRidge>
00077     ridgeT             *getBaseT() const { return getRidgeT(); }
00078 
00079 #//getSet
00080     QhullFacet          bottomFacet() const { return QhullFacet(qh_ridge->bottom); }
00081     int                 dimension() const { return QhullSetBase::count(qh_ridge->vertices); }
00082     int                 id() const { return qh_ridge->id; }
00083     bool                isDefined() const { return qh_ridge != &s_empty_ridge; }
00084     bool                operator==(const QhullRidge &o) const { return qh_ridge==o.qh_ridge; }
00085     bool                operator!=(const QhullRidge &o) const { return !operator==(o); }
00086     QhullFacet          otherFacet(QhullFacet f) const { return QhullFacet(qh_ridge->top==f.getFacetT() ? qh_ridge->bottom : qh_ridge->top); }
00087     QhullFacet          topFacet() const { return QhullFacet(qh_ridge->top); }
00088 
00089 #//forEach
00090     bool                hasNextRidge3d(const QhullFacet f) const;
00091     QhullRidge          nextRidge3d(const QhullFacet f) const { return nextRidge3d(f, 0); }
00092     QhullRidge          nextRidge3d(const QhullFacet f, QhullVertex *nextVertex) const;
00093     QhullVertexSet      vertices() const { return QhullVertexSet(qh_ridge->vertices); }
00094 
00095 #//IO
00096 
00097     struct PrintRidge{
00098         const QhullRidge *ridge;
00099         int             run_id;
00100                         PrintRidge(int qhRunId, const QhullRidge &r) : ridge(&r), run_id(qhRunId) {}
00101     };//PrintRidge
00102     PrintRidge          print(int qhRunId) const { return PrintRidge(qhRunId, *this); }
00103 };//class QhullRidge
00104 
00105 }//namespace orgQhull
00106 
00107 std::ostream &operator<<(std::ostream &os, const orgQhull::QhullRidge &r); 
00108 std::ostream &operator<<(std::ostream &os, const orgQhull::QhullRidge::PrintRidge &pr);
00109 
00110 #endif // QHULLRIDGE_H


libqhull-ours
Author(s): Robert Krug
autogenerated on Mon Jan 6 2014 11:32:11