From 2f4cb13faff863249f8ef528e4d5d2a34b1ce0d4 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 29 Nov 2018 10:21:10 +0100 Subject: [PATCH] Test centroid() --- .../test/Polygon_mesh_processing/measures_test.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/measures_test.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/measures_test.cpp index a63da169ce1..43f33b36c1b 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/measures_test.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/measures_test.cpp @@ -168,6 +168,14 @@ void test_closed_surface_mesh(const char* filename) typename K::FT vol = PMP::volume(sm); std::cout << "volume = " << vol << std::endl; assert(vol > 0); + + K::Point_3 p = PMP::centroid(sm); + + // compare with centroid of 1.000.000 points inside the mesh: + // 0.00772887 -0.134923 0.011703 + assert (p.x() > 0.007 && p.x() < 0.008); + assert (p.y() > -0.14 && p.y() < -0.13); + assert (p.z() > 0.01 && p.z() < 0.02); } int main(int argc, char* argv[])