OPALX (Object Oriented Parallel Accelerator Library for Exascal) MINIorX
OPALX
BoundingBox2D.h
Go to the documentation of this file.
1//
2// Class BoundingBox2D
3//
4// This class provides functionality to compute bounding boxes, to compute if a position
5// is inside the box.
6//
7// Copyright (c) 2018 - 2021, Christof Metzger-Kraus
8//
9// All rights reserved
10//
11// This file is part of OPAL.
12//
13// OPAL is free software: you can redistribute it and/or modify
14// it under the terms of the GNU General Public License as published by
15// the Free Software Foundation, either version 3 of the License, or
16// (at your option) any later version.
17//
18// You should have received a copy of the GNU General Public License
19// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
20//
21#ifndef MSLANG_BOUNDINGBOX_H
22#define MSLANG_BOUNDINGBOX_H
23
24#include "OPALTypes.h"
25
26#include <fstream>
27#include <iostream>
28
29namespace mslang {
32 double width_m;
33 double height_m;
34
35 BoundingBox2D() : center_m(0.0), width_m(0.0), height_m(0.0) {
36 }
37
39 : center_m(right.center_m), width_m(right.width_m), height_m(right.height_m) {
40 }
41
43 : center_m(0.5 * (llc + urc)), width_m(urc[0] - llc[0]), height_m(urc[1] - llc[1]) {
44 }
45
47 bool doesIntersect(const BoundingBox2D& bb) const;
48 bool isInside(const Vector_t<double, 3>& X) const;
49 bool isInside(const BoundingBox2D& b) const;
50 virtual void writeGnuplot(std::ostream& out) const;
51 void print(std::ostream& out) const;
52 };
53
54 std::ostream& operator<<(std::ostream& out, const BoundingBox2D& bb);
55} // namespace mslang
56
57#endif
ippl::Vector< T, Dim > Vector_t
std::ostream & operator<<(std::ostream &out, const BoundingBox2D &bb)
BoundingBox2D(const BoundingBox2D &right)
Vector_t< double, 3 > center_m
BoundingBox2D(const Vector_t< double, 3 > &llc, const Vector_t< double, 3 > &urc)
void print(std::ostream &out) const
bool isInside(const Vector_t< double, 3 > &X) const
virtual void writeGnuplot(std::ostream &out) const
bool doesIntersect(const BoundingBox2D &bb) const
BoundingBox2D & operator=(const BoundingBox2D &)=default