Loading...
Searching...
No Matches
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
16namespace CubbyFlow
17{
19template <size_t N>
20class ImplicitSurface : public Surface<N>
21{
22 public:
23 using Surface<N>::transform;
25
28 bool _isNormalFlipped = false);
29
31 ~ImplicitSurface() override = default;
32
35
38
41
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
67using ImplicitSurface2Ptr = std::shared_ptr<ImplicitSurface2>;
68
70using ImplicitSurface3Ptr = std::shared_ptr<ImplicitSurface3>;
71} // namespace CubbyFlow
72
73#endif
Abstract base class for N-D implicit surface.
Definition ImplicitSurface.hpp:21
ImplicitSurface(ImplicitSurface &&other) noexcept
Move constructor.
ImplicitSurface(const Transform< N > &_transform=Transform< N >{}, bool _isNormalFlipped=false)
Constructs an implicit surface with normal direction.
virtual double SignedDistanceLocal(const Vector< double, N > &otherPoint) const =0
ImplicitSurface(const ImplicitSurface &other)
Copy constructor.
ImplicitSurface & operator=(const ImplicitSurface &other)
Copy assignment operator.
ImplicitSurface & operator=(ImplicitSurface &&other) noexcept
Move assignment operator.
double SignedDistance(const Vector< double, N > &otherPoint) const
Returns signed distance from the given point otherPoint.
~ImplicitSurface() override=default
Default virtual destructor.
Definition Matrix.hpp:30
Abstract base class for N-D surface.
Definition Surface.hpp:39
bool isNormalFlipped
Flips normal.
Definition Surface.hpp:102
Transform< N > transform
Local-to-world transform.
Definition Surface.hpp:99
Represents N-D rigid body transform.
Definition Transform.hpp:83
Definition pybind11Utils.hpp:21
std::shared_ptr< ImplicitSurface3 > ImplicitSurface3Ptr
Shared pointer type for the ImplicitSurface3.
Definition ImplicitSurface.hpp:70
std::shared_ptr< ImplicitSurface2 > ImplicitSurface2Ptr
Shared pointer type for the ImplicitSurface2.
Definition ImplicitSurface.hpp:67