OGS
SurfaceGrid.h
Go to the documentation of this file.
1/*
2 * \file
3 * \date 2012-09-22
4 * \brief Declaration of the SurfaceGrid class.
5 *
7 * Copyright (c) 2012-2024, OpenGeoSys Community (http://www.opengeosys.org)
9 * See accompanying file LICENSE.txt or
11 */
12
13#pragma once
14
15#include <array>
16#include <limits>
17#include <optional>
18#include <vector>
19
20#include "AABB.h"
21#include "Point.h"
22
23namespace GeoLib
24{
25
26// forward declarations
27class Triangle;
28class Surface;
29
30class SurfaceGrid final : public AABB
31{
32public:
33 explicit SurfaceGrid(GeoLib::Surface const* const sfc);
35 MathLib::Point3d const& pnt,
36 double eps = std::numeric_limits<double>::epsilon()) const;
37
38private:
39 void sortTrianglesInGridCells(GeoLib::Surface const* const sfc);
40 bool sortTriangleInGridCells(GeoLib::Triangle const* const triangle);
41 std::optional<std::array<std::size_t, 3>> getGridCellCoordinates(
42 MathLib::Point3d const& p) const;
43 std::array<double, 3> _step_sizes{};
44 std::array<double, 3> _inverse_step_sizes{};
45 std::array<std::size_t, 3> _n_steps;
46 std::vector<std::vector<GeoLib::Triangle const*>> _triangles_in_grid_box;
47};
48
49} // end namespace GeoLib
Definition of the AABB class.
Definition of the Point class.
Class AABB is an axis aligned bounding box around a given set of geometric points of (template) type ...
Definition AABB.h:56
void sortTrianglesInGridCells(GeoLib::Surface const *const sfc)
std::vector< std::vector< GeoLib::Triangle const * > > _triangles_in_grid_box
Definition SurfaceGrid.h:46
bool isPointInSurface(MathLib::Point3d const &pnt, double eps=std::numeric_limits< double >::epsilon()) const
std::array< std::size_t, 3 > _n_steps
Definition SurfaceGrid.h:45
std::array< double, 3 > _inverse_step_sizes
Definition SurfaceGrid.h:44
bool sortTriangleInGridCells(GeoLib::Triangle const *const triangle)
SurfaceGrid(GeoLib::Surface const *const sfc)
std::optional< std::array< std::size_t, 3 > > getGridCellCoordinates(MathLib::Point3d const &p) const
std::array< double, 3 > _step_sizes
Definition SurfaceGrid.h:43
A Surface is represented by Triangles. It consists of a reference to a vector of (pointers to) points...
Definition Surface.h:33
Class Triangle consists of a reference to a point vector and a vector that stores the indices in the ...
Definition Triangle.h:27