OGS
Surface.h
Go to the documentation of this file.
1 
10 #pragma once
11 
12 #include <vector>
13 #include <memory>
14 
15 #include "GeoObject.h"
16 #include "Point.h"
17 #include "AABB.h"
18 
19 namespace GeoLib {
20 
21 class Polyline;
22 
23 class Triangle;
24 class SurfaceGrid;
25 
33 class Surface final : public GeoObject
34 {
35 public:
36  explicit Surface(const std::vector<Point*>& pnt_vec);
37  Surface(Surface const& src);
38  ~Surface() override;
39 
40  Surface(Surface && src) = delete;
41  Surface& operator=(Surface const& src) = delete;
42  Surface& operator=(Surface && src) = delete;
43 
45  GEOTYPE getGeoType() const override { return GEOTYPE::SURFACE; }
49  void addTriangle(std::size_t pnt_a, std::size_t pnt_b, std::size_t pnt_c);
50 
54  std::size_t getNumberOfTriangles() const;
55 
59  const Triangle* operator[](std::size_t i) const;
60 
64  bool isPntInBoundingVolume(MathLib::Point3d const& pnt, double eps) const;
65 
72  bool isPntInSfc(MathLib::Point3d const& pnt, double eps) const;
73 
74  const std::vector<Point*>* getPointVec() const { return &_sfc_pnts; }
79  AABB const& getAABB() const { return *_bounding_volume; }
80 
81 protected:
83  const std::vector<Point*>& _sfc_pnts;
85  std::vector<Triangle*> _sfc_triangles;
87  std::unique_ptr<AABB> _bounding_volume;
92  mutable std::unique_ptr<SurfaceGrid> _surface_grid;
93 };
94 
95 bool operator==(Surface const& lhs, Surface const& rhs);
96 
97 } // namespace GeoLib
Definition of the AABB class.
Base class for classes Point, Polyline, Surface.
Class AABB is an axis aligned bounding box around a given set of geometric points of (template) type ...
Definition: AABB.h:49
A Surface is represented by Triangles. It consists of a reference to a vector of (pointers to) points...
Definition: Surface.h:34
std::unique_ptr< AABB > _bounding_volume
Definition: Surface.h:87
const std::vector< Point * > * getPointVec() const
Definition: Surface.h:74
std::unique_ptr< SurfaceGrid > _surface_grid
Definition: Surface.h:92
Surface & operator=(Surface const &src)=delete
Surface & operator=(Surface &&src)=delete
const Triangle * operator[](std::size_t i) const
const access operator for the access to the i-th Triangle of the surface.
Definition: Surface.cpp:87
const std::vector< Point * > & _sfc_pnts
Definition: Surface.h:83
std::vector< Triangle * > _sfc_triangles
Definition: Surface.h:85
GEOTYPE getGeoType() const override
return a geometry type
Definition: Surface.h:45
std::size_t getNumberOfTriangles() const
Definition: Surface.cpp:82
~Surface() override
Definition: Surface.cpp:41
void addTriangle(std::size_t pnt_a, std::size_t pnt_b, std::size_t pnt_c)
Definition: Surface.cpp:49
bool isPntInBoundingVolume(MathLib::Point3d const &pnt, double eps) const
Definition: Surface.cpp:93
AABB const & getAABB() const
Definition: Surface.h:79
Surface(Surface &&src)=delete
Surface(const std::vector< Point * > &pnt_vec)
Definition: Surface.cpp:24
bool isPntInSfc(MathLib::Point3d const &pnt, double eps) const
Definition: Surface.cpp:99
Class Triangle consists of a reference to a point vector and a vector that stores the indices in the ...
Definition: Triangle.h:26
GEOTYPE
Definition: GeoType.h:25
bool operator==(LineSegment const &s0, LineSegment const &s1)