PointCoordinates.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (c) 2009-2015 C.B. Barber. All rights reserved.
4 ** $Id: //main/2015/qhull/src/libqhullcpp/PointCoordinates.h#3 $$Change: 2066 $
5 ** $DateTime: 2016/01/18 19:29:17 $$Author: bbarber $
6 **
7 ****************************************************************************/
8 
9 #ifndef QHPOINTCOORDINATES_H
10 #define QHPOINTCOORDINATES_H
11 
12 extern "C" {
13  #include "libqhull_r/qhull_ra.h"
14 }
17 
18 #include <ostream>
19 #include <string>
20 
21 #ifndef QHULL_NO_STL
22 #include <vector>
23 #endif
24 
25 namespace orgQhull {
26 
27 #
28  class PointCoordinates;
31 
32 class PointCoordinates : public QhullPoints {
33 
34 private:
35 #
36  Coordinates point_coordinates;
37  std::string describe_points;
39 
40 public:
41 #
42  PointCoordinates();
45  explicit PointCoordinates(const std::string &aComment);
46  PointCoordinates(int pointDimension, const std::string &aComment);
48  explicit PointCoordinates(const Qhull &q);
49  PointCoordinates(const Qhull &q, const std::string &aComment);
50  PointCoordinates(const Qhull &q, int pointDimension, const std::string &aComment);
51  PointCoordinates(const Qhull &q, int pointDimension, const std::string &aComment, countT coordinatesCount, const coordT *c); // may be invalid
53  explicit PointCoordinates(QhullQh *qqh);
54  PointCoordinates(QhullQh *qqh, const std::string &aComment);
55  PointCoordinates(QhullQh *qqh, int pointDimension, const std::string &aComment);
56  PointCoordinates(QhullQh *qqh, int pointDimension, const std::string &aComment, countT coordinatesCount, const coordT *c); // may be invalid
58  PointCoordinates(const PointCoordinates &other);
61 
62 #
63 #ifndef QHULL_NO_STL
65  void append(const std::vector<coordT> &otherCoordinates) { if(!otherCoordinates.empty()){ append((int)otherCoordinates.size(), &otherCoordinates[0]); } }
66  std::vector<coordT> toStdVector() const { return point_coordinates.toStdVector(); }
67 #endif //QHULL_NO_STL
68 #ifdef QHULL_USES_QT
69  void append(const QList<coordT> &pointCoordinates) { if(!pointCoordinates.isEmpty()){ append(pointCoordinates.count(), &pointCoordinates[0]); } }
70  QList<coordT> toQList() const { return point_coordinates.toQList(); }
71 #endif //QHULL_USES_QT
72 
73 #
74  void checkValid() const;
76  std::string comment() const { return describe_points; }
78  const Coordinates & getCoordinates() const { return point_coordinates; }
79  void setComment(const std::string &s) { describe_points= s; }
80  void setDimension(int i);
81 
82 private:
84  void defineAs(countT coordinatesCount, coordT *c) { QhullPoints::defineAs(coordinatesCount, c); }
85 public:
86 
87 #
88 
90 #
91  Coordinates::ConstIterator beginCoordinates() const { return point_coordinates.begin(); }
98 
99 #
100 
102 #
103  PointCoordinates operator+(const PointCoordinates &other) const;
104 
105 #
106  //FIXUP QH11001: Add clear() and other modify operators from Coordinates.h. Include QhullPoint::operator=()
107  void append(countT coordinatesCount, const coordT *c);
108  void append(const coordT &c) { append(1, &c); }
109  void append(const QhullPoint &p);
111  void append(const Coordinates &c) { append(c.count(), c.data()); }
112  void append(const PointCoordinates &other);
113  void appendComment(const std::string &s);
114  void appendPoints(std::istream &in);
115  PointCoordinates & operator+=(const PointCoordinates &other) { append(other); return *this; }
116  PointCoordinates & operator+=(const coordT &c) { append(c); return *this; }
117  PointCoordinates & operator+=(const QhullPoint &p) { append(p); return *this; }
118  PointCoordinates & operator<<(const PointCoordinates &other) { return *this += other; }
119  PointCoordinates & operator<<(const coordT &c) { return *this += c; }
120  PointCoordinates & operator<<(const QhullPoint &p) { return *this += p; }
121  // reserve() is non-const
122  void reserveCoordinates(countT newCoordinates);
123 
124 #
125 private:
126  int indexOffset(int i) const;
127 
128 };//PointCoordinates
129 
130 // No references to QhullPoint. Prevents use of QHULL_DECLARE_SEQUENTIAL_ITERATOR(PointCoordinates, QhullPoint)
132 {
134 
135 private:
137  const_iterator i;
138 
139 public:
140  PointCoordinatesIterator(const PointCoordinates &container) : c(&container), i(c->constBegin()) {}
141  PointCoordinatesIterator &operator=(const PointCoordinates &container) { c = &container; i = c->constBegin(); return *this; }
142 
143  void toFront() { i = c->constBegin(); }
144  void toBack() { i = c->constEnd(); }
145  bool hasNext() const { return i != c->constEnd(); }
146  const QhullPoint next() { return *i++; }
147  const QhullPoint peekNext() const { return *i; }
148  bool hasPrevious() const { return i != c->constBegin(); }
149  const QhullPoint previous() { return *--i; }
150  const QhullPoint peekPrevious() const { const_iterator p = i; return *--p; }
151  bool findNext(const QhullPoint &t) { while(i != c->constEnd()){ if (*i++ == t) return true;} return false; }
152  bool findPrevious(const QhullPoint &t) { while(i != c->constBegin()){ if (*(--i) == t) return true;} return false; }
153 };//CoordinatesIterator
154 
155 // FIXUP QH11002: Add MutablePointCoordinatesIterator after adding modify operators
156 \
157 }//namespace orgQhull
158 
159 #
160 
161 std::ostream & operator<<(std::ostream &os, const orgQhull::PointCoordinates &p);
162 
163 #endif // QHPOINTCOORDINATES_H
void append(const Coordinates &c)
See convert for std::vector and QList.
PointCoordinates & operator=(const PointCoordinates &other)
const QhullPoint peekNext() const
void defineAs(int pointDimension, countT coordinatesCount, coordT *c)
Definition: QhullPoints.h:89
QhullRidge – Qhull&#39;s ridge structure, ridgeT, as a C++ class.
Definition: Coordinates.cpp:21
void defineAs(countT coordinatesCount, coordT *c)
disable QhullPoints.defineAs()
Coordinates::ConstIterator beginCoordinates() const
See QhullPoints for begin, constBegin, end.
POD type equivalent to qhT. No virtual members.
Definition: QhullQh.h:58
ConstIterator constEnd() const
Definition: QhullPoints.h:83
countT count() const
Definition: Coordinates.h:72
PointCoordinates & operator+=(const coordT &c)
Coordinates::ConstIterator endCoordinates() const
PointCoordinates & operator<<(const coordT &c)
Java-style iterator.
Definition: QhullPoints.h:28
c
Coordinates::Iterator beginCoordinates()
#define coordT
Definition: libqhull.h:80
void appendPoints(std::istream &in)
void reserveCoordinates(countT newCoordinates)
Coordinates::Iterator endCoordinates()
void appendComment(const std::string &s)
Interface to Qhull from C++.
Definition: Qhull.h:43
bool findPrevious(const QhullPoint &t)
PointCoordinates & operator<<(const QhullPoint &p)
bool findNext(const QhullPoint &t)
void append(const coordT &c)
Dimension previously defined.
ConstIterator constBegin() const
Definition: QhullPoints.h:81
void append(const std::vector< coordT > &otherCoordinates)
QhullPoints coordinates, constData, data, count, size.
PointCoordinates & operator+=(const QhullPoint &p)
std::vector< coordT > toStdVector() const
PointCoordinatesIterator & operator=(const PointCoordinates &container)
PointCoordinates::const_iterator const_iterator
PointCoordinates & operator<<(const PointCoordinates &other)
std::string comment() const
const Coordinates & getCoordinates() const
PointCoordinatesIterator(const PointCoordinates &container)
std::vector< coordT > toStdVector() const
Definition: Coordinates.h:65
int countT
Definition: user_r.h:182
PointCoordinates & operator+=(const PointCoordinates &other)
const QhullPoint peekPrevious() const
void setComment(const std::string &s)


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