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;
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); }
68  QhullPoint getCenter(qh_PRINT printFormat);
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;
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{
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
QhullRidgeSet ridges() const
Definition: QhullFacet.cpp:192
QhullHyperplane hyperplane() const
Definition: QhullFacet.h:72
QhullHyperplane innerplane() const
Definition: QhullFacet.cpp:104
QhullFacet(QhullQh *qqh)
Definition: QhullFacet.h:56
QhullRidge – Qhull&#39;s ridge structure, ridgeT, as a C++ class.
Definition: Coordinates.cpp:21
bool isValid() const
Definition: QhullFacet.h:75
PrintCenter(QhullFacet &f, qh_PRINT printFormat, const char *s)
Definition: QhullFacet.h:110
POD type equivalent to qhT. No virtual members.
Definition: QhullQh.h:58
bool isSimplicial() const
Definition: QhullFacet.h:77
#define pointT
Definition: libqhull.h:96
A QhullFacet is the C++ equivalent to Qhull&#39;s facetT*.
Definition: QhullFacet.h:37
QhullPointSet coplanarPoints() const
Definition: QhullFacet.cpp:174
facetT * previous
Definition: libqhull.h:293
bool isTopOrient() const
Definition: QhullFacet.h:78
countT id() const
Definition: QhullFacet.h:73
QhullPoint voronoiVertex()
Definition: QhullFacet.cpp:146
QhullPoint getCenter()
Definition: QhullFacet.h:67
double distance(const QhullPoint &p) const
Definition: QhullFacet.h:94
double facetArea()
Disables tricoplanarOwner()
Definition: QhullFacet.cpp:158
facetT * getFacetT() const
Definition: QhullFacet.h:71
QhullVertexSet vertices() const
Definition: QhullFacet.cpp:198
double distance(const QhullPoint &p) const
bool operator!=(const QhullFacet &other) const
Definition: QhullFacet.h:83
QhullFacet previous() const
Definition: QhullFacet.h:85
PrintFlags printFlags(const char *message) const
Definition: QhullFacet.h:126
QhullQh * qh_qh
QhullQh/qhT for facetT, may be 0.
Definition: QhullFacet.h:46
static facetT s_empty_facet
Definition: QhullFacet.h:49
flagT simplicial
Definition: libqhull.h:324
bool isUpperDelaunay() const
Definition: QhullFacet.h:80
int dimension() const
Definition: QhullFacet.h:66
facetT * qh_facet
Corresponding facetT, may be 0 for corner cases (e.g., *facetSet.end()==0) and tricoplanarOwner() ...
Definition: QhullFacet.h:45
flagT upperdelaunay
Definition: libqhull.h:328
PrintRidges printRidges()
Definition: QhullFacet.h:138
QhullSet< QhullRidge > QhullRidgeSet
Definition: QhullFacet.h:33
QhullFacetSet neighborFacets() const
Definition: QhullFacet.cpp:180
qh_PRINT
Definition: libqhull.h:161
Interface to Qhull from C++.
Definition: Qhull.h:43
PrintHeader printHeader()
Definition: QhullFacet.h:132
PrintFlags(const QhullFacet &f, const char *s)
Definition: QhullFacet.h:124
QhullQh * qh() const
Definition: QhullFacet.h:86
std::ostream & operator<<(std::ostream &os, const orgQhull::QhullFacet::PrintFacet &pr)
facetT * next
Definition: libqhull.h:294
QhullFacet & operator=(const QhullFacet &other)
Definition: QhullFacet.h:61
QhullHyperplane outerplane() const
Definition: QhullFacet.cpp:119
bool isTriCoplanar() const
Definition: QhullFacet.h:79
facetT * getBaseT() const
For QhullSet<QhullFacet>
Definition: QhullFacet.h:69
coordT offset
Definition: libqhull.h:273
flagT good
Definition: libqhull.h:332
PrintFacet print(const char *message)
Definition: QhullFacet.h:119
bool operator==(const QhullFacet &other) const
Definition: QhullFacet.h:82
PrintFacet(QhullFacet &f, const char *s)
Definition: QhullFacet.h:117
QhullPointSet outsidePoints() const
Definition: QhullFacet.cpp:186
QhullFacet next() const
Definition: QhullFacet.h:81
PrintCenter printCenter(qh_PRINT printFormat, const char *message)
Definition: QhullFacet.h:112
QhullFacet(const QhullFacet &other)
Definition: QhullFacet.h:59
QhullFacet(QhullQh *qqh, facetT *f)
Definition: QhullFacet.h:57
int countT
Definition: user_r.h:182
flagT toporient
Definition: libqhull.h:322
double distance(const pointT *p) const
Definition: QhullFacet.h:93
unsigned id
Definition: libqhull.h:311
bool isGood() const
Definition: QhullFacet.h:76
coordT * normal
Definition: libqhull.h:274
QhullFacet tricoplanarOwner() const
Definition: QhullFacet.cpp:134
flagT tricoplanar
Definition: libqhull.h:314


hpp-fcl
Author(s):
autogenerated on Fri Jun 2 2023 02:39:02