QhullRidge.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/QhullRidge.h#3 $$Change: 2066 $
5 ** $DateTime: 2016/01/18 19:29:17 $$Author: bbarber $
6 **
7 ****************************************************************************/
8 
9 #ifndef QHULLRIDGE_H
10 #define QHULLRIDGE_H
11 
12 extern "C" {
13  #include "libqhull_r/qhull_ra.h"
14 }
15 #include "libqhullcpp/QhullSet.h"
18 #include "libqhullcpp/QhullFacet.h"
19 
20 #include <ostream>
21 
22 namespace orgQhull {
23 
24 #
25  class Qhull;
26  class QhullVertex;
27  class QhullVertexSet;
28  class QhullFacet;
29 
30 #
31  class QhullRidge;
33  typedef QhullSet<QhullRidge> QhullRidgeSet;
35  // see QhullSets.h for QhullRidgeSet and QhullRidgeSetIterator -- avoids circular references
36 
37 /************************
38 a ridge is hull_dim-1 simplex between two neighboring facets. If the
39 facets are non-simplicial, there may be more than one ridge between
40 two facets. E.G. a 4-d hypercube has two triangles between each pair
41 of neighboring facets.
42 
43 topological information:
44  vertices a set of vertices
45  top,bottom neighboring facets with orientation
46 
47 geometric information:
48  tested True if ridge is clearly convex
49  nonconvex True if ridge is non-convex
50 */
51 
52 class QhullRidge {
53 
54 #
55 public:
56  typedef ridgeT * base_type; // for QhullRidgeSet
57 
58 #
59 private:
62 
63 #
64  static ridgeT s_empty_ridge;
65 
66 public:
67 #
68 
69 #
70  QhullRidge() : qh_ridge(&s_empty_ridge), qh_qh(0) {}
71  explicit QhullRidge(const Qhull &q);
72  QhullRidge(const Qhull &q, ridgeT *r);
73  explicit QhullRidge(QhullQh *qqh) : qh_ridge(&s_empty_ridge), qh_qh(qqh) {}
74  QhullRidge(QhullQh *qqh, ridgeT *r) : qh_ridge(r ? r : &s_empty_ridge), qh_qh(qqh) {}
75  // Creates an alias. Does not copy QhullRidge. Needed for return by value and parameter passing
76  QhullRidge(const QhullRidge &other) : qh_ridge(other.qh_ridge), qh_qh(other.qh_qh) {}
77  // Creates an alias. Does not copy QhullRidge. Needed for vector<QhullRidge>
78  QhullRidge & operator=(const QhullRidge &other) { qh_ridge= other.qh_ridge; qh_qh= other.qh_qh; return *this; }
80 
81 #
82  QhullFacet bottomFacet() const { return QhullFacet(qh_qh, qh_ridge->bottom); }
83  int dimension() const { return ((qh_qh && qh_qh->hull_dim) ? qh_qh->hull_dim-1 : 0); }
84  ridgeT * getBaseT() const { return getRidgeT(); }
85  ridgeT * getRidgeT() const { return qh_ridge; }
86  countT id() const { return qh_ridge->id; }
87  bool isValid() const { return (qh_qh && qh_ridge != &s_empty_ridge); }
88  bool operator==(const QhullRidge &other) const { return qh_ridge==other.qh_ridge; }
89  bool operator!=(const QhullRidge &other) const { return !operator==(other); }
90  QhullFacet otherFacet(const QhullFacet &f) const { return QhullFacet(qh_qh, (qh_ridge->top==f.getFacetT() ? qh_ridge->bottom : qh_ridge->top)); }
91  QhullFacet topFacet() const { return QhullFacet(qh_qh, qh_ridge->top); }
92 
93 #
94  bool hasNextRidge3d(const QhullFacet &f) const;
95  QhullRidge nextRidge3d(const QhullFacet &f) const { return nextRidge3d(f, 0); }
96  QhullRidge nextRidge3d(const QhullFacet &f, QhullVertex *nextVertex) const;
97  QhullVertexSet vertices() const { return QhullVertexSet(qh_qh, qh_ridge->vertices); }
98 
99 #
100 
101  struct PrintRidge{
103  const char * print_message;
104  PrintRidge(const char *message, const QhullRidge &r) : ridge(&r), print_message(message) {}
105  };//PrintRidge
106  PrintRidge print(const char* message) const { return PrintRidge(message, *this); }
107 };//class QhullRidge
108 
109 }//namespace orgQhull
110 
111 std::ostream &operator<<(std::ostream &os, const orgQhull::QhullRidge &r);
112 std::ostream &operator<<(std::ostream &os, const orgQhull::QhullRidge::PrintRidge &pr);
113 
114 #endif // QHULLRIDGE_H
std::ostream & operator<<(std::ostream &os, const orgQhull::QhullRidge &r)
int hull_dim
Definition: libqhull.h:591
QhullRidge(QhullQh *qqh, ridgeT *r)
Definition: QhullRidge.h:74
bool operator!=(const QhullRidge &other) const
Definition: QhullRidge.h:89
QhullFacet otherFacet(const QhullFacet &f) const
Definition: QhullRidge.h:90
facetT * top
Definition: libqhull.h:374
QhullRidge – Qhull&#39;s ridge structure, ridgeT, as a C++ class.
Definition: Coordinates.cpp:21
bool operator==(const QhullRidge &other) const
Definition: QhullRidge.h:88
ridgeT * getRidgeT() const
Definition: QhullRidge.h:85
POD type equivalent to qhT. No virtual members.
Definition: QhullQh.h:58
QhullRidge(const QhullRidge &other)
Definition: QhullRidge.h:76
A QhullFacet is the C++ equivalent to Qhull&#39;s facetT*.
Definition: QhullFacet.h:37
Faster then interator/const_iterator due to T::base_type.
Definition: QhullSet.h:283
facetT * getFacetT() const
Definition: QhullFacet.h:71
facetT * bottom
Definition: libqhull.h:375
PrintRidge(const char *message, const QhullRidge &r)
Definition: QhullRidge.h:104
QhullRidge nextRidge3d(const QhullFacet &f) const
Definition: QhullRidge.h:95
QhullQh * qh_qh
QhullQh/qhT for ridgeT, may be 0.
Definition: QhullRidge.h:61
QhullSet< QhullRidge > QhullRidgeSet
Definition: QhullFacet.h:33
bool isValid() const
Definition: QhullRidge.h:87
Interface to Qhull from C++.
Definition: Qhull.h:43
countT id() const
Definition: QhullRidge.h:86
unsigned id
Definition: libqhull.h:376
QhullRidge & operator=(const QhullRidge &other)
Definition: QhullRidge.h:78
PrintRidge print(const char *message) const
Definition: QhullRidge.h:106
ridgeT * qh_ridge
Corresponding ridgeT, never 0.
Definition: QhullRidge.h:60
static ridgeT s_empty_ridge
Definition: QhullRidge.h:64
QhullRidge(QhullQh *qqh)
Definition: QhullRidge.h:73
setT * vertices
Definition: libqhull.h:372
ridgeT * getBaseT() const
For QhullSet<QhullRidge>
Definition: QhullRidge.h:84
QhullSetIterator< QhullRidge > QhullRidgeSetIterator
Definition: QhullRidge.h:34
QhullVertexSet vertices() const
Definition: QhullRidge.h:97
int dimension() const
Definition: QhullRidge.h:83
int countT
Definition: user_r.h:182
QhullFacet topFacet() const
Definition: QhullRidge.h:91
const char * print_message
non-null message
Definition: QhullRidge.h:103


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