Loading...
Searching...
No Matches
ListQueryEngine.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_LIST_QUERY_ENGINE_HPP
12#define CUBBYFLOW_LIST_QUERY_ENGINE_HPP
13
14#include <Core/Array/Array.hpp>
18
19namespace CubbyFlow
20{
22template <typename T, size_t N>
25{
26 public:
28 void Add(const T& item);
29
31 void Add(const ConstArrayView1<T>& items);
32
34 [[nodiscard]] bool Intersects(
36 const BoxIntersectionTestFunc<T, N>& testFunc) const override;
37
39 [[nodiscard]] bool Intersects(
40 const Ray<double, N>& ray,
41 const RayIntersectionTestFunc<T, N>& testFunc) const override;
42
47 const IntersectionVisitorFunc<T>& visitorFunc) const override;
48
51 const Ray<double, N>& ray,
53 const IntersectionVisitorFunc<T>& visitorFunc) const override;
54
57 const Ray<double, N>& ray,
58 const GetRayIntersectionFunc<T, N>& testFunc) const override;
59
63 const Vector<double, N>& pt,
65
66 private:
67 Array1<T> m_items;
68};
69
71template <typename T>
73
75template <typename T>
77} // namespace CubbyFlow
78
80
81#endif
Abstract base class for N-D intersection test query engine.
Definition IntersectionQueryEngine.hpp:98
Ad-hoc list-based N-D intersection/nearest-neighbor query engine.
Definition ListQueryEngine.hpp:25
void Add(const T &item)
Adds an item to the container.
Definition ListQueryEngine-Impl.hpp:17
bool Intersects(const BoundingBox< double, N > &box, const BoxIntersectionTestFunc< T, N > &testFunc) const override
Returns true if given box intersects with any of the stored items.
Definition ListQueryEngine-Impl.hpp:29
ClosestIntersectionQueryResult< T, N > ClosestIntersection(const Ray< double, N > &ray, const GetRayIntersectionFunc< T, N > &testFunc) const override
Returns the closest intersection for given ray.
Definition ListQueryEngine-Impl.hpp:76
void ForEachIntersectingItem(const BoundingBox< double, N > &box, const BoxIntersectionTestFunc< T, N > &testFunc, const IntersectionVisitorFunc< T > &visitorFunc) const override
Invokes visitorFunc for every intersecting items.
Definition ListQueryEngine-Impl.hpp:47
NearestNeighborQueryResult< T, N > Nearest(const Vector< double, N > &pt, const NearestNeighborDistanceFunc< T, N > &distanceFunc) const override
Definition ListQueryEngine-Impl.hpp:95
Definition Matrix.hpp:30
Abstract base class for N-D nearest neighbor query engine.
Definition NearestNeighborQueryEngine.hpp:53
Definition pybind11Utils.hpp:21
Matrix< T, Rows, 1 > Vector
Definition Matrix.hpp:738