src/utilities/geometry/RoofGeometry.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*********************************************************************************************************************** | ||
| 2 | * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. | ||
| 3 | * See also https://openstudio.net/license | ||
| 4 | ***********************************************************************************************************************/ | ||
| 5 | |||
| 6 | #include "RoofGeometry.hpp" | ||
| 7 | #include "RoofGeometry_Details.hpp" | ||
| 8 | |||
| 9 | #include "Geometry.hpp" | ||
| 10 | #include "Vector3d.hpp" | ||
| 11 | #include <boost/optional.hpp> | ||
| 12 | #include <boost/math/constants/constants.hpp> | ||
| 13 | |||
| 14 | namespace openstudio { | ||
| 15 | |||
| 16 | /// Generate shed roof polygons | ||
| 17 | 6 | std::vector<std::vector<Point3d>> generateShedRoof(std::vector<Point3d>& polygon, double roofPitchDegrees, double directionDegrees) { | |
| 18 | 6 | std::vector<std::vector<Point3d>> surfaces; | |
| 19 | try { | ||
| 20 |
1/1✓ Branch 1 taken 6 times.
|
6 | surfaces = doShedRoof(polygon, roofPitchDegrees, directionDegrees); |
| 21 | ✗ | } catch (...) { | |
| 22 | ✗ | return surfaces; | |
| 23 | ✗ | } | |
| 24 | |||
| 25 | 6 | return surfaces; | |
| 26 | ✗ | } | |
| 27 | |||
| 28 | /// Generate gable roof polygons | ||
| 29 | 3 | std::vector<std::vector<Point3d>> generateGableRoof(std::vector<Point3d>& polygon, double roofPitchDegrees) { | |
| 30 | 3 | std::vector<std::vector<Point3d>> surfaces; | |
| 31 | try { | ||
| 32 |
1/1✓ Branch 1 taken 3 times.
|
3 | surfaces = doStraightSkeleton(polygon, roofPitchDegrees); |
| 33 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
|
3 | if (surfaces.empty()) { |
| 34 | ✗ | return surfaces; | |
| 35 | } | ||
| 36 | |||
| 37 |
1/1✓ Branch 1 taken 3 times.
|
3 | applyGables(surfaces); |
| 38 | |||
| 39 | ✗ | } catch (...) { | |
| 40 | ✗ | return surfaces; | |
| 41 | ✗ | } | |
| 42 | |||
| 43 | 3 | return surfaces; | |
| 44 | ✗ | } | |
| 45 | |||
| 46 | /// Generate hip roof polygons | ||
| 47 | 41 | std::vector<std::vector<Point3d>> generateHipRoof(std::vector<Point3d>& polygon, double roofPitchDegrees) { | |
| 48 | 41 | std::vector<std::vector<Point3d>> surfaces; | |
| 49 | try { | ||
| 50 |
1/1✓ Branch 1 taken 38 times.
|
41 | surfaces = doStraightSkeleton(polygon, roofPitchDegrees); |
| 51 | 3 | } catch (...) { | |
| 52 | 3 | return surfaces; | |
| 53 | 3 | } | |
| 54 | |||
| 55 | 38 | return surfaces; | |
| 56 | ✗ | } | |
| 57 | |||
| 58 | } // namespace openstudio | ||
| 59 |