Loading...
Searching...
No Matches
IntersectionQueryEngine.hpp
Go to the documentation of this file.
1// This code is based on Jet framework.
2// Copyright (c) 2018 Doyub Kim
3// CubbyFlow is voxel-based fluid simulation engine for computer games.
4// Copyright (c) 2020 CubbyFlow Team
5// Core Part: Chris Ohk, Junwoo Hwang, Jihong Sin, Seungwoo Yoo
6// AI Part: Dongheon Cho, Minseo Kim
7// We are making my contributions/submissions to this project solely in our
8// personal capacity and are not conveying any rights to any intellectual
9// property of any third parties.
10
11#ifndef CUBBYFLOW_INTERSECTION_QUERY_ENGINE_HPP
12#define CUBBYFLOW_INTERSECTION_QUERY_ENGINE_HPP
13
15#include <Core/Geometry/Ray.hpp>
17
18#include <functional>
19#include <limits>
20
21namespace CubbyFlow
22{
24template <typename T, size_t N>
26{
27 const T* item = nullptr;
28 double distance = std::numeric_limits<double>::max();
29};
30
32template <typename T>
34
36template <typename T>
38
40template <typename T, size_t N>
42 std::function<double(const T&, const Vector<double, N>&)>;
43
45template <typename T>
47
49template <typename T>
51
53template <typename T, size_t N>
55 std::function<bool(const T&, const BoundingBox<double, N>&)>;
56
58template <typename T>
60
62template <typename T>
64
66template <typename T, size_t N>
68 std::function<bool(const T&, const Ray<double, N>&)>;
69
71template <typename T>
73
75template <typename T>
77
79template <typename T, size_t N>
81 std::function<double(const T&, const Ray<double, N>&)>;
82
84template <typename T>
86
88template <typename T>
90
92template <typename T>
93using IntersectionVisitorFunc = std::function<void(const T&)>;
94
96template <typename T, size_t N>
147
149template <typename T>
151
153template <typename T>
155
156} // namespace CubbyFlow
157
158#endif
Abstract base class for N-D intersection test query engine.
Definition IntersectionQueryEngine.hpp:98
IntersectionQueryEngine()=default
Default constructor.
virtual bool Intersects(const Ray< double, N > &ray, const RayIntersectionTestFunc< T, N > &testFunc) const =0
Returns true if given ray intersects with any of the stored items.
IntersectionQueryEngine & operator=(const IntersectionQueryEngine &other)=default
Default copy assignment operator.
virtual ~IntersectionQueryEngine()=default
Default virtual destructor.
virtual ClosestIntersectionQueryResult< T, N > ClosestIntersection(const Ray< double, N > &ray, const GetRayIntersectionFunc< T, N > &testFunc) const =0
Returns the closest intersection for given ray.
virtual bool Intersects(const BoundingBox< double, N > &box, const BoxIntersectionTestFunc< T, N > &testFunc) const =0
Returns true if given box intersects with any of the stored items.
IntersectionQueryEngine & operator=(IntersectionQueryEngine &&other) noexcept=default
Default move assignment operator.
virtual void ForEachIntersectingItem(const BoundingBox< double, N > &box, const BoxIntersectionTestFunc< T, N > &testFunc, const IntersectionVisitorFunc< T > &visitorFunc) const =0
Invokes visitorFunc for every intersecting items.
virtual void ForEachIntersectingItem(const Ray< double, N > &ray, const RayIntersectionTestFunc< T, N > &testFunc, const IntersectionVisitorFunc< T > &visitorFunc) const =0
Invokes visitorFunc for every intersecting items.
IntersectionQueryEngine(const IntersectionQueryEngine &other)=default
Default copy constructor.
IntersectionQueryEngine(IntersectionQueryEngine &&other) noexcept=default
Default move constructor.
Definition Matrix.hpp:30
Definition pybind11Utils.hpp:21
std::function< bool(const T &, const BoundingBox< double, N > &)> BoxIntersectionTestFunc
N-D box-item intersection test function.
Definition IntersectionQueryEngine.hpp:55
std::function< bool(const T &, const Ray< double, N > &)> RayIntersectionTestFunc
N-D ray-item intersection test function.
Definition IntersectionQueryEngine.hpp:68
std::function< double(const T &, const Ray< double, N > &)> GetRayIntersectionFunc
N-D ray-item closest intersection evaluation function.
Definition IntersectionQueryEngine.hpp:81
std::function< double(const T &, const Vector< double, N > &)> ClosestIntersectionDistanceFunc
N-D closest intersection distance measure function.
Definition IntersectionQueryEngine.hpp:42
std::function< void(const T &)> IntersectionVisitorFunc
Visitor function which is invoked for each intersecting item.
Definition IntersectionQueryEngine.hpp:93
Matrix< T, Rows, 1 > Vector
Definition Matrix.hpp:738
N-D closest intersection query result.
Definition IntersectionQueryEngine.hpp:26
double distance
Definition IntersectionQueryEngine.hpp:28
const T * item
Definition IntersectionQueryEngine.hpp:27