ImplicitSurface2.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: ImplicitSurface2.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: Abstract base class for 2-D implicit surface.
6 > Created Time: 2017/04/16
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_IMPLICIT_SURFACE2_H
10 #define CUBBYFLOW_IMPLICIT_SURFACE2_H
11 
12 #include <Core/Surface/Surface2.h>
13 
14 namespace CubbyFlow
15 {
17  class ImplicitSurface2 : public Surface2
18  {
19  public:
22  const Transform2& transform = Transform2(),
23  bool isNormalFlipped = false);
24 
26  ImplicitSurface2(const ImplicitSurface2& other);
27 
29  virtual ~ImplicitSurface2();
30 
32  double SignedDistance(const Vector2D& otherPoint) const;
33 
34  protected:
36  virtual double SignedDistanceLocal(const Vector2D& otherPoint) const = 0;
37 
38  private:
39  double ClosestDistanceLocal(const Vector2D& otherPoint) const override;
40  };
41 
43  using ImplicitSurface2Ptr = std::shared_ptr<ImplicitSurface2>;
44 }
45 
46 #endif
Represents 2-D rigid body transform.
Definition: Transform2.h:21
ImplicitSurface2(const Transform2 &transform=Transform2(), bool isNormalFlipped=false)
Default constructor.
virtual double SignedDistanceLocal(const Vector2D &otherPoint) const =0
Returns signed distance from the given point otherPoint in local space.
Transform2 transform
Local-to-world transform.
Definition: Surface2.h:36
Abstract base class for 2-D surface.
Definition: Surface2.h:32
bool isNormalFlipped
Flips normal.
Definition: Surface2.h:39
Definition: pybind11Utils.h:24
virtual ~ImplicitSurface2()
Default destructor.
std::shared_ptr< ImplicitSurface2 > ImplicitSurface2Ptr
Shared pointer type for the ImplicitSurface2.
Definition: ImplicitSurface2.h:43
Abstract base class for 2-D implicit surface.
Definition: ImplicitSurface2.h:17
2-D vector class.
Definition: Vector2.h:26
double SignedDistance(const Vector2D &otherPoint) const
Returns signed distance from the given point otherPoint.