OpenMEEG
Loading...
Searching...
No Matches
boundingbox.h
Go to the documentation of this file.
1// Project Name: OpenMEEG (http://openmeeg.github.io)
2// © INRIA and ENPC under the French open source license CeCILL-B.
3// See full copyright notice in the file LICENSE.txt
4// If you make a copy of this file, you must either:
5// - provide also LICENSE.txt and modify this header to refer to it.
6// - replace this header by the LICENSE.txt content.
7
8#pragma once
9
10#include <random>
11
12#include <vertex.h>
13
14namespace OpenMEEG {
15
17
19 public:
20
22
23 void add(const Vertex& V) {
24 xmin = std::min(xmin,V.x());
25 ymin = std::min(ymin,V.y());
26 zmin = std::min(zmin,V.z());
27 xmax = std::max(xmax,V.x());
28 ymax = std::max(ymax,V.y());
29 zmax = std::max(zmax,V.z());
30 }
31
32 void add(const Vertex* Vp) { add(*Vp); }
33
35 std::random_device rd;
36 std::mt19937 gen(rd());
37 std::uniform_real_distribution<> disx(xmin,xmax);
38 std::uniform_real_distribution<> disy(ymin,ymax);
39 std::uniform_real_distribution<> disz(zmin,zmax);
40 return Vertex(disx(gen),disy(gen),disz(gen));
41 }
42
43 Vertex min() const { return Vertex(xmin,ymin,zmin); }
44 Vertex max() const { return Vertex(xmax,ymax,zmax); }
45
46 Vertex center() const { return 0.5*(min()+max()); }
47
48 private:
49
50 double xmin = std::numeric_limits<double>::max();
51 double ymin = std::numeric_limits<double>::max();
52 double zmin = std::numeric_limits<double>::max();
53 double xmax = -std::numeric_limits<double>::max();
54 double ymax = -std::numeric_limits<double>::max();
55 double zmax = -std::numeric_limits<double>::max();
56
57 };
58}
An Oriented Mesh is a mesh associated with a boolean stating if it is well oriented.
Definition: boundingbox.h:18
void add(const Vertex &V)
Definition: boundingbox.h:23
void add(const Vertex *Vp)
Definition: boundingbox.h:32
Vertex max() const
Definition: boundingbox.h:44
Vertex random_point() const
Definition: boundingbox.h:34
Vertex min() const
Definition: boundingbox.h:43
Vertex center() const
Definition: boundingbox.h:46
double & y()
Definition: vect3.h:55
double & z()
Definition: vect3.h:58
double & x()
Definition: vect3.h:52
Vertex.
Definition: vertex.h:20