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;
34  typedef QhullSetIterator<QhullRidge> QhullRidgeSetIterator;
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:
60  ridgeT * qh_ridge;
61  QhullQh * qh_qh;
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;
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
QhullFacet.h
orgQhull::QhullVertexSet
Definition: QhullVertexSet.h:33
ridgeT::vertices
setT * vertices
Definition: libqhull.h:372
orgQhull::QhullRidgeSet
QhullSet< QhullRidge > QhullRidgeSet
Definition: QhullFacet.h:39
countT
int countT
Definition: user_r.h:182
orgQhull::QhullRidge::vertices
QhullVertexSet vertices() const
Definition: QhullRidge.h:116
orgQhull
QhullRidge – Qhull's ridge structure, ridgeT, as a C++ class.
Definition: Coordinates.cpp:21
qhT::hull_dim
int hull_dim
Definition: libqhull.h:591
orgQhull::QhullRidge::PrintRidge::PrintRidge
PrintRidge(const char *message, const QhullRidge &r)
Definition: QhullRidge.h:123
orgQhull::QhullRidge::PrintRidge::print_message
const char * print_message
non-null message
Definition: QhullRidge.h:122
orgQhull::QhullRidge::QhullRidge
QhullRidge()
Definition: QhullRidge.h:89
orgQhull::QhullVertex
Definition: QhullVertex.h:48
orgQhull::QhullRidge::operator=
QhullRidge & operator=(const QhullRidge &other)
Definition: QhullRidge.h:97
QhullSet.h
QhullVertexSet.h
octree.r
r
Definition: octree.py:9
ridgeT::bottom
facetT * bottom
Definition: libqhull.h:375
orgQhull::QhullRidge::qh_ridge
ridgeT * qh_ridge
Corresponding ridgeT, never 0.
Definition: QhullRidge.h:79
ridgeT::top
facetT * top
Definition: libqhull.h:374
orgQhull::QhullRidge::print
PrintRidge print(const char *message) const
Definition: QhullRidge.h:125
ridgeT::id
unsigned id
Definition: libqhull.h:376
orgQhull::QhullRidge::s_empty_ridge
static ridgeT s_empty_ridge
Definition: QhullRidge.h:83
orgQhull::QhullRidge::getRidgeT
ridgeT * getRidgeT() const
Definition: QhullRidge.h:104
orgQhull::Qhull
Interface to Qhull from C++.
Definition: Qhull.h:49
orgQhull::QhullRidgeSetIterator
QhullSetIterator< QhullRidge > QhullRidgeSetIterator
Definition: QhullRidge.h:40
orgQhull::QhullRidge::~QhullRidge
~QhullRidge()
Definition: QhullRidge.h:98
orgQhull::QhullRidge::PrintRidge::ridge
const QhullRidge * ridge
Definition: QhullRidge.h:121
orgQhull::QhullRidge::operator==
bool operator==(const QhullRidge &other) const
Definition: QhullRidge.h:107
orgQhull::QhullRidge
Definition: QhullRidge.h:58
orgQhull::QhullRidge::PrintRidge
Definition: QhullRidge.h:120
ridgeT
Definition: libqhull.h:371
orgQhull::QhullQh
POD type equivalent to qhT. No virtual members.
Definition: QhullQh.h:58
qhull_ra.h
orgQhull::QhullRidge::topFacet
QhullFacet topFacet() const
Definition: QhullRidge.h:110
orgQhull::QhullRidge::dimension
int dimension() const
Definition: QhullRidge.h:102
orgQhull::QhullFacet::getFacetT
facetT * getFacetT() const
Definition: QhullFacet.h:77
orgQhull::QhullFacet
A QhullFacet is the C++ equivalent to Qhull's facetT*.
Definition: QhullFacet.h:43
orgQhull::QhullRidge::operator!=
bool operator!=(const QhullRidge &other) const
Definition: QhullRidge.h:108
orgQhull::QhullRidge::nextRidge3d
QhullRidge nextRidge3d(const QhullFacet &f) const
Definition: QhullRidge.h:114
orgQhull::QhullRidge::base_type
ridgeT * base_type
Definition: QhullRidge.h:75
operator<<
std::ostream & operator<<(std::ostream &os, const orgQhull::QhullRidge &r)
orgQhull::QhullRidge::otherFacet
QhullFacet otherFacet(const QhullFacet &f) const
Definition: QhullRidge.h:109
orgQhull::QhullRidge::id
countT id() const
Definition: QhullRidge.h:105
orgQhull::QhullRidge::qh_qh
QhullQh * qh_qh
QhullQh/qhT for ridgeT, may be 0.
Definition: QhullRidge.h:80
QhullVertex.h
orgQhull::QhullRidge::isValid
bool isValid() const
Definition: QhullRidge.h:106


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