OGS
GeoLib/Surface.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <memory>
7#include <vector>
8
9#include "AABB.h"
10#include "GeoObject.h"
11#include "Point.h"
12
13namespace GeoLib
14{
15
16class Polyline;
17
18class Triangle;
19class SurfaceGrid;
20
26class Surface final : public GeoObject
27{
28public:
29 explicit Surface(const std::vector<Point*>& pnt_vec);
30 Surface(Surface const& src);
31 ~Surface() override;
32
33 Surface(Surface&& src) = delete;
34 Surface& operator=(Surface const& src) = delete;
35 Surface& operator=(Surface&& src) = delete;
36
38 GEOTYPE getGeoType() const override { return GEOTYPE::SURFACE; }
42 void addTriangle(std::size_t pnt_a, std::size_t pnt_b, std::size_t pnt_c);
43
47 std::size_t getNumberOfTriangles() const;
48
52 const Triangle* operator[](std::size_t i) const;
53
57 bool isPntInBoundingVolume(MathLib::Point3d const& pnt, double eps) const;
58
65 bool isPntInSfc(MathLib::Point3d const& pnt, double eps) const;
66
67 const std::vector<Point*>* getPointVec() const { return &_sfc_pnts; }
72 AABB const& getAABB() const { return *_bounding_volume; }
73
74protected:
76 const std::vector<Point*>& _sfc_pnts;
78 std::vector<Triangle*> _sfc_triangles;
80 std::unique_ptr<AABB> _bounding_volume;
85 mutable std::unique_ptr<SurfaceGrid> _surface_grid;
86};
87
88bool operator==(Surface const& lhs, Surface const& rhs);
89
91void resetPointIDs(Surface& surface, std::vector<std::size_t> const& mapping);
92
93void markUsedPoints(Surface const& surface, std::vector<bool>& used_points);
94} // namespace GeoLib
Class AABB is an axis aligned bounding box around a given set of geometric points of (template) type ...
Definition AABB.h:45
Class Polyline consists mainly of a reference to a point vector and a vector that stores the indices ...
Definition Polyline.h:29
A Surface is represented by Triangles. It consists of a reference to a vector of (pointers to) points...
Surface & operator=(Surface &&src)=delete
std::unique_ptr< AABB > _bounding_volume
AABB const & getAABB() const
std::unique_ptr< SurfaceGrid > _surface_grid
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:81
const std::vector< Point * > & _sfc_pnts
std::vector< Triangle * > _sfc_triangles
GEOTYPE getGeoType() const override
return a geometry type
std::size_t getNumberOfTriangles() const
Definition Surface.cpp:76
~Surface() override
Definition Surface.cpp:35
void addTriangle(std::size_t pnt_a, std::size_t pnt_b, std::size_t pnt_c)
Definition Surface.cpp:43
bool isPntInBoundingVolume(MathLib::Point3d const &pnt, double eps) const
Definition Surface.cpp:87
const std::vector< Point * > * getPointVec() const
Surface(Surface &&src)=delete
Surface(const std::vector< Point * > &pnt_vec)
Definition Surface.cpp:18
bool isPntInSfc(MathLib::Point3d const &pnt, double eps) const
Definition Surface.cpp:93
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:21
void markUsedPoints(Polyline const &polyline, std::vector< bool > &used_points)
Resets the point IDs of the polyline corresponding to the mapping.
Definition Polyline.cpp:479
GEOTYPE
Definition GeoType.h:12
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:464
bool operator==(LineSegment const &s0, LineSegment const &s1)