GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 4 / 0 / 4
Functions: 100.0% 4 / 0 / 4
Branches: 100.0% 4 / 0 / 4

src/utilities/geometry/Point3d.hpp
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 #ifndef UTILITIES_GEOMETRY_POINT3D_HPP
7 #define UTILITIES_GEOMETRY_POINT3D_HPP
8
9 #include "../UtilitiesAPI.hpp"
10 #include "../data/Vector.hpp"
11 #include "../core/Logger.hpp"
12
13 #include <vector>
14 #include <boost/optional.hpp>
15
16 namespace openstudio {
17
18 // forward declaration
19 class Vector3d;
20
21 class UTILITIES_API Point3d
22 {
23 public:
24 /// default constructor creates point at 0, 0, 0
25 Point3d();
26
27 /// constructor with x, y, z
28 Point3d(double x, double y, double z);
29
30 // Copy and move operators are implicitly declared, but we want the copy ctor for SWIG so we have to define all of them
31 19181790 Point3d(const Point3d& other) = default;
32 3928775 Point3d(Point3d&& other) noexcept = default;
33
2/2
✓ Branch 1 taken 363266 times.
✓ Branch 4 taken 363266 times.
363266 Point3d& operator=(const Point3d&) = default;
34
2/2
✓ Branch 1 taken 5517365 times.
✓ Branch 4 taken 5517365 times.
5517365 Point3d& operator=(Point3d&&) noexcept = default;
35 // ~Point3d() noexcept = default;
36
37 /// get x
38 double x() const;
39
40 /// get y
41 double y() const;
42
43 /// get z
44 double z() const;
45
46 /// point plus a vector is a new point
47 Point3d operator+(const Vector3d& vec) const;
48
49 /// point plus a vector is a new point
50 Point3d& operator+=(const Vector3d& vec);
51
52 /// point minus another point is a vector
53 Vector3d operator-(const Point3d& other) const;
54
55 /// check equality
56 bool operator==(const Point3d& other) const;
57
58 /// check inequality
59 bool operator!=(const Point3d& other) const;
60
61 private:
62 REGISTER_LOGGER("utilities.Point3d");
63 Vector m_storage;
64 };
65
66 /// ostream operator
67 UTILITIES_API std::ostream& operator<<(std::ostream& os, const Point3d& point);
68
69 /// ostream operator
70 UTILITIES_API std::ostream& operator<<(std::ostream& os, const std::vector<Point3d>& pointVector);
71
72 /// ostream operator
73 UTILITIES_API std::ostream& operator<<(std::ostream& os, const std::vector<std::vector<Point3d>>& pointVectorVector);
74
75 // optional Point3d
76 using OptionalPoint3d = boost::optional<Point3d>;
77
78 // vector of Point3d
79 using Point3dVector = std::vector<Point3d>;
80
81 // vector of Point3dVector
82 using Point3dVectorVector = std::vector<Point3dVector>;
83
84 } // namespace openstudio
85
86 #endif //UTILITIES_GEOMETRY_POINT3D_HPP
87