QhullFacet.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (c) 2008-2015 C.B. Barber. All rights reserved.
4 ** $Id: //main/2015/qhull/src/libqhullcpp/QhullFacet.h#3 $$Change: 2066 $
5 ** $DateTime: 2016/01/18 19:29:17 $$Author: bbarber $
6 **
7 ****************************************************************************/
8 
9 #ifndef QHULLFACET_H
10 #define QHULLFACET_H
11 
12 extern "C" {
13  #include "libqhull_r/qhull_ra.h"
14 }
16 #include "libqhullcpp/QhullPoint.h"
17 #include "libqhullcpp/QhullSet.h"
19 
20 #include <ostream>
21 
22 namespace orgQhull {
23 
24 #
25  class Coordinates;
26  class Qhull;
27  class QhullFacetSet;
28  class QhullRidge;
29  class QhullVertex;
30  class QhullVertexSet;
31 
32 #
33  class QhullFacet;
34  typedef QhullSet<QhullRidge> QhullRidgeSet;
35 
37 class QhullFacet {
38 
39 #
40 public:
41  typedef facetT * base_type; // for QhullVertexSet
42 
43 private:
44 #
45  facetT * qh_facet;
46  QhullQh * qh_qh;
47 
48 #
49  static facetT s_empty_facet; // needed for shallow copy
50 
51 public:
52 #
53  QhullFacet() : qh_facet(&s_empty_facet), qh_qh(0) {}
54  explicit QhullFacet(const Qhull &q);
55  QhullFacet(const Qhull &q, facetT *f);
56  explicit QhullFacet(QhullQh *qqh) : qh_facet(&s_empty_facet), qh_qh(qqh) {}
57  QhullFacet(QhullQh *qqh, facetT *f) : qh_facet(f ? f : &s_empty_facet), qh_qh(qqh) {}
58  // Creates an alias. Does not copy QhullFacet. Needed for return by value and parameter passing
59  QhullFacet(const QhullFacet &other) : qh_facet(other.qh_facet ? other.qh_facet : &s_empty_facet), qh_qh(other.qh_qh) {}
60  // Creates an alias. Does not copy QhullFacet. Needed for vector<QhullFacet>
61  QhullFacet & operator=(const QhullFacet &other) { qh_facet= other.qh_facet ? other.qh_facet : &s_empty_facet; qh_qh= other.qh_qh; return *this; }
63 
64 
65 #
66  int dimension() const { return (qh_qh ? qh_qh->hull_dim : 0); }
69  facetT * getBaseT() const { return getFacetT(); }
70  // Do not define facetT(). It conflicts with return type facetT*
71  facetT * getFacetT() const { return qh_facet; }
73  countT id() const { return (qh_facet ? qh_facet->id : (int)qh_IDunknown); }
75  bool isValid() const { return qh_qh && qh_facet && qh_facet != &s_empty_facet; }
76  bool isGood() const { return qh_facet && qh_facet->good; }
77  bool isSimplicial() const { return qh_facet && qh_facet->simplicial; }
78  bool isTopOrient() const { return qh_facet && qh_facet->toporient; }
79  bool isTriCoplanar() const { return qh_facet && qh_facet->tricoplanar; }
80  bool isUpperDelaunay() const { return qh_facet && qh_facet->upperdelaunay; }
81  QhullFacet next() const { return QhullFacet(qh_qh, qh_facet->next); }
82  bool operator==(const QhullFacet &other) const { return qh_facet==other.qh_facet; }
83  bool operator!=(const QhullFacet &other) const { return !operator==(other); }
86  QhullQh * qh() const { return qh_qh; }
89 
90 #
91  double distance(const Coordinates &c) const { return distance(c.data()); }
93  double distance(const pointT *p) const { return distance(QhullPoint(qh_qh, const_cast<coordT *>(p))); }
94  double distance(const QhullPoint &p) const { return hyperplane().distance(p); }
95  double facetArea();
96 
97 #
98  // Can not inline. Otherwise circular reference
102  QhullRidgeSet ridges() const;
103  QhullVertexSet vertices() const;
104 
105 #
106  struct PrintCenter{
107  QhullFacet * facet; // non-const due to facet.center()
108  const char * message;
109  qh_PRINT print_format;
110  PrintCenter(QhullFacet &f, qh_PRINT printFormat, const char * s) : facet(&f), message(s), print_format(printFormat){}
111  };//PrintCenter
112  PrintCenter printCenter(qh_PRINT printFormat, const char *message) { return PrintCenter(*this, printFormat, message); }
113 
114  struct PrintFacet{
115  QhullFacet * facet; // non-const due to f->center()
116  const char * message;
117  explicit PrintFacet(QhullFacet &f, const char * s) : facet(&f), message(s) {}
118  };//PrintFacet
119  PrintFacet print(const char *message) { return PrintFacet(*this, message); }
120 
121  struct PrintFlags{
122  const QhullFacet *facet;
123  const char * message;
124  PrintFlags(const QhullFacet &f, const char *s) : facet(&f), message(s) {}
125  };//PrintFlags
126  PrintFlags printFlags(const char *message) const { return PrintFlags(*this, message); }
127 
128  struct PrintHeader{
129  QhullFacet * facet; // non-const due to f->center()
130  PrintHeader(QhullFacet &f) : facet(&f) {}
131  };//PrintHeader
132  PrintHeader printHeader() { return PrintHeader(*this); }
133 
134  struct PrintRidges{
136  PrintRidges(QhullFacet &f) : facet(&f) {}
137  };//PrintRidges
138  PrintRidges printRidges() { return PrintRidges(*this); }
139 
140 };//class QhullFacet
141 
142 }//namespace orgQhull
143 
144 #
145 
146 std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacet::PrintFacet &pr);
147 std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacet::PrintCenter &pr);
148 std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacet::PrintFlags &pr);
149 std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacet::PrintHeader &pr);
150 std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacet::PrintRidges &pr);
151 std::ostream &operator<<(std::ostream &os, orgQhull::QhullFacet &f); // non-const due to qh_getcenter()
152 
153 #endif // QHULLFACET_H
QhullHyperplane.h
facetT::tricoplanar
flagT tricoplanar
Definition: libqhull.h:314
orgQhull::QhullFacet::operator=
QhullFacet & operator=(const QhullFacet &other)
Definition: QhullFacet.h:67
orgQhull::QhullVertexSet
Definition: QhullVertexSet.h:33
coordT
#define coordT
Definition: libqhull.h:80
orgQhull::QhullRidgeSet
QhullSet< QhullRidge > QhullRidgeSet
Definition: QhullFacet.h:39
countT
int countT
Definition: user_r.h:182
orgQhull::QhullFacet::operator==
bool operator==(const QhullFacet &other) const
Definition: QhullFacet.h:88
print
void print(const Eigen::SparseMatrix< Scalar, Options > &mat)
orgQhull::QhullFacetSet
Definition: QhullFacetSet.h:33
orgQhull::QhullFacet::isTriCoplanar
bool isTriCoplanar() const
Definition: QhullFacet.h:85
orgQhull
QhullRidge – Qhull's ridge structure, ridgeT, as a C++ class.
Definition: Coordinates.cpp:21
orgQhull::QhullFacet::previous
QhullFacet previous() const
Definition: QhullFacet.h:91
QhullPointSet.h
orgQhull::QhullFacet::outsidePoints
QhullPointSet outsidePoints() const
Definition: QhullFacet.cpp:186
orgQhull::QhullFacet::qh_qh
QhullQh * qh_qh
QhullQh/qhT for facetT, may be 0.
Definition: QhullFacet.h:52
orgQhull::QhullPoint
Definition: QhullPoint.h:39
facetT::good
flagT good
Definition: libqhull.h:332
orgQhull::QhullPointSet
Definition: QhullPointSet.h:37
orgQhull::QhullFacet::QhullFacet
QhullFacet()
Definition: QhullFacet.h:59
orgQhull::QhullFacet::PrintFlags
Definition: QhullFacet.h:127
QhullSet.h
qh_IDunknown
@ qh_IDunknown
Definition: libqhull.h:99
facetT
Definition: libqhull.h:262
facetT::toporient
flagT toporient
Definition: libqhull.h:322
orgQhull::QhullFacet::PrintCenter
Definition: QhullFacet.h:112
orgQhull::QhullFacet::outerplane
QhullHyperplane outerplane() const
Definition: QhullFacet.cpp:119
orgQhull::QhullFacet::qh
QhullQh * qh() const
Definition: QhullFacet.h:92
orgQhull::QhullFacet::hyperplane
QhullHyperplane hyperplane() const
Definition: QhullFacet.h:78
orgQhull::QhullFacet::isValid
bool isValid() const
Definition: QhullFacet.h:81
orgQhull::QhullFacet::base_type
facetT * base_type
Definition: QhullFacet.h:47
orgQhull::QhullHyperplane::distance
double distance(const QhullPoint &p) const
Definition: QhullHyperplane.cpp:97
orgQhull::Qhull
Interface to Qhull from C++.
Definition: Qhull.h:49
orgQhull::QhullFacet::innerplane
QhullHyperplane innerplane() const
Definition: QhullFacet.cpp:104
orgQhull::QhullFacet::next
QhullFacet next() const
Definition: QhullFacet.h:87
orgQhull::QhullFacet::PrintFacet
Definition: QhullFacet.h:120
orgQhull::QhullFacet::PrintHeader::facet
QhullFacet * facet
Definition: QhullFacet.h:135
orgQhull::QhullSet
Definition: QhullSet.h:105
qh_PRINT
qh_PRINT
Definition: libqhull.h:161
orgQhull::QhullQh
POD type equivalent to qhT. No virtual members.
Definition: QhullQh.h:58
orgQhull::QhullFacet::isSimplicial
bool isSimplicial() const
Definition: QhullFacet.h:83
orgQhull::QhullHyperplane
Definition: QhullHyperplane.h:39
orgQhull::QhullFacet::vertices
QhullVertexSet vertices() const
Definition: QhullFacet.cpp:198
orgQhull::QhullFacet::id
countT id() const
Definition: QhullFacet.h:79
orgQhull::QhullFacet::getCenter
QhullPoint getCenter()
Definition: QhullFacet.h:73
qhull_ra.h
orgQhull::QhullFacet::tricoplanarOwner
QhullFacet tricoplanarOwner() const
Definition: QhullFacet.cpp:134
facetT::next
facetT * next
Definition: libqhull.h:294
orgQhull::QhullFacet::getFacetT
facetT * getFacetT() const
Definition: QhullFacet.h:77
orgQhull::QhullFacet::s_empty_facet
static facetT s_empty_facet
Definition: QhullFacet.h:55
facetT::simplicial
flagT simplicial
Definition: libqhull.h:324
orgQhull::QhullFacet::isGood
bool isGood() const
Definition: QhullFacet.h:82
orgQhull::QhullFacet
A QhullFacet is the C++ equivalent to Qhull's facetT*.
Definition: QhullFacet.h:43
QhullPoint.h
orgQhull::QhullFacet::ridges
QhullRidgeSet ridges() const
Definition: QhullFacet.cpp:192
orgQhull::QhullFacet::qh_facet
facetT * qh_facet
Corresponding facetT, may be 0 for corner cases (e.g., *facetSet.end()==0) and tricoplanarOwner()
Definition: QhullFacet.h:51
orgQhull::QhullFacet::~QhullFacet
~QhullFacet()
Definition: QhullFacet.h:68
pointT
#define pointT
Definition: libqhull.h:96
operator<<
std::ostream & operator<<(std::ostream &os, const orgQhull::QhullFacet::PrintFacet &pr)
orgQhull::QhullFacet::isUpperDelaunay
bool isUpperDelaunay() const
Definition: QhullFacet.h:86
orgQhull::QhullFacet::dimension
int dimension() const
Definition: QhullFacet.h:72
facetT::offset
coordT offset
Definition: libqhull.h:273
facetT::normal
coordT * normal
Definition: libqhull.h:274
orgQhull::QhullFacet::PrintHeader
Definition: QhullFacet.h:134
facetT::upperdelaunay
flagT upperdelaunay
Definition: libqhull.h:328
orgQhull::QhullFacet::isTopOrient
bool isTopOrient() const
Definition: QhullFacet.h:84
orgQhull::QhullFacet::PrintRidges
Definition: QhullFacet.h:140
facetT::id
unsigned id
Definition: libqhull.h:311
orgQhull::QhullFacet::neighborFacets
QhullFacetSet neighborFacets() const
Definition: QhullFacet.cpp:180
orgQhull::QhullFacet::facetArea
double facetArea()
Disables tricoplanarOwner()
Definition: QhullFacet.cpp:158
orgQhull::QhullFacet::voronoiVertex
QhullPoint voronoiVertex()
Definition: QhullFacet.cpp:146
orgQhull::QhullFacet::distance
double distance(const Coordinates &c) const
Undefined if c.size() != dimension()
Definition: QhullFacet.h:98
facetT::previous
facetT * previous
Definition: libqhull.h:293
qh_PRINTpoints
@ qh_PRINTpoints
Definition: libqhull.h:169
orgQhull::QhullFacet::coplanarPoints
QhullPointSet coplanarPoints() const
Definition: QhullFacet.cpp:174
orgQhull::QhullFacet::operator!=
bool operator!=(const QhullFacet &other) const
Definition: QhullFacet.h:89


hpp-fcl
Author(s):
autogenerated on Sat Nov 23 2024 03:44:58