OGS
Surface.h
Go to the documentation of this file.
1
10#pragma once
11
12#include <memory>
13#include <vector>
14
15#include "AABB.h"
16#include "GeoObject.h"
17#include "Point.h"
18
19namespace GeoLib
20{
21
22class Polyline;
23
24class Triangle;
25class SurfaceGrid;
26
34class Surface final : public GeoObject
35{
36public:
37 explicit Surface(const std::vector<Point*>& pnt_vec);
38 Surface(Surface const& src);
39 ~Surface() override;
40
41 Surface(Surface&& src) = delete;
42 Surface& operator=(Surface const& src) = delete;
43 Surface& operator=(Surface&& src) = delete;
44
46 GEOTYPE getGeoType() const override { return GEOTYPE::SURFACE; }
50 void addTriangle(std::size_t pnt_a, std::size_t pnt_b, std::size_t pnt_c);
51
55 std::size_t getNumberOfTriangles() const;
56
60 const Triangle* operator[](std::size_t i) const;
61
65 bool isPntInBoundingVolume(MathLib::Point3d const& pnt, double eps) const;
66
73 bool isPntInSfc(MathLib::Point3d const& pnt, double eps) const;
74
75 const std::vector<Point*>* getPointVec() const { return &_sfc_pnts; }
80 AABB const& getAABB() const { return *_bounding_volume; }
81
82protected:
84 const std::vector<Point*>& _sfc_pnts;
86 std::vector<Triangle*> _sfc_triangles;
88 std::unique_ptr<AABB> _bounding_volume;
93 mutable std::unique_ptr<SurfaceGrid> _surface_grid;
94};
95
96bool operator==(Surface const& lhs, Surface const& rhs);
97
99void resetPointIDs(Surface& surface, std::vector<std::size_t> const& mapping);
100
101void markUsedPoints(Surface const& surface, std::vector<bool>& used_points);
102} // 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:56
A Surface is represented by Triangles. It consists of a reference to a vector of (pointers to) points...
Definition: Surface.h:35
Surface & operator=(Surface &&src)=delete
std::unique_ptr< AABB > _bounding_volume
Definition: Surface.h:88
AABB const & getAABB() const
Definition: Surface.h:80
std::unique_ptr< SurfaceGrid > _surface_grid
Definition: Surface.h:93
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:84
std::vector< Triangle * > _sfc_triangles
Definition: Surface.h:86
GEOTYPE getGeoType() const override
return a geometry type
Definition: Surface.h:46
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
const std::vector< Point * > * getPointVec() const
Definition: Surface.h:75
Surface(Surface &&src)=delete
bool isPntInSfc(MathLib::Point3d const &pnt, double eps) const
Definition: Surface.cpp:99
Surface & operator=(Surface const &src)=delete
Class Triangle consists of a reference to a point vector and a vector that stores the indices in the ...
Definition: Triangle.h:27
GEOTYPE
Definition: GeoType.h:27
void markUsedPoints(Polyline const &polyline, std::vector< bool > &used_points)
Resets the point IDs of the polyline corresponding to the mapping.
Definition: Polyline.cpp:490
void resetPointIDs(Polyline &polyline, std::vector< std::size_t > const &mapping)
Resets the point IDs of the polyline corresponding to the mapping.
Definition: Polyline.cpp:475
bool operator==(LineSegment const &s0, LineSegment const &s1)