suanPan
🧮 An Open Source, Parallel and Heterogeneous Finite Element Analysis Framework
Loading...
Searching...
No Matches
common.hpp
Go to the documentation of this file.
1
/*******************************************************************************
2
* Copyright (C) 2017-2026 Theodore Chang
3
*
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 3 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
******************************************************************************/
17
18
#ifndef TREE_COMMON_HPP
19
#define TREE_COMMON_HPP
20
21
#include <cmath>
22
#include <concepts>
23
#include <cstdint>
24
25
template
<std::
float
ing_po
int
T =
double
>
struct
Vector2D
{
26
const
T
x
,
y
;
27
};
28
29
template
<std::
float
ing_po
int
T =
double
>
struct
Node2D
:
Vector2D
<T> {
30
const
std::uint64_t
id
{0};
31
};
32
33
template
<std::
float
ing_po
int
T =
double
>
struct
BoundingBox
{
34
const
Vector2D<T>
center
,
dimension
;
35
36
bool
overlap
(
const
BoundingBox
& other)
const
{
return
std::fabs(
center
.
x
- other.
center
.
x
) < (
dimension
.
x
+ other.
dimension
.
x
) && std::fabs(
center
.
y
- other.
center
.
y
) < (
dimension
.
y
+ other.
dimension
.
y
); }
37
};
38
39
#endif
BoundingBox
Definition
common.hpp:33
BoundingBox::overlap
bool overlap(const BoundingBox &other) const
Definition
common.hpp:36
BoundingBox::center
const Vector2D< T > center
Definition
common.hpp:34
BoundingBox::dimension
const Vector2D< T > dimension
Definition
common.hpp:34
Node2D
Definition
common.hpp:29
Vector2D
Definition
common.hpp:25
Vector2D::x
const T x
Definition
common.hpp:26
Vector2D::y
const T y
Definition
common.hpp:26
Toolbox
tree
common.hpp
Generated by
1.9.8