Skip to content

Commit

Permalink
Merge pull request #4843 from NREL/issue-4837
Browse files Browse the repository at this point in the history
Fix #4837 - Geometry improvements - Detect incorrectly oriented surfaces in spaces, non convex spaces
  • Loading branch information
jmarrec committed Jun 29, 2023
2 parents a69c2cb + e03d083 commit 26de116
Show file tree
Hide file tree
Showing 40 changed files with 9,075 additions and 446 deletions.
1 change: 1 addition & 0 deletions resources/CMakeLists.txt
Expand Up @@ -174,6 +174,7 @@ set(model_resources_src
model/ParkUnder_Retail_Office_C2.osm
model/ASHRAECourthouse.osm
model/A205ExampleChiller.RS0001.a205.cbor
model/4837_SpaceVolume.osm
)


Expand Down
6,651 changes: 6,651 additions & 0 deletions resources/model/4837_SpaceVolume.osm

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions src/model/PlanarSurface.cpp
Expand Up @@ -28,6 +28,7 @@

#include "../utilities/geometry/Geometry.hpp"
#include "../utilities/geometry/Transformation.hpp"
#include "../utilities/geometry/Polyhedron.hpp"

#include "../utilities/core/Assert.hpp"

Expand Down Expand Up @@ -463,6 +464,14 @@ namespace model {
return m_cachedPlane.get();
}

Surface3d PlanarSurface_Impl::surface3d() const {
return {this->vertices(), this->nameString(), 0};
}

bool PlanarSurface_Impl::isConvex() const {
return surface3d().isConvex();
}

std::vector<std::vector<Point3d>> PlanarSurface_Impl::triangulation() const {
if (m_cachedTriangulation.empty()) {
Transformation faceTransformation = Transformation::alignFace(this->vertices());
Expand Down Expand Up @@ -699,6 +708,10 @@ namespace model {
return getImpl<detail::PlanarSurface_Impl>()->plane();
}

bool PlanarSurface::isConvex() const {
return getImpl<detail::PlanarSurface_Impl>()->isConvex();
}

std::vector<std::vector<Point3d>> PlanarSurface::triangulation() const {
return getImpl<detail::PlanarSurface_Impl>()->triangulation();
}
Expand Down
2 changes: 2 additions & 0 deletions src/model/PlanarSurface.hpp
Expand Up @@ -199,6 +199,8 @@ namespace model {
/// Returns any SurfacePropertyConvectionCoefficients associated with this surface, does not return SurfacePropertyConvectionCoefficientsMultipleSurface.
std::vector<SurfacePropertyConvectionCoefficients> surfacePropertyConvectionCoefficients() const;

bool isConvex() const;

protected:
/** @name Constructors and Destructors */
//@{
Expand Down
6 changes: 6 additions & 0 deletions src/model/PlanarSurface_Impl.hpp
Expand Up @@ -16,6 +16,8 @@

namespace openstudio {

class Surface3d;

namespace model {

class PlanarSurfaceGroup;
Expand Down Expand Up @@ -130,6 +132,10 @@ namespace model {

Plane plane() const;

Surface3d surface3d() const;

bool isConvex() const;

std::vector<std::vector<Point3d>> triangulation() const;

Point3d centroid() const;
Expand Down

0 comments on commit 26de116

Please sign in to comment.