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
32class Surface final : public GeoObject
33{
34public:
35 explicit Surface(const std::vector<Point*>& pnt_vec);
36 Surface(Surface const& src);
37 ~Surface() override;
38
39 Surface(Surface&& src) = delete;
40 Surface& operator=(Surface const& src) = delete;
41 Surface& operator=(Surface&& src) = delete;
42
44 GEOTYPE getGeoType() const override { return GEOTYPE::SURFACE; }
48 void addTriangle(std::size_t pnt_a, std::size_t pnt_b, std::size_t pnt_c);
49
53 std::size_t getNumberOfTriangles() const;
54
58 const Triangle* operator[](std::size_t i) const;
59
63 bool isPntInBoundingVolume(MathLib::Point3d const& pnt, double eps) const;
64
71 bool isPntInSfc(MathLib::Point3d const& pnt, double eps) const;
72
73 const std::vector<Point*>* getPointVec() const { return &_sfc_pnts; }
78 AABB const& getAABB() const { return *_bounding_volume; }
79
80protected:
82 const std::vector<Point*>& _sfc_pnts;
84 std::vector<Triangle*> _sfc_triangles;
86 std::unique_ptr<AABB> _bounding_volume;
91 mutable std::unique_ptr<SurfaceGrid> _surface_grid;
92};
93
94bool operator==(Surface const& lhs, Surface const& rhs);
95
97void resetPointIDs(Surface& surface, std::vector<std::size_t> const& mapping);
98
99void markUsedPoints(Surface const& surface, std::vector<bool>& used_points);
100} // namespace GeoLib
Definition of the AABB class.
Definition of the Point 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:33
Surface & operator=(Surface &&src)=delete
std::unique_ptr< AABB > _bounding_volume
Definition Surface.h:86
AABB const & getAABB() const
Definition Surface.h:78
std::unique_ptr< SurfaceGrid > _surface_grid
Definition Surface.h:91
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:82
std::vector< Triangle * > _sfc_triangles
Definition Surface.h:84
GEOTYPE getGeoType() const override
return a geometry type
Definition Surface.h:44
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:73
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
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
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
GEOTYPE
Definition GeoType.h:23
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)