Jet  v1.3.3
surface_to_implicit2.h
Go to the documentation of this file.
1 // Copyright (c) 2019 Doyub Kim
2 //
3 // I am making my contributions/submissions to this project solely in my
4 // personal capacity and am not conveying any rights to any intellectual
5 // property of any third parties.
6 
7 #ifndef INCLUDE_JET_SURFACE_TO_IMPLICIT2_H_
8 #define INCLUDE_JET_SURFACE_TO_IMPLICIT2_H_
9 
10 #include <jet/implicit_surface2.h>
11 #include <memory>
12 
13 namespace jet {
14 
24 class SurfaceToImplicit2 final : public ImplicitSurface2 {
25  public:
26  class Builder;
27 
30  const Surface2Ptr& surface,
31  const Transform2& transform = Transform2(),
32  bool isNormalFlipped = false);
33 
36 
38  void updateQueryEngine() override;
39 
41  bool isBounded() const override;
42 
44  bool isValidGeometry() const override;
45 
48 
50  static Builder builder();
51 
52  protected:
53  Vector2D closestPointLocal(const Vector2D& otherPoint) const override;
54 
55  double closestDistanceLocal(const Vector2D& otherPoint) const override;
56 
57  bool intersectsLocal(const Ray2D& ray) const override;
58 
59  BoundingBox2D boundingBoxLocal() const override;
60 
62  const Vector2D& otherPoint) const override;
63 
64  double signedDistanceLocal(const Vector2D& otherPoint) const override;
65 
67  const Ray2D& ray) const override;
68 
69  bool isInsideLocal(const Vector2D& otherPoint) const override;
70 
71  private:
72  Surface2Ptr _surface;
73 };
74 
76 typedef std::shared_ptr<SurfaceToImplicit2> SurfaceToImplicit2Ptr;
77 
78 
83  : public SurfaceBuilderBase2<SurfaceToImplicit2::Builder> {
84  public:
87 
90 
93 
94  private:
95  Surface2Ptr _surface;
96 };
97 
98 } // namespace jet
99 
100 #endif // INCLUDE_JET_SURFACE_TO_IMPLICIT2_H_
jet::SurfaceToImplicit2::isInsideLocal
bool isInsideLocal(const Vector2D &otherPoint) const override
jet::SurfaceRayIntersection2
Struct that represents ray-surface intersection point.
Definition: surface2.h:19
jet::Surface2::isNormalFlipped
bool isNormalFlipped
Flips normal.
Definition: surface2.h:33
jet::SurfaceToImplicit2::Builder::withSurface
Builder & withSurface(const Surface2Ptr &surface)
Returns builder with surface.
jet::Transform2
Represents 2-D rigid body transform.
Definition: transform2.h:19
jet::SurfaceToImplicit2::Builder::makeShared
SurfaceToImplicit2Ptr makeShared() const
Builds shared pointer of SurfaceToImplicit2 instance.
jet::SurfaceToImplicit2::surface
Surface2Ptr surface() const
Returns the raw surface instance.
jet::SurfaceToImplicit2::signedDistanceLocal
double signedDistanceLocal(const Vector2D &otherPoint) const override
jet::SurfaceToImplicit2::SurfaceToImplicit2
SurfaceToImplicit2(const SurfaceToImplicit2 &other)
Copy constructor.
jet::Ray< T, 2 >
Class for 2-D ray.
Definition: ray2.h:21
jet::SurfaceToImplicit2::closestPointLocal
Vector2D closestPointLocal(const Vector2D &otherPoint) const override
jet::SurfaceToImplicit2::closestDistanceLocal
double closestDistanceLocal(const Vector2D &otherPoint) const override
jet::SurfaceToImplicit2::updateQueryEngine
void updateQueryEngine() override
Updates internal spatial query engine.
jet::SurfaceToImplicit2::closestNormalLocal
Vector2D closestNormalLocal(const Vector2D &otherPoint) const override
jet::SurfaceToImplicit2::Builder::build
SurfaceToImplicit2 build() const
Builds SurfaceToImplicit2.
jet::SurfaceToImplicit2::closestIntersectionLocal
SurfaceRayIntersection2 closestIntersectionLocal(const Ray2D &ray) const override
Returns the closest intersection point for given ray in local frame.
implicit_surface2.h
jet
Definition: advection_solver2.h:18
jet::Surface2::transform
Transform2 transform
Local-to-world transform.
Definition: surface2.h:30
jet::SurfaceToImplicit2
2-D implicit surface wrapper for generic Surface2 instance.
Definition: surface_to_implicit2.h:24
jet::Surface2Ptr
std::shared_ptr< Surface2 > Surface2Ptr
Shared pointer for the Surface2 type.
Definition: surface2.h:109
jet::SurfaceToImplicit2::boundingBoxLocal
BoundingBox2D boundingBoxLocal() const override
Returns the bounding box of this surface object in local frame.
jet::SurfaceToImplicit2::isBounded
bool isBounded() const override
Returns true if bounding box can be defined.
jet::Vector< T, 2 >
2-D vector class.
Definition: vector2.h:24
jet::SurfaceBuilderBase2
Base class for 2-D surface builder.
Definition: surface2.h:115
jet::SurfaceToImplicit2Ptr
std::shared_ptr< SurfaceToImplicit2 > SurfaceToImplicit2Ptr
Shared pointer for the SurfaceToImplicit2 type.
Definition: surface_to_implicit2.h:76
jet::SurfaceToImplicit2::builder
static Builder builder()
Returns builder fox SurfaceToImplicit2.
jet::BoundingBox< T, 2 >
2-D axis-aligned bounding box class.
Definition: bounding_box2.h:41
jet::SurfaceToImplicit2::SurfaceToImplicit2
SurfaceToImplicit2(const Surface2Ptr &surface, const Transform2 &transform=Transform2(), bool isNormalFlipped=false)
Constructs an instance with generic Surface2 instance.
jet::SurfaceToImplicit2::intersectsLocal
bool intersectsLocal(const Ray2D &ray) const override
jet::SurfaceToImplicit2::Builder
Front-end to create SurfaceToImplicit2 objects step by step.
Definition: surface_to_implicit2.h:83
jet::ImplicitSurface2
Abstract base class for 2-D implicit surface.
Definition: implicit_surface2.h:15
jet::SurfaceToImplicit2::isValidGeometry
bool isValidGeometry() const override
Returns true if the surface is a valid geometry.