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:
136  const PointCoordinates *c;
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
Coordinates.h
orgQhull::QhullPoints::const_iterator
Definition: QhullPoints.h:189
orgQhull::PointCoordinates::reserveCoordinates
void reserveCoordinates(countT newCoordinates)
Definition: PointCoordinates.cpp:297
orgQhull::PointCoordinatesIterator::peekNext
const QhullPoint peekNext() const
Definition: PointCoordinates.h:153
coordT
#define coordT
Definition: libqhull.h:80
countT
int countT
Definition: user_r.h:182
orgQhull::Coordinates::data
coordT * data()
Definition: Coordinates.h:79
orgQhull::PointCoordinates::describe_points
std::string describe_points
Definition: PointCoordinates.h:44
QhullPoints.h
orgQhull::Coordinates::count
countT count() const
Definition: Coordinates.h:78
orgQhull
QhullRidge – Qhull's ridge structure, ridgeT, as a C++ class.
Definition: Coordinates.cpp:21
orgQhull::PointCoordinates
Definition: PointCoordinates.h:38
orgQhull::QhullPoints::constBegin
ConstIterator constBegin() const
Definition: QhullPoints.h:87
orgQhull::QhullPoint
Definition: QhullPoint.h:39
orgQhull::PointCoordinatesIterator::previous
const QhullPoint previous()
Definition: PointCoordinates.h:155
orgQhull::PointCoordinates::indexOffset
int indexOffset(int i) const
Definition: PointCoordinates.cpp:307
orgQhull::PointCoordinates::toStdVector
std::vector< coordT > toStdVector() const
Definition: PointCoordinates.h:72
orgQhull::PointCoordinates::operator<<
PointCoordinates & operator<<(const PointCoordinates &other)
Definition: PointCoordinates.h:124
orgQhull::PointCoordinates::setDimension
void setDimension(int i)
Definition: PointCoordinates.cpp:162
orgQhull::PointCoordinatesIterator::hasPrevious
bool hasPrevious() const
Definition: PointCoordinates.h:154
orgQhull::PointCoordinates::point_coordinates
Coordinates point_coordinates
Definition: PointCoordinates.h:42
orgQhull::PointCoordinates::getCoordinates
const Coordinates & getCoordinates() const
Definition: PointCoordinates.h:84
orgQhull::PointCoordinates::append
void append(const std::vector< coordT > &otherCoordinates)
QhullPoints coordinates, constData, data, count, size.
Definition: PointCoordinates.h:71
orgQhull::Coordinates::end
iterator end()
Definition: Coordinates.h:107
orgQhull::PointCoordinatesIterator::peekPrevious
const QhullPoint peekPrevious() const
Definition: PointCoordinates.h:156
orgQhull::PointCoordinates::operator+=
PointCoordinates & operator+=(const PointCoordinates &other)
Definition: PointCoordinates.h:121
orgQhull::PointCoordinates::comment
std::string comment() const
Definition: PointCoordinates.h:82
operator<<
std::ostream & operator<<(std::ostream &os, const orgQhull::PointCoordinates &p)
orgQhull::PointCoordinates::append
void append(const Coordinates &c)
See convert for std::vector and QList.
Definition: PointCoordinates.h:117
orgQhull::Coordinates::toStdVector
std::vector< coordT > toStdVector() const
Definition: Coordinates.h:71
orgQhull::Coordinates::iterator
Definition: Coordinates.h:152
orgQhull::PointCoordinatesIterator::findNext
bool findNext(const QhullPoint &t)
Definition: PointCoordinates.h:157
orgQhull::Qhull
Interface to Qhull from C++.
Definition: Qhull.h:49
orgQhull::PointCoordinates::operator=
PointCoordinates & operator=(const PointCoordinates &other)
Definition: PointCoordinates.cpp:137
orgQhull::PointCoordinatesIterator::toBack
void toBack()
Definition: PointCoordinates.h:150
c
c
orgQhull::PointCoordinates::setComment
void setComment(const std::string &s)
Definition: PointCoordinates.h:85
orgQhull::PointCoordinates::defineAs
void defineAs(countT coordinatesCount, coordT *c)
disable QhullPoints.defineAs()
Definition: PointCoordinates.h:90
orgQhull::PointCoordinatesIterator::PointCoordinatesIterator
PointCoordinatesIterator(const PointCoordinates &container)
Definition: PointCoordinates.h:146
orgQhull::QhullQh
POD type equivalent to qhT. No virtual members.
Definition: QhullQh.h:58
orgQhull::PointCoordinatesIterator::i
const_iterator i
Definition: PointCoordinates.h:143
orgQhull::PointCoordinatesIterator::findPrevious
bool findPrevious(const QhullPoint &t)
Definition: PointCoordinates.h:158
orgQhull::PointCoordinates::beginCoordinates
Coordinates::ConstIterator beginCoordinates() const
See QhullPoints for begin, constBegin, end.
Definition: PointCoordinates.h:98
qhull_ra.h
orgQhull::PointCoordinatesIterator::const_iterator
PointCoordinates::const_iterator const_iterator
Definition: PointCoordinates.h:139
orgQhull::PointCoordinatesIterator
Definition: PointCoordinates.h:137
orgQhull::PointCoordinates::~PointCoordinates
~PointCoordinates()
Definition: PointCoordinates.cpp:147
orgQhull::PointCoordinatesIterator::toFront
void toFront()
Definition: PointCoordinates.h:149
orgQhull::Coordinates::const_iterator
Definition: Coordinates.h:200
orgQhull::PointCoordinatesIterator::c
const PointCoordinates * c
Definition: PointCoordinates.h:142
orgQhull::Coordinates
Definition: Coordinates.h:38
orgQhull::PointCoordinates::PointCoordinates
PointCoordinates()
Definition: PointCoordinates.cpp:32
orgQhull::PointCoordinates::endCoordinates
Coordinates::ConstIterator endCoordinates() const
Definition: PointCoordinates.h:102
orgQhull::Coordinates::begin
iterator begin()
Definition: Coordinates.h:103
orgQhull::PointCoordinates::makeValid
void makeValid()
Definition: PointCoordinates.h:83
orgQhull::PointCoordinatesIterator::next
const QhullPoint next()
Definition: PointCoordinates.h:152
orgQhull::PointCoordinatesIterator::hasNext
bool hasNext() const
Definition: PointCoordinates.h:151
orgQhull::QhullPoints::defineAs
void defineAs(int pointDimension, countT coordinatesCount, coordT *c)
Definition: QhullPoints.h:95
orgQhull::Coordinates::Iterator
iterator Iterator
Definition: Coordinates.h:48
t
dictionary t
orgQhull::PointCoordinates::appendPoints
void appendPoints(std::istream &in)
Definition: PointCoordinates.cpp:231
orgQhull::PointCoordinatesIterator::operator=
PointCoordinatesIterator & operator=(const PointCoordinates &container)
Definition: PointCoordinates.h:147
orgQhull::PointCoordinates::appendComment
void appendComment(const std::string &s)
Definition: PointCoordinates.cpp:219
orgQhull::QhullPoints::constEnd
ConstIterator constEnd() const
Definition: QhullPoints.h:89


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