Commit e512a685 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

Merge branch 'fix/box-test' into 'master'

[test][box] do not check  volume equality

See merge request tools/frackit!149
parents e7178970 0a75f0e6
......@@ -3,6 +3,9 @@
#include <vector>
#include <cmath>
#include <frackit/geometry/point.hh>
#include <frackit/geometry/segment.hh>
#include <frackit/geometry/vector.hh>
#include <frackit/geometry/box.hh>
#include <frackit/precision/defaultepsilon.hh>
......@@ -13,6 +16,7 @@ int main()
using Box = Frackit::Box<ctype>;
using Point = typename Box::Point;
using Segment = typename Box::Segment;
using Vector = Frackit::Vector<ctype, 3>;
std::vector<ctype> scales({1e-5, 1, 1e5});
for (auto f : scales)
......@@ -26,11 +30,14 @@ int main()
Box box2(pMin, pMax);
using std::abs;
if ( abs(box.volume() - box2.volume()) > eps*eps*eps )
throw std::runtime_error("Construction from point led to different box");
for (unsigned int i = 0; i < box.numCorners(); ++i)
if (!box.corner(i).isEqual(box2.corner(i), eps))
throw std::runtime_error("Construction from point led to different box");
if ( abs(box.volume() - f*f*f) > eps*eps*eps)
throw std::runtime_error("Unexpected box volume");
const auto diag = Vector(box.corner(0), box.corner(7)).length();
const auto diag2 = Vector(box2.corner(0), box2.corner(7)).length();
if ( abs(diag - diag2) > eps ) throw std::runtime_error("Box diagonals not equal");
if ( abs(diag - sqrt(3.0)*f) > eps ) throw std::runtime_error("Unexpected box diagonal");
// check edge lengths
for (unsigned int i = 0; i < box.numEdges(); ++i)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment