OpenMEEG
Toggle main menu visibility
Loading...
Searching...
No Matches
OpenMEEG
include
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
14
namespace
OpenMEEG
{
15
17
18
class
BoundingBox
{
19
public
:
20
21
BoundingBox
() { }
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
34
Vertex
random_point
()
const
{
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
}
OpenMEEG::BoundingBox::add
void add(const Vertex &V)
Definition
boundingbox.h:23
OpenMEEG::BoundingBox::add
void add(const Vertex *Vp)
Definition
boundingbox.h:32
OpenMEEG::BoundingBox::BoundingBox
BoundingBox()
Definition
boundingbox.h:21
OpenMEEG::BoundingBox::max
Vertex max() const
Definition
boundingbox.h:44
OpenMEEG::BoundingBox::random_point
Vertex random_point() const
Definition
boundingbox.h:34
OpenMEEG::BoundingBox::min
Vertex min() const
Definition
boundingbox.h:43
OpenMEEG::BoundingBox::center
Vertex center() const
Definition
boundingbox.h:46
OpenMEEG::Vect3::y
double & y()
Definition
vect3.h:55
OpenMEEG::Vect3::z
double & z()
Definition
vect3.h:58
OpenMEEG::Vect3::x
double & x()
Definition
vect3.h:52
OpenMEEG::Vertex
Vertex.
Definition
vertex.h:20
OpenMEEG
Definition
analytics.h:14
vertex.h
Generated by
1.17.0