TORCS
1.3.10
The Open Racing Car Simulator
Loading...
Searching...
No Matches
Transform.h
Go to the documentation of this file.
1
/*
2
SOLID - Software Library for Interference Detection
3
Copyright (C) 1997-1998 Gino van den Bergen
4
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Library General Public
7
License as published by the Free Software Foundation; either
8
version 2 of the License, or (at your option) any later version.
9
10
This library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Library General Public License for more details.
14
15
You should have received a copy of the GNU Library General Public
16
License along with this library; if not, write to the Free
17
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19
Please send remarks, questions and bug reports to gino@win.tue.nl,
20
or write to:
21
Gino van den Bergen
22
Department of Mathematics and Computing Science
23
Eindhoven University of Technology
24
P.O. Box 513, 5600 MB Eindhoven, The Netherlands
25
*/
26
27
#ifndef _TRANSFORM_H_
28
#define _TRANSFORM_H_
29
30
#ifdef _MSC_VER
31
#pragma warning(disable:4786)
// identifier was truncated to '255'
32
#endif
// _MSC_VER
33
34
#ifdef _MSC_VER
35
#pragma warning(disable:4786)
// identifier was truncated to '255'
36
#endif
// _MSC_VER
37
38
#include <3D/Point.h>
39
#include <3D/Matrix.h>
40
41
class
Transform
{
42
public
:
43
Transform
() {}
44
Transform
(
const
float
m[16]) {
setValue
(m); }
45
Transform
(
const
double
m[16]) {
setValue
(m); }
46
47
Point
operator()
(
const
Point
&
p
)
const
{
48
return
Point
(
dot
(
basis
[
X
],
p
) +
origin
[
X
],
49
dot
(
basis
[
Y
],
p
) +
origin
[
Y
],
50
dot
(
basis
[
Z
],
p
) +
origin
[
Z
]);
51
}
52
53
const
Matrix
&
getBasis
()
const
{
return
basis
; }
54
const
Point
&
getOrigin
()
const
{
return
origin
; }
55
56
void
setValue
(
const
float
m[16]);
57
void
setValue
(
const
double
m[16]);
58
59
void
setIdentity
();
60
61
Transform
&
operator*=
(
const
Transform
& t);
62
63
void
translate
(
const
Vector
& v);
64
void
rotate
(
const
Quaternion
&
q
);
65
void
scale
(
Scalar
x,
Scalar
y
,
Scalar
z);
66
67
void
invert
(
const
Transform
& t);
68
void
mult
(
const
Transform
& t1,
const
Transform
& t2);
69
void
multInverseLeft
(
const
Transform
& t1,
const
Transform
& t2);
70
71
private
:
72
enum
{
73
IDENTITY
= 0x00,
74
TRANSLATION
= 0x01,
75
ROTATION
= 0x02,
76
SCALING
= 0x04,
77
LINEAR
=
ROTATION
|
SCALING
,
78
AFFINE
=
TRANSLATION
|
LINEAR
79
};
80
81
Matrix
basis
;
82
Point
origin
;
83
unsigned
int
type
;
84
};
85
86
#endif
Y
@ Y
Definition
Basic.h:58
X
@ X
Definition
Basic.h:58
Z
@ Z
Definition
Basic.h:58
Scalar
#define Scalar
Definition
Basic.h:34
q
static Point q[4]
Definition
Convex.cpp:55
p
static Point p[4]
Definition
Convex.cpp:54
y
static Vector y[4]
Definition
Convex.cpp:56
dot
Scalar dot(const Quaternion &q1, const Quaternion &q2)
Definition
Quaternion.h:163
Matrix
Definition
Matrix.h:37
Point
Definition
Point.h:34
Quaternion
Definition
Quaternion.h:33
Transform
Definition
Transform.h:41
Transform::type
unsigned int type
Definition
Transform.h:83
Transform::basis
Matrix basis
Definition
Transform.h:81
Transform::operator*=
Transform & operator*=(const Transform &t)
Definition
Transform.cpp:45
Transform::getOrigin
const Point & getOrigin() const
Definition
Transform.h:54
Transform::rotate
void rotate(const Quaternion &q)
Definition
Transform.cpp:57
Transform::Transform
Transform()
Definition
Transform.h:43
Transform::Transform
Transform(const double m[16])
Definition
Transform.h:45
Transform::invert
void invert(const Transform &t)
Definition
Transform.cpp:73
Transform::mult
void mult(const Transform &t1, const Transform &t2)
Definition
Transform.cpp:81
Transform::Transform
Transform(const float m[16])
Definition
Transform.h:44
Transform::translate
void translate(const Vector &v)
Definition
Transform.cpp:52
Transform::setIdentity
void setIdentity()
Definition
Transform.cpp:67
Transform::origin
Point origin
Definition
Transform.h:82
Transform::operator()
Point operator()(const Point &p) const
Definition
Transform.h:47
Transform::multInverseLeft
void multInverseLeft(const Transform &t1, const Transform &t2)
Definition
Transform.cpp:87
Transform::scale
void scale(Scalar x, Scalar y, Scalar z)
Definition
Transform.cpp:62
Transform::setValue
void setValue(const float m[16])
Definition
Transform.cpp:33
Transform::getBasis
const Matrix & getBasis() const
Definition
Transform.h:53
Transform::SCALING
@ SCALING
Definition
Transform.h:76
Transform::LINEAR
@ LINEAR
Definition
Transform.h:77
Transform::IDENTITY
@ IDENTITY
Definition
Transform.h:73
Transform::AFFINE
@ AFFINE
Definition
Transform.h:78
Transform::TRANSLATION
@ TRANSLATION
Definition
Transform.h:74
Transform::ROTATION
@ ROTATION
Definition
Transform.h:75
Vector
Definition
Vector.h:32
C:
Users
berni
Development
torcs_git
torcs-code
torcs
torcs
src
modules
simu
simuv2
SOLID-2.0
src
Transform.h
Generated by
1.14.0