File indexing completed on 2025-01-18 10:01:56
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef QHULLVERTEX_H
0010 #define QHULLVERTEX_H
0011
0012 #include "libqhull_r/qhull_ra.h"
0013 #include "libqhullcpp/QhullPoint.h"
0014 #include "libqhullcpp/QhullLinkedList.h"
0015 #include "libqhullcpp/QhullSet.h"
0016
0017 #include <ostream>
0018
0019 namespace orgQhull {
0020
0021 #
0022 class QhullFacetSet;
0023
0024 #
0025
0026 class QhullVertex;
0027 typedef QhullLinkedList<QhullVertex> QhullVertexList;
0028 typedef QhullLinkedListIterator<QhullVertex> QhullVertexListIterator;
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 class QhullVertex {
0041
0042 #
0043 public:
0044 typedef vertexT * base_type;
0045
0046 private:
0047 #
0048 vertexT * qh_vertex;
0049 QhullQh * qh_qh;
0050
0051 #
0052 static vertexT s_empty_vertex;
0053
0054 public:
0055 #
0056
0057 #
0058 QhullVertex() : qh_vertex(&s_empty_vertex), qh_qh(0) {}
0059 explicit QhullVertex(const Qhull &q);
0060 QhullVertex(const Qhull &q, vertexT *v);
0061 explicit QhullVertex(QhullQh *qqh) : qh_vertex(&s_empty_vertex), qh_qh(qqh) {}
0062 QhullVertex(QhullQh *qqh, vertexT *v) : qh_vertex(v ? v : &s_empty_vertex), qh_qh(qqh) {}
0063
0064 QhullVertex(const QhullVertex &other);
0065
0066 QhullVertex & operator=(const QhullVertex &other) { qh_vertex= other.qh_vertex; qh_qh= other.qh_qh; return *this; }
0067 ~QhullVertex() {}
0068
0069 #
0070 int dimension() const { return (qh_qh ? qh_qh->hull_dim : 0); }
0071 vertexT * getBaseT() const { return getVertexT(); }
0072 vertexT * getVertexT() const { return qh_vertex; }
0073 bool hasNext() const { return (qh_vertex->next != NULL && qh_vertex->next != qh_qh->vertex_tail); }
0074 bool hasPrevious() const { return (qh_vertex->previous != NULL); }
0075 countT id() const { return qh_vertex->id; }
0076 bool isValid() const { return (qh_qh && qh_vertex != &s_empty_vertex); }
0077
0078 bool neighborFacetsDefined() const { return qh_vertex->neighbors != 0; }
0079 QhullVertex next() const { return QhullVertex(qh_qh, qh_vertex->next); }
0080 bool operator==(const QhullVertex &other) const { return qh_vertex==other.qh_vertex; }
0081 bool operator!=(const QhullVertex &other) const { return !operator==(other); }
0082 QhullPoint point() const { return QhullPoint(qh_qh, qh_vertex->point); }
0083 QhullVertex previous() const { return QhullVertex(qh_qh, qh_vertex->previous); }
0084 QhullQh * qh() const { return qh_qh; }
0085 void setVertexT(QhullQh *qqh, vertexT *vertex) { qh_qh= qqh; qh_vertex= vertex; }
0086
0087 #
0088
0089 QhullFacetSet neighborFacets() const;
0090
0091 #
0092 struct PrintVertex{
0093 const QhullVertex *vertex;
0094 const char * print_message;
0095 PrintVertex(const char *message, const QhullVertex &v) : vertex(&v), print_message(message) {}
0096 };
0097 PrintVertex print(const char *message) const { return PrintVertex(message, *this); }
0098 };
0099
0100 }
0101
0102 #
0103
0104 std::ostream &operator<<(std::ostream &os, const orgQhull::QhullVertex::PrintVertex &pr);
0105 inline std::ostream &operator<<(std::ostream &os, const orgQhull::QhullVertex &v) { os << v.print(""); return os; }
0106
0107 #endif