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
25template<std::floating_point T = double> struct Vector2D {
26 const T x, y;
27};
28
29template<std::floating_point T = double> struct Node2D : Vector2D<T> {
30 const std::uint64_t id{0};
31};
32
33template<std::floating_point T = double> struct BoundingBox {
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
Definition common.hpp:33
bool overlap(const BoundingBox &other) const
Definition common.hpp:36
const Vector2D< T > center
Definition common.hpp:34
const Vector2D< T > dimension
Definition common.hpp:34
Definition common.hpp:29
Definition common.hpp:25
const T x
Definition common.hpp:26
const T y
Definition common.hpp:26