ImplicitSurface.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_IMPLICIT_SURFACE_HPP
12 #define CUBBYFLOW_IMPLICIT_SURFACE_HPP
13 
15 
16 namespace CubbyFlow
17 {
19 template <size_t N>
20 class ImplicitSurface : public Surface<N>
21 {
22  public:
25 
27  ImplicitSurface(const Transform<N>& _transform = Transform<N>{},
28  bool _isNormalFlipped = false);
29 
31  ~ImplicitSurface() override = default;
32 
34  ImplicitSurface(const ImplicitSurface& other);
35 
37  ImplicitSurface(ImplicitSurface&& other) noexcept;
38 
41 
43  ImplicitSurface& operator=(ImplicitSurface&& other) noexcept;
44 
46  [[nodiscard]] double SignedDistance(
47  const Vector<double, N>& otherPoint) const;
48 
49  protected:
52  [[nodiscard]] virtual double SignedDistanceLocal(
53  const Vector<double, N>& otherPoint) const = 0;
54 
55  private:
56  [[nodiscard]] double ClosestDistanceLocal(
57  const Vector<double, N>& otherPoint) const override;
58 };
59 
62 
65 
67 using ImplicitSurface2Ptr = std::shared_ptr<ImplicitSurface2>;
68 
70 using ImplicitSurface3Ptr = std::shared_ptr<ImplicitSurface3>;
71 } // namespace CubbyFlow
72 
73 #endif
Abstract base class for N-D implicit surface.
Definition: ImplicitSurface.hpp:20
ImplicitSurface & operator=(const ImplicitSurface &other)
Copy assignment operator.
double SignedDistance(const Vector< double, N > &otherPoint) const
Returns signed distance from the given point otherPoint.
std::shared_ptr< ImplicitSurface3 > ImplicitSurface3Ptr
Shared pointer type for the ImplicitSurface3.
Definition: ImplicitSurface.hpp:70
Represents N-D rigid body transform.
Definition: Transform.hpp:82
Definition: Matrix.hpp:27
Definition: pybind11Utils.hpp:20
Abstract base class for N-D surface.
Definition: Surface.hpp:38
ImplicitSurface(const Transform< N > &_transform=Transform< N >{}, bool _isNormalFlipped=false)
Constructs an implicit surface with normal direction.
std::shared_ptr< ImplicitSurface2 > ImplicitSurface2Ptr
Shared pointer type for the ImplicitSurface2.
Definition: ImplicitSurface.hpp:67
virtual double SignedDistanceLocal(const Vector< double, N > &otherPoint) const =0
~ImplicitSurface() override=default
Default virtual destructor.