Transform3.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: Transform3.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: Represents 3-D rigid body transform.
6 > Created Time: 2017/03/29
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_TRANSFORM3_H
10 #define CUBBYFLOW_TRANSFORM3_H
11 
13 #include <Core/Math/Quaternion.h>
14 #include <Core/Ray/Ray3.h>
15 #include <Core/Vector/Vector3.h>
16 
17 namespace CubbyFlow
18 {
22  class Transform3
23  {
24  public:
26  Transform3();
27 
29  Transform3(const Vector3D& translation, const QuaternionD& orientation);
30 
32  const Vector3D& GetTranslation() const;
33 
35  void SetTranslation(const Vector3D& translation);
36 
38  const QuaternionD& GetOrientation() const;
39 
41  void SetOrientation(const QuaternionD& orientation);
42 
44  Vector3D ToLocal(const Vector3D& pointInWorld) const;
45 
47  Vector3D ToLocalDirection(const Vector3D& dirInWorld) const;
48 
50  Ray3D ToLocal(const Ray3D& rayInWorld) const;
51 
53  BoundingBox3D ToLocal(const BoundingBox3D& bboxInWorld) const;
54 
56  Vector3D ToWorld(const Vector3D& pointInLocal) const;
57 
59  Vector3D ToWorldDirection(const Vector3D& dirInLocal) const;
60 
62  Ray3D ToWorld(const Ray3D& rayInLocal) const;
63 
65  BoundingBox3D ToWorld(const BoundingBox3D& bboxInLocal) const;
66 
67  private:
68  Vector3D m_translation;
69  QuaternionD m_orientation;
70  Matrix3x3D m_orientationMat3;
71  Matrix3x3D m_inverseOrientationMat3;
72  };
73 }
74 
75 #endif
3-D vector class.
Definition: Vector3.h:26
Vector3D ToLocal(const Vector3D &pointInWorld) const
Transforms a point in world coordinate to the local frame.
Vector3D ToLocalDirection(const Vector3D &dirInWorld) const
Transforms a direction in world coordinate to the local frame.
Transform3()
Constructs identity transform.
const Vector3D & GetTranslation() const
Returns the translation.
Vector3D ToWorldDirection(const Vector3D &dirInLocal) const
Transforms a direction in local space to the world coordinate.
Vector3D ToWorld(const Vector3D &pointInLocal) const
Transforms a point in local space to the world coordinate.
Definition: pybind11Utils.h:24
3-D matrix class.
Definition: Matrix3x3.h:30
3-D axis-aligned bounding box class.
Definition: BoundingBox3.h:44
Represents 3-D rigid body transform.
Definition: Transform3.h:22
const QuaternionD & GetOrientation() const
Returns the orientation.
void SetTranslation(const Vector3D &translation)
Sets the traslation.
Class for 3-D ray.
Definition: Ray3.h:23
void SetOrientation(const QuaternionD &orientation)
Sets the orientation.