Jet  v1.3.3
implicit_triangle_mesh3.h
Go to the documentation of this file.
1 // Copyright (c) 2018 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_IMPLICIT_TRIANGLE_MESH3_H_
8 #define INCLUDE_JET_IMPLICIT_TRIANGLE_MESH3_H_
9 
11 #include <jet/implicit_surface3.h>
12 #include <jet/triangle_mesh3.h>
14 
15 namespace jet {
16 
27  public:
28  class Builder;
29 
31  ImplicitTriangleMesh3(const TriangleMesh3Ptr& mesh, size_t resolutionX = 32,
32  double margin = 0.2,
33  const Transform3& transform = Transform3(),
34  bool isNormalFlipped = false);
35 
37 
39  static Builder builder();
40 
43 
44  private:
45  TriangleMesh3Ptr _mesh;
47  CustomImplicitSurface3Ptr _customImplicitSurface;
48 
49  Vector3D closestPointLocal(const Vector3D& otherPoint) const override;
50 
51  double closestDistanceLocal(const Vector3D& otherPoint) const override;
52 
53  bool intersectsLocal(const Ray3D& ray) const override;
54 
55  BoundingBox3D boundingBoxLocal() const override;
56 
57  Vector3D closestNormalLocal(const Vector3D& otherPoint) const override;
58 
59  double signedDistanceLocal(const Vector3D& otherPoint) const override;
60 
61  SurfaceRayIntersection3 closestIntersectionLocal(
62  const Ray3D& ray) const override;
63 };
64 
66 typedef std::shared_ptr<ImplicitTriangleMesh3> ImplicitTriangleMesh3Ptr;
67 
72  : public SurfaceBuilderBase3<ImplicitTriangleMesh3::Builder> {
73  public:
76 
78  Builder& withResolutionX(size_t resolutionX);
79 
81  Builder& withMargin(double margin);
82 
85 
88 
89  private:
90  TriangleMesh3Ptr _mesh;
91  size_t _resolutionX = 32;
92  double _margin = 0.2;
93 };
94 
95 } // namespace jet
96 
97 #endif // INCLUDE_JET_IMPLICIT_TRIANGLE_MESH3_H_
jet::ImplicitTriangleMesh3
TriangleMesh3 to ImplicitSurface3 converter.
Definition: implicit_triangle_mesh3.h:26
jet::ImplicitTriangleMesh3::Builder
Front-end to create ImplicitTriangleMesh3 objects step by step.
Definition: implicit_triangle_mesh3.h:72
jet::VertexCenteredScalarGrid3Ptr
std::shared_ptr< VertexCenteredScalarGrid3 > VertexCenteredScalarGrid3Ptr
Shared pointer for the VertexCenteredScalarGrid3 type.
Definition: vertex_centered_scalar_grid3.h:89
jet::ImplicitTriangleMesh3::Builder::withResolutionX
Builder & withResolutionX(size_t resolutionX)
Returns builder with resolution in x axis.
jet::ImplicitTriangleMesh3Ptr
std::shared_ptr< ImplicitTriangleMesh3 > ImplicitTriangleMesh3Ptr
Shared pointer for the ImplicitTriangleMesh3 type.
Definition: implicit_triangle_mesh3.h:66
jet::ImplicitTriangleMesh3::builder
static Builder builder()
Returns builder fox ImplicitTriangleMesh3.
jet::BoundingBox< T, 3 >
3-D axis-aligned bounding box class.
Definition: bounding_box3.h:41
jet::ImplicitSurface3
Abstract base class for 3-D implicit surface.
Definition: implicit_surface3.h:15
jet::ImplicitTriangleMesh3::~ImplicitTriangleMesh3
virtual ~ImplicitTriangleMesh3()
jet::ImplicitTriangleMesh3::Builder::withTriangleMesh
Builder & withTriangleMesh(const TriangleMesh3Ptr &mesh)
Returns builder with triangle mesh.
jet::SurfaceBuilderBase3
Base class for 3-D surface builder.
Definition: surface3.h:115
jet::ImplicitTriangleMesh3::Builder::withMargin
Builder & withMargin(double margin)
Returns builder with margin around the mesh.
jet::ImplicitTriangleMesh3::Builder::makeShared
ImplicitTriangleMesh3Ptr makeShared() const
Builds shared pointer of ImplicitTriangleMesh3 instance.
jet::Surface3::isNormalFlipped
bool isNormalFlipped
Flips normal when calling Surface3::closestNormal(...).
Definition: surface3.h:33
jet
Definition: advection_solver2.h:18
jet::ImplicitTriangleMesh3::ImplicitTriangleMesh3
ImplicitTriangleMesh3(const TriangleMesh3Ptr &mesh, size_t resolutionX=32, double margin=0.2, const Transform3 &transform=Transform3(), bool isNormalFlipped=false)
Constructs an ImplicitSurface3 with mesh and other grid parameters.
custom_implicit_surface3.h
triangle_mesh3.h
jet::ImplicitTriangleMesh3::Builder::build
ImplicitTriangleMesh3 build() const
Builds ImplicitTriangleMesh3.
jet::Surface3::transform
Transform3 transform
Local-to-world transform.
Definition: surface3.h:30
jet::Ray< T, 3 >
Class for 2-D ray.
Definition: ray3.h:21
jet::ImplicitTriangleMesh3::grid
const VertexCenteredScalarGrid3Ptr & grid() const
Returns grid data.
jet::SurfaceRayIntersection3
Struct that represents ray-surface intersection point.
Definition: surface3.h:19
implicit_surface3.h
jet::Vector< T, 3 >
3-D vector class.
Definition: vector3.h:25
jet::TriangleMesh3Ptr
std::shared_ptr< TriangleMesh3 > TriangleMesh3Ptr
Shared pointer for the TriangleMesh3 type.
Definition: triangle_mesh3.h:245
jet::Transform3
Represents 3-D rigid body transform.
Definition: transform3.h:20
vertex_centered_scalar_grid3.h
jet::CustomImplicitSurface3Ptr
std::shared_ptr< CustomImplicitSurface3 > CustomImplicitSurface3Ptr
Shared pointer type for the CustomImplicitSurface3.
Definition: custom_implicit_surface3.h:69