From e2222d519d38060f7b7c6c6dabebfb17864f700b Mon Sep 17 00:00:00 2001 From: Deepak Rangarajan Date: Fri, 12 Jun 2020 16:53:41 -0400 Subject: [PATCH 1/7] polygon distance function --- src/csg/cgal_helper_polygon.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/csg/cgal_helper_polygon.cpp b/src/csg/cgal_helper_polygon.cpp index 36a2143..e39c83a 100644 --- a/src/csg/cgal_helper_polygon.cpp +++ b/src/csg/cgal_helper_polygon.cpp @@ -1,7 +1,10 @@ #include "csg_cgal_helper.hpp" +#include + namespace { typedef CGAL::Point_2 Point; +typedef cgal_helper::CK::Segment_2 Segment; } // namespace namespace cgal_helper { @@ -31,4 +34,20 @@ bool inside(const Polygon &polygon, double xx, double yy) { return polygon.has_on_bounded_side(Point(xx, yy)); } +double distance(const Polygon &polygon, double xx, double yy) { + double dist = std::numeric_limits::max(); + auto point1 = polygon.begin(); + auto point2 = polygon.begin(); + ++point2; + + auto m = Point(xx, yy); + for (; point2 != polygon.end(); ++point1, ++point2) { + Segment s(*point1, *point2); + auto sqdist = CGAL::squared_distance(s, m); + dist = std::min(dist, sqdist); + } + + return dist; +} + } // namespace cgal_helper -- GitLab From 129e0bafbe2b4c6e398988151f9176dcd56a127a Mon Sep 17 00:00:00 2001 From: Deepak Rangarajan Date: Fri, 12 Jun 2020 16:58:32 -0400 Subject: [PATCH 2/7] update levelset function --- src/csg/levelset_2d.cpp | 7 +++++-- src/csg_cgal_helper.hpp | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/csg/levelset_2d.cpp b/src/csg/levelset_2d.cpp index b8e0993..5b34fcb 100644 --- a/src/csg/levelset_2d.cpp +++ b/src/csg/levelset_2d.cpp @@ -89,8 +89,11 @@ double signed_distance_2d(const Circle &cir, double xx, double yy) { double signed_distance_2d(const Polygon &polygon, double xx, double yy) { - // TODO: support signed distance instead of -1.0/1.0 - return cgal_helper::inside(polygon.cgal_polygon(), xx, yy) ? 1.0 : -1.0; + double sign = + cgal_helper::inside(polygon.cgal_polygon(), xx, yy) ? -1.0 : 1.0; + double dist = cgal_helper::distance(polygon.cgal_polygon(), xx, yy); + + return EXTERNAL_FLOW * sign * dist; } double signed_distance_2d(const Type2D &obj, double xx, double yy) { diff --git a/src/csg_cgal_helper.hpp b/src/csg_cgal_helper.hpp index f4cc688..d3d3f80 100644 --- a/src/csg_cgal_helper.hpp +++ b/src/csg_cgal_helper.hpp @@ -23,6 +23,8 @@ bool inside(const Polyhedron &polyhedron, double xx, double yy, double zz); bool inside(const Polygon &polygon, double xx, double yy); +double distance(const Polygon &ploygon, double xx, double yy); + } // namespace cgal_helper #endif -- GitLab From 1a17340acd17c0bddf4b74357c103f93073cf859 Mon Sep 17 00:00:00 2001 From: Deepak Rangarajan Date: Fri, 12 Jun 2020 18:26:09 -0400 Subject: [PATCH 3/7] changes, add magnitude checks for extrude --- src/csg/cgal_helper_polygon.cpp | 19 ++++++-------- src/csg/levelset_2d.cpp | 7 ++--- src/csg/tests/levelset/extrude.t.cpp | 39 +++++++++++++++++++++++++--- src/csg_cgal_helper.hpp | 2 +- 4 files changed, 48 insertions(+), 19 deletions(-) diff --git a/src/csg/cgal_helper_polygon.cpp b/src/csg/cgal_helper_polygon.cpp index e39c83a..2d01def 100644 --- a/src/csg/cgal_helper_polygon.cpp +++ b/src/csg/cgal_helper_polygon.cpp @@ -34,20 +34,17 @@ bool inside(const Polygon &polygon, double xx, double yy) { return polygon.has_on_bounded_side(Point(xx, yy)); } -double distance(const Polygon &polygon, double xx, double yy) { - double dist = std::numeric_limits::max(); - auto point1 = polygon.begin(); - auto point2 = polygon.begin(); - ++point2; - +double abs_distance(const Polygon &polygon, double xx, double yy, bool inside) { + double dist = -std::numeric_limits::max(); auto m = Point(xx, yy); - for (; point2 != polygon.end(); ++point1, ++point2) { - Segment s(*point1, *point2); - auto sqdist = CGAL::squared_distance(s, m); - dist = std::min(dist, sqdist); + double sign = inside ? -1.0 : 1.0; + + for (auto e = polygon.edges_begin(); e != polygon.edges_end(); ++e) { + auto d = sign * CGAL::squared_distance(*e, m); + dist = std::max(dist, d); } - return dist; + return std::fabs(dist); } } // namespace cgal_helper diff --git a/src/csg/levelset_2d.cpp b/src/csg/levelset_2d.cpp index 5b34fcb..20de773 100644 --- a/src/csg/levelset_2d.cpp +++ b/src/csg/levelset_2d.cpp @@ -89,9 +89,10 @@ double signed_distance_2d(const Circle &cir, double xx, double yy) { double signed_distance_2d(const Polygon &polygon, double xx, double yy) { - double sign = - cgal_helper::inside(polygon.cgal_polygon(), xx, yy) ? -1.0 : 1.0; - double dist = cgal_helper::distance(polygon.cgal_polygon(), xx, yy); + bool inside = cgal_helper::inside(polygon.cgal_polygon(), xx, yy); + double sign = inside ? -1.0 : 1.0; + double dist = + cgal_helper::abs_distance(polygon.cgal_polygon(), xx, yy, inside); return EXTERNAL_FLOW * sign * dist; } diff --git a/src/csg/tests/levelset/extrude.t.cpp b/src/csg/tests/levelset/extrude.t.cpp index d3574a7..85da6fb 100644 --- a/src/csg/tests/levelset/extrude.t.cpp +++ b/src/csg/tests/levelset/extrude.t.cpp @@ -10,7 +10,7 @@ TEST_CASE("linear", "[Levelset Extrude]") { double height = 100, radius = 10; auto my_lin_ext = csg::LinearExtrude{ .height = 100, .center = false, .scale = {1, 1}, .group = csg::Union2D()}; - csg::Circle my_cir{.name = std::nullopt, .radius = 10}; + csg::Circle my_cir{.name = std::nullopt, .radius = radius}; SECTION("Not centered") { my_lin_ext.center = false; @@ -21,15 +21,37 @@ TEST_CASE("linear", "[Levelset Extrude]") { SECTION("Outside") { CHECK_FALSE(0 < my_levelset(0, radius * 0.99, -0.01 * height)); + CHECK(Approx(-0.01 * height) == + my_levelset(0, radius * 0.99, -0.01 * height)); + CHECK_FALSE(0 < my_levelset(0, radius * 1.01, 0.01 * height)); + CHECK(Approx((radius) * (radius) - (1.01 * radius) * (1.01 * radius)) == + my_levelset(0, radius * 1.01, 0.01 * height)); + CHECK_FALSE(0 < my_levelset(0, radius * 0.99, 1.01 * height)); + CHECK(Approx(-0.01 * height) == + my_levelset(0, radius * 0.99, 1.01 * height)); + CHECK_FALSE(0 < my_levelset(radius * 0.99, 0, 1.01 * height)); + CHECK(Approx(-0.01 * height) == + my_levelset(radius * 0.99, 0, 1.01 * height)); } SECTION("Inside") { CHECK(0 < my_levelset(0, radius * 0.99, 0.01 * height)); + CHECK(Approx(0.01 * height) == + my_levelset(0, radius * 0.99, 0.01 * height)); + CHECK(0 < my_levelset(radius * 0.99, 0, 0.01 * height)); - CHECK(0 < my_levelset(0, radius * 0.99, 0.99 * height)); - CHECK(0 < my_levelset(radius * 0.99, 0, 0.99 * height)); + CHECK(Approx(0.01 * height) == + my_levelset(radius * 0.99, 0, 0.01 * height)); + + CHECK(0 < my_levelset(0, radius * 0.99, 0.9 * height)); + CHECK(Approx((radius) * (radius) - (0.99 * radius) * (0.99 * radius)) == + my_levelset(0, radius * 0.99, 0.9 * height)); + + CHECK(0 < my_levelset(radius * 0.99, 0, 0.9 * height)); + CHECK(Approx((radius) * (radius) - (0.99 * radius) * (0.99 * radius)) == + my_levelset(radius * 0.99, 0, 0.9 * height)); } } @@ -157,7 +179,13 @@ TEST_CASE("Linear extrude of a triangle with hole", "[Levelset Primitives]") { SECTION("Outside") { CHECK_FALSE(0 < my_levelset(0.5 * thick, 0.5 * thick, 1.01 * (ht / 2))); + CHECK(Approx(-0.01 * ht / 2) == + my_levelset(0.5 * thick, 0.5 * thick, 1.01 * (ht / 2))); + CHECK_FALSE(0 < my_levelset(0.5 * thick, 0.5 * thick, -1.01 * (ht / 2))); + CHECK(Approx(-0.01 * ht / 2) == + my_levelset(0.5 * thick, 0.5 * thick, -1.01 * (ht / 2))); + CHECK_FALSE(0 < my_levelset(2 * thick, 2 * thick, 0.0)); CHECK_FALSE(0 < my_levelset(4 * thick, 2 * thick, 0.0)); CHECK_FALSE(0 < my_levelset(1.01 * outer, 0.5 * thick, 0.0)); @@ -169,7 +197,10 @@ TEST_CASE("Linear extrude of a triangle with hole", "[Levelset Primitives]") { CHECK(0 < my_levelset(0.5 * thick, 0.5 * thick, -0.99 * (ht / 2))); CHECK(0 < my_levelset(0.5 * thick, 0.5 * thick, 0.0)); CHECK(0 < my_levelset(0.7 * outer, 0.5 * thick, 0.0)); - CHECK(0 < my_levelset(0.5 * thick, 0.7 * outer, 0.0)); + + CHECK(0 < my_levelset(0.1 * thick, 0.7 * outer, 0.0)); + CHECK(Approx((0.1 * thick) * (0.1 * thick)) == + my_levelset(0.1 * thick, 0.7 * outer, 0.0)); } } diff --git a/src/csg_cgal_helper.hpp b/src/csg_cgal_helper.hpp index d3d3f80..e964e2d 100644 --- a/src/csg_cgal_helper.hpp +++ b/src/csg_cgal_helper.hpp @@ -23,7 +23,7 @@ bool inside(const Polyhedron &polyhedron, double xx, double yy, double zz); bool inside(const Polygon &polygon, double xx, double yy); -double distance(const Polygon &ploygon, double xx, double yy); +double abs_distance(const Polygon &ploygon, double xx, double yy, bool inside); } // namespace cgal_helper -- GitLab From 334e5149fa13558aa51556da9c136b8c5142ef26 Mon Sep 17 00:00:00 2001 From: Deepak Rangarajan Date: Sun, 14 Jun 2020 22:28:18 -0400 Subject: [PATCH 4/7] changes --- src/csg/cgal_helper_polygon.cpp | 7 +++---- src/csg/levelset_2d.cpp | 3 +-- src/csg/tests/levelset/extrude.t.cpp | 3 +-- src/csg_cgal_helper.hpp | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/csg/cgal_helper_polygon.cpp b/src/csg/cgal_helper_polygon.cpp index 2d01def..c228791 100644 --- a/src/csg/cgal_helper_polygon.cpp +++ b/src/csg/cgal_helper_polygon.cpp @@ -34,17 +34,16 @@ bool inside(const Polygon &polygon, double xx, double yy) { return polygon.has_on_bounded_side(Point(xx, yy)); } -double abs_distance(const Polygon &polygon, double xx, double yy, bool inside) { +double abs_distance(const Polygon &polygon, double xx, double yy) { double dist = -std::numeric_limits::max(); auto m = Point(xx, yy); - double sign = inside ? -1.0 : 1.0; for (auto e = polygon.edges_begin(); e != polygon.edges_end(); ++e) { - auto d = sign * CGAL::squared_distance(*e, m); + auto d = CGAL::squared_distance(*e, m); dist = std::max(dist, d); } - return std::fabs(dist); + return dist; } } // namespace cgal_helper diff --git a/src/csg/levelset_2d.cpp b/src/csg/levelset_2d.cpp index 20de773..c75a64b 100644 --- a/src/csg/levelset_2d.cpp +++ b/src/csg/levelset_2d.cpp @@ -91,8 +91,7 @@ double signed_distance_2d(const Polygon &polygon, double xx, double yy) { bool inside = cgal_helper::inside(polygon.cgal_polygon(), xx, yy); double sign = inside ? -1.0 : 1.0; - double dist = - cgal_helper::abs_distance(polygon.cgal_polygon(), xx, yy, inside); + double dist = cgal_helper::abs_distance(polygon.cgal_polygon(), xx, yy); return EXTERNAL_FLOW * sign * dist; } diff --git a/src/csg/tests/levelset/extrude.t.cpp b/src/csg/tests/levelset/extrude.t.cpp index 85da6fb..c72c86d 100644 --- a/src/csg/tests/levelset/extrude.t.cpp +++ b/src/csg/tests/levelset/extrude.t.cpp @@ -199,8 +199,7 @@ TEST_CASE("Linear extrude of a triangle with hole", "[Levelset Primitives]") { CHECK(0 < my_levelset(0.7 * outer, 0.5 * thick, 0.0)); CHECK(0 < my_levelset(0.1 * thick, 0.7 * outer, 0.0)); - CHECK(Approx((0.1 * thick) * (0.1 * thick)) == - my_levelset(0.1 * thick, 0.7 * outer, 0.0)); + CHECK(Approx(ht / 2) == my_levelset(0.1 * thick, 0.7 * outer, 0.0)); } } diff --git a/src/csg_cgal_helper.hpp b/src/csg_cgal_helper.hpp index e964e2d..03270d5 100644 --- a/src/csg_cgal_helper.hpp +++ b/src/csg_cgal_helper.hpp @@ -23,7 +23,7 @@ bool inside(const Polyhedron &polyhedron, double xx, double yy, double zz); bool inside(const Polygon &polygon, double xx, double yy); -double abs_distance(const Polygon &ploygon, double xx, double yy, bool inside); +double abs_distance(const Polygon &ploygon, double xx, double yy); } // namespace cgal_helper -- GitLab From be00efb4eea52fb3689b1f0af51b9dc8a54b6718 Mon Sep 17 00:00:00 2001 From: Deepak Rangarajan Date: Mon, 15 Jun 2020 11:16:51 -0400 Subject: [PATCH 5/7] changes --- src/csg/cgal_helper_polygon.cpp | 8 ++-- src/csg/levelset_2d.cpp | 3 +- src/csg/tests/levelset/extrude.t.cpp | 56 ++++++++++++++++++++++++---- src/csg_cgal_helper.hpp | 2 +- 4 files changed, 57 insertions(+), 12 deletions(-) diff --git a/src/csg/cgal_helper_polygon.cpp b/src/csg/cgal_helper_polygon.cpp index c228791..33db230 100644 --- a/src/csg/cgal_helper_polygon.cpp +++ b/src/csg/cgal_helper_polygon.cpp @@ -34,16 +34,18 @@ bool inside(const Polygon &polygon, double xx, double yy) { return polygon.has_on_bounded_side(Point(xx, yy)); } -double abs_distance(const Polygon &polygon, double xx, double yy) { +double abs_distance(const Polygon &polygon, double xx, double yy, bool inside) { double dist = -std::numeric_limits::max(); auto m = Point(xx, yy); + double sign = inside ? -1.0 : 1.0; + for (auto e = polygon.edges_begin(); e != polygon.edges_end(); ++e) { - auto d = CGAL::squared_distance(*e, m); + auto d = sign * CGAL::squared_distance(*e, m); dist = std::max(dist, d); } - return dist; + return std::fabs(dist); } } // namespace cgal_helper diff --git a/src/csg/levelset_2d.cpp b/src/csg/levelset_2d.cpp index c75a64b..20de773 100644 --- a/src/csg/levelset_2d.cpp +++ b/src/csg/levelset_2d.cpp @@ -91,7 +91,8 @@ double signed_distance_2d(const Polygon &polygon, double xx, double yy) { bool inside = cgal_helper::inside(polygon.cgal_polygon(), xx, yy); double sign = inside ? -1.0 : 1.0; - double dist = cgal_helper::abs_distance(polygon.cgal_polygon(), xx, yy); + double dist = + cgal_helper::abs_distance(polygon.cgal_polygon(), xx, yy, inside); return EXTERNAL_FLOW * sign * dist; } diff --git a/src/csg/tests/levelset/extrude.t.cpp b/src/csg/tests/levelset/extrude.t.cpp index c72c86d..e8d7e1b 100644 --- a/src/csg/tests/levelset/extrude.t.cpp +++ b/src/csg/tests/levelset/extrude.t.cpp @@ -64,15 +64,37 @@ TEST_CASE("linear", "[Levelset Extrude]") { SECTION("Outside") { CHECK_FALSE(0 < my_levelset(0, radius * 0.99, -1.01 * height / 2)); + CHECK(Approx(-0.01 * height / 2) == + my_levelset(0, radius * 0.99, -1.01 * height / 2)); + CHECK_FALSE(0 < my_levelset(0, radius * 1.01, 0.01 * height)); + CHECK(Approx((radius) * (radius) - (1.01 * radius) * (1.01 * radius)) == + my_levelset(0, radius * 1.01, 0.01 * height)); + CHECK_FALSE(0 < my_levelset(0, radius * 0.99, 1.01 * height / 2)); + CHECK(Approx(-0.01 * height / 2) == + my_levelset(0, radius * 0.99, 1.01 * height / 2)); + CHECK_FALSE(0 < my_levelset(radius * 0.99, 0, 1.01 * height / 2)); + CHECK(Approx(-0.01 * height / 2) == + my_levelset(radius * 0.99, 0, 1.01 * height / 2)); } SECTION("Inside") { CHECK(0 < my_levelset(0, radius * 0.99, -0.99 * height / 2)); + CHECK(Approx(0.01 * height / 2) == + my_levelset(0, radius * 0.99, -0.99 * height / 2)); + CHECK(0 < my_levelset(radius * 0.99, 0, 0.01 * height / 2)); + CHECK(Approx((radius) * (radius) - (0.99 * radius) * (0.99 * radius)) == + my_levelset(radius * 0.99, 0, 0.01 * height / 2)); + CHECK(0 < my_levelset(0, radius * 0.99, 0.99 * height / 2)); - CHECK(0 < my_levelset(radius * 0.99, 0, 0.99 * height / 2)); + CHECK(Approx(0.01 * height / 2) == + my_levelset(0, radius * 0.99, 0.99 * height / 2)); + + CHECK(0 < my_levelset(radius * 0.99, 0, 0.9 * height / 2)); + CHECK(Approx((radius) * (radius) - (0.99 * radius) * (0.99 * radius)) == + my_levelset(radius * 0.99, 0, 0.9 * height / 2)); } } } @@ -186,20 +208,40 @@ TEST_CASE("Linear extrude of a triangle with hole", "[Levelset Primitives]") { CHECK(Approx(-0.01 * ht / 2) == my_levelset(0.5 * thick, 0.5 * thick, -1.01 * (ht / 2))); - CHECK_FALSE(0 < my_levelset(2 * thick, 2 * thick, 0.0)); - CHECK_FALSE(0 < my_levelset(4 * thick, 2 * thick, 0.0)); + CHECK_FALSE(0 < my_levelset(1.5 * thick, 1.5 * thick, 0.0)); + CHECK(Approx(-(0.5 * thick) * (0.5 * thick)) == + my_levelset(1.5 * thick, 1.5 * thick, 0.0)); + CHECK_FALSE(0 < my_levelset(1.01 * outer, 0.5 * thick, 0.0)); + CHECK(Approx(-(1.01 * outer) * (1.01 * outer)) == + my_levelset(1.01 * outer, 0.5 * thick, 0.0)); + CHECK_FALSE(0 < my_levelset(0.5 * thick, 1.01 * outer, 0.0)); + CHECK(Approx(-(1.01 * outer) * (1.01 * outer)) == + my_levelset(0.5 * thick, 1.01 * outer, 0.0)); + CHECK_FALSE(0 < my_levelset(inner, inner, 0.0)); + CHECK(Approx(-inner * inner) == my_levelset(inner, inner, 0.0)); } SECTION("Inside") { CHECK(0 < my_levelset(0.5 * thick, 0.5 * thick, 0.99 * (ht / 2))); + CHECK(Approx(0.01 * ht / 2) == + my_levelset(0.5 * thick, 0.5 * thick, 0.99 * (ht / 2))); + CHECK(0 < my_levelset(0.5 * thick, 0.5 * thick, -0.99 * (ht / 2))); - CHECK(0 < my_levelset(0.5 * thick, 0.5 * thick, 0.0)); - CHECK(0 < my_levelset(0.7 * outer, 0.5 * thick, 0.0)); + CHECK(Approx(0.01 * ht / 2) == + my_levelset(0.5 * thick, 0.5 * thick, -0.99 * (ht / 2))); + + CHECK(0 < my_levelset(0.1 * thick, 0.5 * thick, 0.0)); + CHECK(Approx((0.1 * thick) * (0.1 * thick)) == + my_levelset(0.1 * thick, 0.5 * thick, 0.0)); + + CHECK(0 < my_levelset(0.7 * outer, 0.1 * thick, 0.0)); + CHECK(Approx((0.1 * thick) * (0.1 * thick)) == + my_levelset(0.7 * outer, 0.1 * thick, 0.0)); - CHECK(0 < my_levelset(0.1 * thick, 0.7 * outer, 0.0)); - CHECK(Approx(ht / 2) == my_levelset(0.1 * thick, 0.7 * outer, 0.0)); + CHECK(0 < my_levelset(0.5 * thick, 0.7 * outer, 0.0)); + CHECK(Approx(ht / 2) == my_levelset(0.5 * thick, 0.7 * outer, 0.0)); } } diff --git a/src/csg_cgal_helper.hpp b/src/csg_cgal_helper.hpp index 03270d5..e964e2d 100644 --- a/src/csg_cgal_helper.hpp +++ b/src/csg_cgal_helper.hpp @@ -23,7 +23,7 @@ bool inside(const Polyhedron &polyhedron, double xx, double yy, double zz); bool inside(const Polygon &polygon, double xx, double yy); -double abs_distance(const Polygon &ploygon, double xx, double yy); +double abs_distance(const Polygon &ploygon, double xx, double yy, bool inside); } // namespace cgal_helper -- GitLab From cd83df7d945bf1622de5441c8a3696b4b781b4a5 Mon Sep 17 00:00:00 2001 From: Deepak Rangarajan Date: Mon, 15 Jun 2020 11:28:02 -0400 Subject: [PATCH 6/7] rename --- src/csg/cgal_helper_polygon.cpp | 3 ++- src/csg/levelset_2d.cpp | 2 +- src/csg_cgal_helper.hpp | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/csg/cgal_helper_polygon.cpp b/src/csg/cgal_helper_polygon.cpp index 33db230..7a24cfd 100644 --- a/src/csg/cgal_helper_polygon.cpp +++ b/src/csg/cgal_helper_polygon.cpp @@ -34,7 +34,8 @@ bool inside(const Polygon &polygon, double xx, double yy) { return polygon.has_on_bounded_side(Point(xx, yy)); } -double abs_distance(const Polygon &polygon, double xx, double yy, bool inside) { +double abs_max_distance(const Polygon &polygon, double xx, double yy, + bool inside) { double dist = -std::numeric_limits::max(); auto m = Point(xx, yy); diff --git a/src/csg/levelset_2d.cpp b/src/csg/levelset_2d.cpp index 20de773..cdfb92c 100644 --- a/src/csg/levelset_2d.cpp +++ b/src/csg/levelset_2d.cpp @@ -92,7 +92,7 @@ double signed_distance_2d(const Polygon &polygon, double xx, double yy) { bool inside = cgal_helper::inside(polygon.cgal_polygon(), xx, yy); double sign = inside ? -1.0 : 1.0; double dist = - cgal_helper::abs_distance(polygon.cgal_polygon(), xx, yy, inside); + cgal_helper::abs_max_distance(polygon.cgal_polygon(), xx, yy, inside); return EXTERNAL_FLOW * sign * dist; } diff --git a/src/csg_cgal_helper.hpp b/src/csg_cgal_helper.hpp index e964e2d..3eb6463 100644 --- a/src/csg_cgal_helper.hpp +++ b/src/csg_cgal_helper.hpp @@ -23,7 +23,8 @@ bool inside(const Polyhedron &polyhedron, double xx, double yy, double zz); bool inside(const Polygon &polygon, double xx, double yy); -double abs_distance(const Polygon &ploygon, double xx, double yy, bool inside); +double abs_max_distance(const Polygon &ploygon, double xx, double yy, + bool inside); } // namespace cgal_helper -- GitLab From 737c3e2bea5bc34616e44aaa3ad259c52feed38d Mon Sep 17 00:00:00 2001 From: Mark Meredith Date: Mon, 15 Jun 2020 11:34:18 -0400 Subject: [PATCH 7/7] clang-format --- src/csg/tests/levelset/transform.t.cpp | 2 +- src/inputs/tests/solver.t.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/csg/tests/levelset/transform.t.cpp b/src/csg/tests/levelset/transform.t.cpp index 99bf3ef..8e48f5c 100644 --- a/src/csg/tests/levelset/transform.t.cpp +++ b/src/csg/tests/levelset/transform.t.cpp @@ -3,8 +3,8 @@ #include "catch2/catch.hpp" #include -#include #include +#include namespace { diff --git a/src/inputs/tests/solver.t.cpp b/src/inputs/tests/solver.t.cpp index 5801752..8797121 100644 --- a/src/inputs/tests/solver.t.cpp +++ b/src/inputs/tests/solver.t.cpp @@ -1,7 +1,7 @@ #include "catch2/catch.hpp" -#include #include +#include TEST_CASE("GeometrySettings", "[]") { solver::InputInfo ii; -- GitLab