blob: 7b61eccc8d0cd1ecec071bc4612f779d5bcb56ef (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/******************************************************************/
/* This file is part of the homework assignments for CSCI-427/527 */
/* at The College of William & Mary and authored by Pieter Peers. */
/* No part of this file, whether altered or in original form, can */
/* be distributed or used outside the context of CSCI-427/527 */
/* without consent of either the College of William & Mary or */
/* Pieter Peers. */
/******************************************************************/
#ifndef _TRANSFORMATION3D_H_
#define _TRANSFORMATION3D_H_
#include "vec3d.h"
#include "mat3d.h"
class transformation3d {
public:
//////////////////
// Constructors //
//////////////////
transformation3d(void);
transformation3d(const vec3d& translation, const mat3d& transformation, const mat3d& inverseTransform);
transformation3d(const transformation3d& t);
//////////////
// Operator //
//////////////
transformation3d& operator=(const transformation3d& t);
transformation3d operator*(const transformation3d& t) const;
transformation3d& operator*=(const transformation3d& t);
//////////////
// Mutators //
//////////////
transformation3d& invert(void);
/////////////
// Methods //
/////////////
vec3d transformPoint(const vec3d& p) const;
vec3d transformDirection(const vec3d& d) const;
vec3d transformNormal(const vec3d& n) const;
vec3d inverseTransformPoint(const vec3d& p) const;
vec3d inverseTransformDirection(const vec3d& d) const;
vec3d inverseTransformNormal(const vec3d& n) const;
/////////////
// Friends //
/////////////
friend void swap(transformation3d& a, transformation3d& b) { a._swap(b); }
friend transformation3d inverse(const transformation3d& t) { transformation3d i(t); return i.invert(); }
friend std::ostream& operator<<(std::ostream& s, const transformation3d& t)
{
t._print(s);
return s;
}
protected:
///////////////////////
// Protected Methods //
///////////////////////
void _swap(transformation3d& t);
void _assign(const transformation3d& t);
virtual void _print(std::ostream& s) const;
////////////////////////////
// Protected Data Members //
////////////////////////////
vec3d _translation;
mat3d _transformation;
mat3d _inverseTransformation;
};
#endif /* _TRANSFORMATION3D_H_ */
|