20 using std::ostringstream;
23 using std::stringstream;
57 QCOMPARE(pc.
size(), 0U);
65 QCOMPARE(pc7.
count(), 0);
67 QCOMPARE(pc7.
comment(), std::string(
"test explicit dimension"));
70 QCOMPARE(pc2.
count(), 0);
72 QCOMPARE(pc2.
comment(), std::string(
"Test pc2"));
78 coordT c[]= { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 };
81 QCOMPARE(pc4.
count(), 3);
82 QCOMPARE(pc4.
size(), 3u);
89 QCOMPARE(pc4[2][1], 6.0);
90 PointCoordinates pc5(q, 4,
"Test 4-d pc5 with insufficient coordinates", 6, c);
92 QCOMPARE(pc5.
count(), 1);
96 std::vector<coordT> vc;
106 QCOMPARE(pc5[1], p5);
108 QCOMPARE(pc6[1], p5);
112 QCOMPARE(pc5[1], p6);
128 QCOMPARE(pc.
size(), 0U);
136 QCOMPARE(pc7.
count(), 0);
138 QCOMPARE(pc7.
comment(), std::string(
"test explicit dimension"));
141 QCOMPARE(pc2.
count(), 0);
143 QCOMPARE(pc2.
comment(), std::string(
"Test pc2"));
149 coordT c[]= { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 };
152 QCOMPARE(pc4.
count(), 3);
153 QCOMPARE(pc4.
size(), 3u);
160 QCOMPARE(pc4[2][1], 6.0);
161 PointCoordinates pc5(&qh, 4,
"Test 4-d pc5 with insufficient coordinates", 6, c);
163 QCOMPARE(pc5.
count(), 1);
167 std::vector<coordT> vc;
177 QCOMPARE(pc5[1], p5);
179 QCOMPARE(pc6[1], p5);
183 QCOMPARE(pc5[1], p6);
199 coordT c[]= {0.0, 1.0, 2.0, 3.0, 4.0, 5.0};
202 QCOMPARE(ps.
size(), 2u);
205 QCOMPARE(c[0], c2[0]);
211 QCOMPARE(vs.size(), 6u);
212 QCOMPARE(vs[5], 5.0);
213 QList<coordT> qs= ps.toQList();
214 QCOMPARE(qs.size(), 6);
215 QCOMPARE(qs[5], 5.0);
226 QCOMPARE(pc.
comment(), std::string(
"New comment"));
235 coordT c[]= {0.0, 1.0, 2.0, 3.0, 4.0, 5.0};
243 QFAIL(
"setDimension(2) did not fail for 3-d.");
244 }
catch (
const std::exception &e) {
245 const char *s= e.what();
246 cout <<
"INFO : Caught " << s;
254 coordT c[]= {0.0, 1.0, 2.0, 3.0, 4.0, 5.0};
258 QCOMPARE(p, pc.
first());
259 QCOMPARE(p, pc.
value(0));
262 QCOMPARE(p, pc.
last());
263 QCOMPARE(p, pc.
value(2));
272 coordT c[]= {0.0, 1.0, 2.0, 3.0, 4.0, 5.0};
277 QCOMPARE((*i)[0], 0.0);
285 QCOMPARE((*i2)[0], 0.0);
288 QCOMPARE((*i3)[0], 0.0);
297 QCOMPARE(*(i2-1), *i3);
311 QCOMPARE(*--i4, 5.0);
313 QCOMPARE(*--i5, 5.0);
320 coordT c[]= {0.0, 1.0, 2.0, 3.0, 4.0, 5.0};
326 QCOMPARE(pc.
count(p0), 1);
335 coordT c[]= {0.0, 1.0, 2.0, 3.0, 4.0, 5.0};
337 coordT c3[]= {0.0, 1.0, 2.0, 3.0, 4.0, 5.0};
342 coordT c2[]= {6.0, 7.0, 8.0, 9.0, 10.0, 11.0};
344 QCOMPARE(pc2.
count(), 3);
346 QCOMPARE(pc2.
count(), 3);
349 QCOMPARE(pc2.
count(), 4);
353 QCOMPARE(pc2.
count(), 5);
357 QCOMPARE(pc.
count(), 8);
361 QCOMPARE(pc.
comment(), std::string(
"2-d points operators"));
366 QCOMPARE(pc3.
count(), 13);
367 QCOMPARE(pc3[6][0], 14.0);
368 QCOMPARE(pc3[8][0], 6.0);
370 QCOMPARE(pc3.
count(), 21);
371 QCOMPARE(pc3[14][0], 2.0);
374 QCOMPARE(pc3.
count(), 22);
375 QCOMPARE(pc3.
last()[0], 12.0);
379 QCOMPARE(pc3.
count(), 23);
380 QCOMPARE(pc3.
last()[0], 6.0);
382 QCOMPARE(pc3.
count(), 31);
383 QCOMPARE(pc3.
last()[0], 0.0);
385 QCOMPARE(pc3.
count(), 32);
386 QCOMPARE(pc3.
last()[0], 12.0);
397 stringstream s(
"2 3 1 2 3 4 5 6");
399 QCOMPARE(pc.
count(), 3);
407 c << 0.0 << 1.0 << 2.0 << 3.0 << 4.0 << 5.0;
451 QCOMPARE(i.
next(), p0);
454 QCOMPARE(i.
next(), p2);
457 QCOMPARE(i.
next(), p0);
466 os <<
"PointCoordinates 0-d\n" << c;
468 c << 1.0 << 2.0 << 3.0 << 1.0 << 2.0 << 3.0;
469 os <<
"PointCoordinates 1,2 3,1 2,3\n" << c;
471 QString s= QString::fromStdString(os.str());
472 QCOMPARE(s.count(
"0"), 3);
473 QCOMPARE(s.count(
"2"), 5);
478 #include "moc/PointCoordinates_test.moc"
const coordT * constData() const
const QhullPoint peekNext() const
QhullRidge – Qhull's ridge structure, ridgeT, as a C++ class.
Coordinates::ConstIterator beginCoordinates() const
See QhullPoints for begin, constBegin, end.
POD type equivalent to qhT. No virtual members.
ConstIterator constEnd() const
coordT * extraCoordinates() const
Coordinates::ConstIterator endCoordinates() const
void appendPoints(std::istream &in)
countT lastIndexOf(const QhullPoint &t) const
void reserveCoordinates(countT newCoordinates)
ConstIterator end() const
void appendComment(const std::string &s)
Interface to Qhull from C++.
bool findPrevious(const QhullPoint &t)
void add_PointCoordinates_test()
bool findNext(const QhullPoint &t)
countT indexOf(const coordT *pointCoordinates) const
void checkValid() const
See QhullPoints for coordinates, coordinateCount, dimension, empty, isEmpty, ==, !=.
void append(const std::vector< coordT > &otherCoordinates)
QhullPoints coordinates, constData, data, count, size.
countT coordinateCount() const
const coordT * data() const
countT extraCoordinatesCount() const
coordT * coordinates() const
std::vector< coordT > toStdVector() const
QhullPoints mid(countT idx, countT length=-1) const
Returns a subset of the points, not a copy.
QhullPoint value(countT idx) const
const QhullPoint last() const
const QhullPoint previous()
std::string comment() const
const Coordinates & getCoordinates() const
bool contains(const QhullPoint &t) const
ConstIterator begin() const
const QhullPoint at(countT idx) const
const QhullPoint peekPrevious() const
const QhullPoint first() const
void setComment(const std::string &s)
const QhullPoint back() const