From f2b8d95048ab149eba068c7c311064bb6d0d4485 Mon Sep 17 00:00:00 2001 From: "Gerard.Gartside" Date: Wed, 24 Feb 2021 15:35:35 -0600 Subject: [PATCH] Fixing cppcheck/clang format issues --- src/utilities/geometry/Polygon.cpp | 16 ++++++++++------ src/utilities/geometry/Polygon.hpp | 2 +- src/utilities/geometry/Test/Geometry_GTest.cpp | 5 ----- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/utilities/geometry/Polygon.cpp b/src/utilities/geometry/Polygon.cpp index 718c890d195..74c4f68b006 100644 --- a/src/utilities/geometry/Polygon.cpp +++ b/src/utilities/geometry/Polygon.cpp @@ -120,15 +120,19 @@ double Polygon3d::getPerimeter() { } bool Polygon3d::getIsClockwise() { - return true; + OptionalVector3d normal = getOutwardNormal(points); + if (normal == boost::none) + return true; + else + return normal.get().z() > 0; } Point3d Polygon3d::getCentroid() { - //boost::optional p = openstudio::getCentroid(points); - //if (p == boost::none) - return Point3d(); - //else - // return p.get(); + boost::optional p = openstudio::getCentroid(points); + if (p == boost::none) + return Point3d(); + else + return p.get(); } //bool Polygon3d::PointInPolygon(Point3d testPoint) { diff --git a/src/utilities/geometry/Polygon.hpp b/src/utilities/geometry/Polygon.hpp index cf86418b0a5..4f2e702d3a3 100644 --- a/src/utilities/geometry/Polygon.hpp +++ b/src/utilities/geometry/Polygon.hpp @@ -46,7 +46,7 @@ class UTILITIES_API Polygon3d Polygon3d(); Polygon3d(Point3dVector outerPth); - void setOuterPath(Point3dVector outerPth); + void setOuterPath(Point3dVector outerPath); Point3dVector getOuterPath() const; Point3dVectorVector getInnerPaths() const; diff --git a/src/utilities/geometry/Test/Geometry_GTest.cpp b/src/utilities/geometry/Test/Geometry_GTest.cpp index 9be5fe6098a..c59780c1a9c 100644 --- a/src/utilities/geometry/Test/Geometry_GTest.cpp +++ b/src/utilities/geometry/Test/Geometry_GTest.cpp @@ -1170,11 +1170,6 @@ TEST_F(GeometryFixture, Polygon_Basic_Angled) { Vector3d normal = testPolygon.outwardNormal(); - auto v1 = normal.x(); - auto v2 = normal.y(); - auto v3 = normal.z(); - auto v4 = normal.length(); - EXPECT_NEAR(0.24242, normal.x(), 0.001); EXPECT_NEAR(0, normal.y(), 0.001); EXPECT_NEAR(0.97017, normal.z(), 0.001);