void QhullHyperplane_test:: t_value() { RboxPoints rcube("c G1"); Qhull q(rcube,"Qt QR0"); // triangulation of rotated unit cube const QhullHyperplane h= q.firstFacet().hyperplane(); double dist= h.distance(q.origin()); QCOMPARE(dist, -1.0); double norm= h.norm(); QCOMPARE(norm, 1.0); }//t_value
void QhullHyperplane_test:: t_operator() { RboxPoints rcube("c"); Qhull q(rcube,"Qt QR0"); // triangulation of rotated unit cube const QhullHyperplane h= q.firstFacet().hyperplane(); //operator== and operator!= tested elsewhere const coordT *c= h.coordinates(); for(int k=h.dimension(); k--; ){ QCOMPARE(c[k], h[k]); } //h[0]= 10.0; // compiler error, const QhullHyperplane h2= q.firstFacet().hyperplane(); h2[0]= 10.0; // Overwrites Hyperplane coordinate! QCOMPARE(h2[0], 10.0); }//t_operator
void QhullHyperplane_test:: t_qhullHyperplane_iterator() { QhullHyperplane h2; QhullHyperplaneIterator i= h2; QCOMPARE(h2.dimension(), 0); QVERIFY(!i.hasNext()); QVERIFY(!i.hasPrevious()); i.toBack(); QVERIFY(!i.hasNext()); QVERIFY(!i.hasPrevious()); RboxPoints rcube("c"); Qhull q(rcube,"QR0"); // rotated unit cube QhullHyperplane h = q.firstFacet().hyperplane(); QhullHyperplaneIterator i2(h); QCOMPARE(h.dimension(), 3); i= h; QVERIFY(i2.hasNext()); QVERIFY(!i2.hasPrevious()); QVERIFY(i.hasNext()); QVERIFY(!i.hasPrevious()); i2.toBack(); i.toFront(); QVERIFY(!i2.hasNext()); QVERIFY(i2.hasPrevious()); QVERIFY(i.hasNext()); QVERIFY(!i.hasPrevious()); // i at front, i2 at end/back, 3 coordinates QCOMPARE(i.peekNext(), h[0]); QCOMPARE(i2.peekPrevious(), h[2]); QCOMPARE(i2.previous(), h[2]); QCOMPARE(i2.previous(), h[1]); QCOMPARE(i2.previous(), h[0]); QVERIFY(!i2.hasPrevious()); QCOMPARE(i.peekNext(), h[0]); // i.peekNext()= 1.0; // compiler error, i is const QCOMPARE(i.next(), h[0]); QCOMPARE(i.peekNext(), h[1]); QCOMPARE(i.next(), h[1]); QCOMPARE(i.next(), h[2]); QVERIFY(!i.hasNext()); i.toFront(); QCOMPARE(i.next(), h[0]); }//t_qhullHyperplane_iterator
void QhullHyperplane_test:: t_value() { RboxPoints rcube("c G1"); Qhull q(rcube,"Qt QR0"); // triangulation of rotated unit cube QhullFacet f= q.firstFacet(); QhullFacet f2= f.neighborFacets().at(0); const QhullHyperplane h= f.hyperplane(); const QhullHyperplane h2= f2.hyperplane(); // At right angles double dist= h.distance(q.origin()); QCOMPARE(dist, -1.0); double norm= h.norm(); QCOMPARE(norm, 1.0); double angle= h.hyperplaneAngle(h2); cout << "angle " << angle << endl; QCOMPARE(angle+1.0, 1.0); // qFuzzyCompare does not work for 0.0 QVERIFY(h==h); QVERIFY(h!=h2); }//t_value
void QhullHyperplane_test:: t_construct() { // Qhull.runQhull() constructs QhullFacets as facetT QhullHyperplane h; QVERIFY(!h.isDefined()); QCOMPARE(h.dimension(),0); QCOMPARE(h.coordinates(),static_cast<double *>(0)); RboxPoints rcube("c"); Qhull q(rcube,"Qt QR0"); // triangulation of rotated unit cube QhullFacet f= q.firstFacet(); QhullHyperplane h2(f.hyperplane()); QVERIFY(h2.isDefined()); QCOMPARE(h2.dimension(),3); // h= h2; // copy assignment disabled, ambiguous QhullHyperplane h3(h2.dimension(), h2.coordinates(), h2.offset()); QCOMPARE(h2, h3); QhullHyperplane h5= h2; // copy constructor QVERIFY(h5==h2); }//t_construct