Jet  v1.3.3
transform2.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_TRANSFORM2_H_
8 #define INCLUDE_JET_TRANSFORM2_H_
9 
10 #include <jet/bounding_box2.h>
11 #include <jet/ray2.h>
12 #include <jet/vector2.h>
13 
14 namespace jet {
15 
19 class Transform2 {
20  public:
23 
26 
28  const Vector2D& translation() const;
29 
32 
34  double orientation() const;
35 
38 
40  Vector2D toLocal(const Vector2D& pointInWorld) const;
41 
43  Vector2D toLocalDirection(const Vector2D& dirInWorld) const;
44 
46  Ray2D toLocal(const Ray2D& rayInWorld) const;
47 
49  BoundingBox2D toLocal(const BoundingBox2D& bboxInWorld) const;
50 
52  Vector2D toWorld(const Vector2D& pointInLocal) const;
53 
55  Vector2D toWorldDirection(const Vector2D& dirInLocal) const;
56 
58  Ray2D toWorld(const Ray2D& rayInLocal) const;
59 
61  BoundingBox2D toWorld(const BoundingBox2D& bboxInLocal) const;
62 
63  private:
64  Vector2D _translation;
65  double _orientation = 0.0;
66  double _cosAngle = 1.0;
67  double _sinAngle = 0.0;
68 };
69 
70 } // namespace jet
71 
72 #include "detail/transform2-inl.h"
73 
74 #endif // INCLUDE_JET_TRANSFORM2_H_
jet::Transform2::toWorld
Vector2D toWorld(const Vector2D &pointInLocal) const
Transforms a point in local space to the world coordinate.
jet::Transform2
Represents 2-D rigid body transform.
Definition: transform2.h:19
jet::Transform2::toWorldDirection
Vector2D toWorldDirection(const Vector2D &dirInLocal) const
Transforms a direction in local space to the world coordinate.
jet::Transform2::translation
const Vector2D & translation() const
Returns the translation.
jet::Ray< T, 2 >
Class for 2-D ray.
Definition: ray2.h:21
jet::Transform2::setTranslation
void setTranslation(const Vector2D &translation)
Sets the traslation.
jet::Transform2::toWorld
BoundingBox2D toWorld(const BoundingBox2D &bboxInLocal) const
Transforms a bounding box in local space to the world coordinate.
jet::Transform2::toLocal
BoundingBox2D toLocal(const BoundingBox2D &bboxInWorld) const
Transforms a bounding box in world coordinate to the local frame.
jet::Transform2::toLocal
Ray2D toLocal(const Ray2D &rayInWorld) const
Transforms a ray in world coordinate to the local frame.
jet
Definition: advection_solver2.h:18
vector2.h
ray2.h
jet::Transform2::toLocalDirection
Vector2D toLocalDirection(const Vector2D &dirInWorld) const
Transforms a direction in world coordinate to the local frame.
jet::Transform2::Transform2
Transform2(const Vector2D &translation, double orientation)
Constructs a transform with translation and orientation.
jet::Transform2::Transform2
Transform2()
Constructs identity transform.
jet::Vector< T, 2 >
2-D vector class.
Definition: vector2.h:24
jet::Transform2::toLocal
Vector2D toLocal(const Vector2D &pointInWorld) const
Transforms a point in world coordinate to the local frame.
jet::Transform2::setOrientation
void setOrientation(double orientation)
Sets the orientation in radians.
jet::Transform2::orientation
double orientation() const
Returns the orientation in radians.
bounding_box2.h
jet::BoundingBox< T, 2 >
2-D axis-aligned bounding box class.
Definition: bounding_box2.h:41
jet::Transform2::toWorld
Ray2D toWorld(const Ray2D &rayInLocal) const
Transforms a ray in local space to the world coordinate.