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

[test][constraint] test ellipse-type isection distance constraint

parent 775164f3
......@@ -3,6 +3,7 @@
#include <stdexcept>
#include <frackit/geometry/disk.hh>
#include <frackit/geometry/cylinder.hh>
#include <frackit/entitynetwork/constraints.hh>
//! test the constraints for entity networks of disks
......@@ -86,6 +87,25 @@ int main()
throw std::runtime_error(std::string("Did not detect intersection angle violation"));
std::cout << "Test 9 passed" << std::endl;
// Test constraints w.r.t. cylinder
Frackit::Cylinder<ctype> cylinder(0.5, 1.0);
Disk disk10(Point(0.0, 0.0, 0.5), e1, e2, 2.0, 2.0);
if (!constraints.evaluate(cylinder.lateralFace(), disk10))
throw std::runtime_error(std::string("False positive intersection distance violation"));
std::cout << "Test 10 passed" << std::endl;
// violates intersection distance constraint
Disk disk11(Point(0.0, 0.0, 0.951), e1, e2, 2.0, 2.0);
if (constraints.evaluate(cylinder.lateralFace(), disk11))
throw std::runtime_error(std::string("Did not detect intersection distance violation"));
std::cout << "Test 11 passed" << std::endl;
// just doesn't violate intersection distance constraint
Disk disk12(Point(0.0, 0.0, 0.849), e1, e2, 2.0, 2.0);
if (!constraints.evaluate(cylinder.lateralFace(), disk12))
throw std::runtime_error(std::string("False positive intersection distance violation"));
std::cout << "Test 12 passed" << std::endl;
std::cout << "All tests passed" << std::endl;
return 0;
}
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