Jet  v1.3.3
plane3.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_PLANE3_H_
8 #define INCLUDE_JET_PLANE3_H_
9 
10 #include <jet/surface3.h>
11 
12 namespace jet {
13 
20 class Plane3 final : public Surface3 {
21  public:
22  class Builder;
23 
25  Vector3D normal = Vector3D(0, 1, 0);
26 
29 
32  const Transform3& transform = Transform3(),
33  bool isNormalFlipped = false);
34 
37  const Vector3D& normal,
38  const Vector3D& point,
39  const Transform3& transform = Transform3(),
40  bool isNormalFlipped = false);
41 
45  const Vector3D& point0,
46  const Vector3D& point1,
47  const Vector3D& point2,
48  const Transform3& transform = Transform3(),
49  bool isNormalFlipped = false);
50 
52  Plane3(const Plane3& other);
53 
55  bool isBounded() const override;
56 
58  static Builder builder();
59 
60  protected:
61  Vector3D closestPointLocal(const Vector3D& otherPoint) const override;
62 
63  bool intersectsLocal(const Ray3D& ray) const override;
64 
65  BoundingBox3D boundingBoxLocal() const override;
66 
67  Vector3D closestNormalLocal(const Vector3D& otherPoint) const override;
68 
70  const Ray3D& ray) const override;
71 };
72 
74 typedef std::shared_ptr<Plane3> Plane3Ptr;
75 
76 
80 class Plane3::Builder final : public SurfaceBuilderBase3<Plane3::Builder> {
81  public:
84 
87 
89  Plane3 build() const;
90 
93 
94  private:
95  Vector3D _normal{0, 1, 0};
96  Vector3D _point{0, 0, 0};
97 };
98 
99 } // namespace jet
100 
101 #endif // INCLUDE_JET_PLANE3_H_
jet::Plane3::builder
static Builder builder()
Returns builder fox Plane3.
jet::Plane3::intersectsLocal
bool intersectsLocal(const Ray3D &ray) const override
jet::Plane3
3-D plane geometry.
Definition: plane3.h:20
jet::Plane3::normal
Vector3D normal
Plane normal.
Definition: plane3.h:25
jet::Plane3::Plane3
Plane3(const Vector3D &point0, const Vector3D &point1, const Vector3D &point2, const Transform3 &transform=Transform3(), bool isNormalFlipped=false)
jet::Plane3::Builder::build
Plane3 build() const
Builds Plane3.
jet::Plane3::closestNormalLocal
Vector3D closestNormalLocal(const Vector3D &otherPoint) const override
surface3.h
jet::BoundingBox< T, 3 >
3-D axis-aligned bounding box class.
Definition: bounding_box3.h:41
jet::Plane3::Builder::makeShared
Plane3Ptr makeShared() const
Builds shared pointer of Plane3 instance.
jet::Plane3::Plane3
Plane3(const Vector3D &normal, const Vector3D &point, const Transform3 &transform=Transform3(), bool isNormalFlipped=false)
Constructs a plane that cross point with surface normal normal.
jet::Plane3Ptr
std::shared_ptr< Plane3 > Plane3Ptr
Shared pointer for the Plane3 type.
Definition: plane3.h:74
jet::Plane3::Plane3
Plane3(const Plane3 &other)
Copy constructor.
jet::Plane3::boundingBoxLocal
BoundingBox3D boundingBoxLocal() const override
Returns the bounding box of this surface object in local frame.
jet::Plane3::closestPointLocal
Vector3D closestPointLocal(const Vector3D &otherPoint) const override
jet::Plane3::Builder::withNormal
Builder & withNormal(const Vector3D &normal)
Returns builder with plane normal.
jet::SurfaceBuilderBase3
Base class for 3-D surface builder.
Definition: surface3.h:115
jet::Surface3::isNormalFlipped
bool isNormalFlipped
Flips normal when calling Surface3::closestNormal(...).
Definition: surface3.h:33
jet
Definition: advection_solver2.h:18
jet::Plane3::Plane3
Plane3(const Transform3 &transform=Transform3(), bool isNormalFlipped=false)
Constructs a plane that crosses (0, 0, 0) with surface normal (0, 1, 0).
jet::Plane3::Builder
Front-end to create Plane3 objects step by step.
Definition: plane3.h:80
jet::Plane3::isBounded
bool isBounded() const override
Returns true if bounding box can be defined.
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::SurfaceRayIntersection3
Struct that represents ray-surface intersection point.
Definition: surface3.h:19
jet::Vector3D
Vector3< double > Vector3D
Double-type 3D vector.
Definition: vector3.h:349
jet::Vector< T, 3 >
3-D vector class.
Definition: vector3.h:25
jet::Transform3
Represents 3-D rigid body transform.
Definition: transform3.h:20
jet::Surface3
Abstract base class for 3-D surface.
Definition: surface3.h:27
jet::Plane3::Builder::withPoint
Builder & withPoint(const Vector3D &point)
Returns builder with point on the plane.
jet::Plane3::point
Vector3D point
Point that lies on the plane.
Definition: plane3.h:28
jet::Plane3::closestIntersectionLocal
SurfaceRayIntersection3 closestIntersectionLocal(const Ray3D &ray) const override
Returns the closest intersection point for given ray in local frame.