EBGeometry 1.0
Loading...
Searching...
No Matches
EBGeometry_BoundingVolumes.hpp
Go to the documentation of this file.
1/* EBGeometry
2 * Copyright © 2022 Robert Marskar
3 * Please refer to Copyright.txt and LICENSE in the EBGeometry root directory.
4 */
5
13#ifndef EBGeometry_BoundingVolumes_H
14#define EBGeometry_BoundingVolumes_H
15
16// Std includes
17#include <vector>
18#include <iostream>
19
20// Our includes
21#include "EBGeometry_Vec.hpp"
23
28namespace BoundingVolumes {
29
35 template <class T>
37 {
38 public:
42 friend std::ostream&
43 operator<<(std::ostream& os, const BoundingSphereT<T>& sphere)
44 {
45 os << '(' << sphere.getCentroid() << ", " << sphere.getRadius() << ')';
46
47 return os;
48 }
49
55 {
56 Ritter,
57 };
58
62 using Vec3 = Vec3T<T>;
63
68
75
82
88
100
105
112
121 inline void
123
129 inline bool
131
135 inline T&
137
141 inline const T&
143
147 inline Vec3&
149
155
162 inline T
164
172 inline T
174
179 inline T
181
186 inline T
188
189 protected:
194
199
205 inline void
207 };
208
217 {
218 public:
222 friend std::ostream&
223 operator<<(std::ostream& os, const AABBT<T>& aabb)
224 {
225 os << '(' << aabb.getLowCorner() << ", " << aabb.getHighCorner() << ')';
226
227 return os;
228 }
229
233 using Vec3 = Vec3T<T>;
234
238 inline AABBT() noexcept;
239
246
252
259
268
273
278 AABBT&
280
287 inline void
289
295 inline bool
297
301 inline Vec3T<T>&
302 getLowCorner() noexcept;
303
308 getLowCorner() const noexcept;
309
313 inline Vec3T<T>&
314 getHighCorner() noexcept;
315
320 getHighCorner() const noexcept;
321
327
333 inline T
335
343 inline T
345
349 inline T
351
355 inline T
357
358 protected:
362 Vec3 m_loCorner;
363
367 Vec3 m_hiCorner;
368 };
369
376 bool
378
385 bool
387
394 T
396
403 T
405} // namespace BoundingVolumes
406
407#include "EBGeometry_NamespaceFooter.hpp"
408
409#include "EBGeometry_BoundingVolumesImplem.hpp"
410
411#endif
Declaration of 2D and 3D point/vector classes with templated precision. Used with DCEL tools.
Axis-aligned bounding box as bounding volume.
Definition EBGeometry_BoundingVolumes.hpp:217
AABBT() noexcept
Default constructor (does nothing)
Class which encloses a set of points using a bounding sphere.
Definition EBGeometry_BoundingVolumes.hpp:37
T getDistance(const Vec3 &a_x0) const noexcept
Get the distance to this bounding sphere (points inside the sphere have a zero distance)
friend std::ostream & operator<<(std::ostream &os, const BoundingSphereT< T > &sphere)
For outputting a vector to an output stream.
Definition EBGeometry_BoundingVolumes.hpp:43
T getArea() const noexcept
Get the sphere area.
T getVolume() const noexcept
Get the sphere volume.
T getOverlappingVolume(const BoundingSphereT< T > &a_other) const noexcept
Compute the overlapping volume between this bounding sphere and another.
T & getRadius() noexcept
Get modifiable radius for this sphere.
BoundingSphereT() noexcept
Default constructor. Leaves object in undefined state.
bool intersects(const BoundingSphereT &a_other) const noexcept
Check if this bounding sphere intersect another bounding sphere.
void define(const std::vector< Vec3T< P > > &a_points, const BoundingVolumeAlgorithm &a_alg) noexcept
Template define function which takes a set of 3D points (mixed precision allowed).
void buildRitter(const std::vector< Vec3T< P > > &a_points) noexcept
Template function which computes the bounding sphere for a set of points (mixed precision allowed) us...
Vec3 m_center
Sphere center.
Definition EBGeometry_BoundingVolumes.hpp:198
Vec3 & getCentroid() noexcept
Get modifiable center for this sphere.
T m_radius
Sphere radius.
Definition EBGeometry_BoundingVolumes.hpp:193
BoundingVolumeAlgorithm
Typename for possible algorithms that support the computation of a bounding sphere for a set of 3D po...
Definition EBGeometry_BoundingVolumes.hpp:55
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:218
Namespace for encapsulating various bounding volumes for usage with BVHs.
Definition EBGeometry_BoundingVolumes.hpp:28