File indexing completed on 2025-01-18 10:01:56
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef QHULLRIDGE_H
0010 #define QHULLRIDGE_H
0011
0012 #include "libqhull_r/qhull_ra.h"
0013 #include "libqhullcpp/QhullSet.h"
0014 #include "libqhullcpp/QhullVertex.h"
0015 #include "libqhullcpp/QhullVertexSet.h"
0016 #include "libqhullcpp/QhullFacet.h"
0017
0018 #include <ostream>
0019
0020 namespace orgQhull {
0021
0022 #
0023 class Qhull;
0024 class QhullVertex;
0025 class QhullVertexSet;
0026 class QhullFacet;
0027
0028 #
0029
0030 class QhullRidge;
0031
0032 typedef QhullSet<QhullRidge> QhullRidgeSet;
0033
0034
0035
0036
0037 typedef QhullSetIterator<QhullRidge> QhullRidgeSetIterator;
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054 class QhullRidge {
0055
0056 #
0057 public:
0058 typedef ridgeT * base_type;
0059
0060 #
0061 private:
0062 ridgeT * qh_ridge;
0063 QhullQh * qh_qh;
0064
0065 #
0066 static ridgeT s_empty_ridge;
0067
0068 public:
0069 #
0070
0071 #
0072 QhullRidge() : qh_ridge(&s_empty_ridge), qh_qh(0) {}
0073 explicit QhullRidge(const Qhull &q);
0074 QhullRidge(const Qhull &q, ridgeT *r);
0075 explicit QhullRidge(QhullQh *qqh) : qh_ridge(&s_empty_ridge), qh_qh(qqh) {}
0076 QhullRidge(QhullQh *qqh, ridgeT *r) : qh_ridge(r ? r : &s_empty_ridge), qh_qh(qqh) {}
0077
0078 QhullRidge(const QhullRidge &other) : qh_ridge(other.qh_ridge), qh_qh(other.qh_qh) {}
0079
0080 QhullRidge & operator=(const QhullRidge &other) { qh_ridge= other.qh_ridge; qh_qh= other.qh_qh; return *this; }
0081 ~QhullRidge() {}
0082
0083 #
0084 QhullFacet bottomFacet() const { return QhullFacet(qh_qh, qh_ridge->bottom); }
0085 int dimension() const { return ((qh_qh && qh_qh->hull_dim) ? qh_qh->hull_dim-1 : 0); }
0086 ridgeT * getBaseT() const { return getRidgeT(); }
0087 ridgeT * getRidgeT() const { return qh_ridge; }
0088 countT id() const { return qh_ridge->id; }
0089 bool isValid() const { return (qh_qh && qh_ridge != &s_empty_ridge); }
0090 bool operator==(const QhullRidge &other) const { return qh_ridge==other.qh_ridge; }
0091 bool operator!=(const QhullRidge &other) const { return !operator==(other); }
0092 QhullFacet otherFacet(const QhullFacet &f) const { return QhullFacet(qh_qh, (qh_ridge->top==f.getFacetT() ? qh_ridge->bottom : qh_ridge->top)); }
0093 QhullQh * qh() const { return qh_qh; }
0094 void setRidgeT(QhullQh *qqh, ridgeT *ridge) { qh_qh= qqh; qh_ridge= ridge; }
0095 QhullFacet topFacet() const { return QhullFacet(qh_qh, qh_ridge->top); }
0096
0097 #
0098 bool hasNextRidge3d(const QhullFacet &f) const;
0099 QhullRidge nextRidge3d(const QhullFacet &f) const { return nextRidge3d(f, 0); }
0100 QhullRidge nextRidge3d(const QhullFacet &f, QhullVertex *nextVertex) const;
0101 QhullVertexSet vertices() const { return QhullVertexSet(qh_qh, qh_ridge->vertices); }
0102
0103 #
0104
0105 struct PrintRidge{
0106 const QhullRidge *ridge;
0107 const char * print_message;
0108 PrintRidge(const char *message, const QhullRidge &r) : ridge(&r), print_message(message) {}
0109 };
0110 PrintRidge print(const char* message) const { return PrintRidge(message, *this); }
0111 };
0112
0113 }
0114
0115 std::ostream &operator<<(std::ostream &os, const orgQhull::QhullRidge &r);
0116 std::ostream &operator<<(std::ostream &os, const orgQhull::QhullRidge::PrintRidge &pr);
0117
0118 #endif