Ray Tracer  2020
Transform.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifndef RT_TRANSFORM_H_INCLUDED
4 #define RT_TRANSFORM_H_INCLUDED
5 
6 #include "Direction.h"
7 #include "Matrix.h"
8 #include "Normal.h"
9 #include "Point.h"
10 #include "Ray.h"
11 
29 class Transform {
30 
31 public:
32 
37  Transform();
38 
45  Transform(const Transform& transform);
46 
48  ~Transform();
49 
55  Transform& operator=(const Transform& transform);
56 
65  Point apply(const Point& point) const;
66 
76  Direction apply(const Direction& direction) const;
77 
91  Normal apply(const Normal& normal) const;
92 
100  Ray apply(const Ray& ray) const;
101 
108  Point applyInverse(const Point& point) const;
109 
116  Direction applyInverse(const Direction& direction) const;
117 
124  Normal applyInverse(const Normal& normal) const;
125 
132  Ray applyInverse(const Ray& ray) const;
133 
142  void rotateX(double rx);
143 
152  void rotateY(double ry);
153 
162  void rotateZ(double rz);
163 
173  void scale(double s);
174 
186  void scale(double sx, double sy, double sz);
187 
196  void translate(double tx, double ty, double tz);
197 
202  void translate(const Direction& direction);
203 
204 private:
205 
208 
209 };
210 
211 #endif
Direction class header file.
Matrix class header file.
Direction class header file.
Point class header file.
Ray class header file.
Class for Direction Vectors.
Definition: Direction.h:22
Basic class for matrices.
Definition: Matrix.h:22
Class for Normal Vectors.
Definition: Normal.h:24
Class for Point Vectors.
Definition: Point.h:22
Rays as a starting Point and Direction.
Definition: Ray.h:20
Class for Transform objects.
Definition: Transform.h:29
void translate(double tx, double ty, double tz)
Shift along the X-, Y-, and Z-axes.
Definition: Transform.cpp:189
void scale(double s)
Apply a uniform scaling in all directions.
Definition: Transform.cpp:161
Point applyInverse(const Point &point) const
Apply an inverse transformation to a Point.
Definition: Transform.cpp:76
Matrix Tinv_
The 4x4 inverse transformation matrix.
Definition: Transform.h:207
Point apply(const Point &point) const
Apply a transformation to a Point.
Definition: Transform.cpp:27
Transform()
Default Transform constructor.
Definition: Transform.cpp:4
void rotateY(double ry)
Apply a rotation about the Y-axis.
Definition: Transform.cpp:137
~Transform()
Transform destructor.
Definition: Transform.cpp:14
Matrix T_
The 4x4 homogeneous transformation matrix.
Definition: Transform.h:206
void rotateX(double rx)
Apply a rotation about the X-axis.
Definition: Transform.cpp:125
void rotateZ(double rz)
Apply a rotation about the Z-axis.
Definition: Transform.cpp:149
Transform & operator=(const Transform &transform)
Transform assignment operator.
Definition: Transform.cpp:18