World Builder  1.1.0-pre
A geodynamic initial conditions generator
surface.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2018-2024 by the authors of the World Builder code.
3 
4  This file is part of the World Builder.
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation, either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef WORLD_BUILDER_OBJECTS_SURFACE_H
21 #define WORLD_BUILDER_OBJECTS_SURFACE_H
22 
24 #include "world_builder/kd_tree.h"
25 
26 namespace WorldBuilder
27 {
28  namespace Objects
29  {
31  {
36 
38  size_t triangle_index_,
39  double interpolated_value_,
40  double interpolator_s_,
41  double interpolator_t_)
42  :
43  triangle_index(triangle_index_),
44  interpolated_value(interpolated_value_),
45  interpolator_s(interpolator_s_),
46  interpolator_t(interpolator_t_) {};
47 
48  SurfaceValueInfo(double interpolated_value_)
49  :
50  triangle_index(NaN::IQNAN),
51  interpolated_value(interpolated_value_),
52  interpolator_s(NaN::DQNAN),
53  interpolator_t(NaN::DQNAN) {};
54  };
55 
56  class Surface
57  {
58  public:
62  Surface();
63 
67  Surface(std::pair<std::vector<double>,std::vector<double>> values_at_points);
68 
72  SurfaceValueInfo local_value(const Point<2> &check_point) const;
73 
78 
82  double minimum;
83 
87  double maximum;
88 
94 
98  std::vector<std::array<std::array<double,3>,3> > triangles;
99 
103  std::vector<std::array<double,8> > in_triangle_precomputed;
104 
105  private:
106 
107  };
108  }
109 
110 }
111 
112 #endif
SurfaceValueInfo(size_t triangle_index_, double interpolated_value_, double interpolator_s_, double interpolator_t_)
Definition: surface.h:37
std::vector< std::array< double, 8 > > in_triangle_precomputed
Stores precomputed values.
Definition: surface.h:103
const double DQNAN
Definition: nan.h:32
const unsigned int IQNAN
Definition: nan.h:37
std::vector< std::array< std::array< double, 3 >, 3 > > triangles
Definition: surface.h:98
SurfaceValueInfo(double interpolated_value_)
Definition: surface.h:48