TexGen
LinearTransformation.cpp
Go to the documentation of this file.
1/*=============================================================================
2TexGen: Geometric textile modeller.
3Copyright (C) 2006 Martin Sherburn
4
5This program is free software; you can redistribute it and/or
6modify it under the terms of the GNU General Public License
7as published by the Free Software Foundation; either version 2
8of the License, or (at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18=============================================================================*/
19
20#include "PrecompiledHeaders.h"
22
23using namespace TexGen;
24
25CLinearTransformation::CLinearTransformation(void)
26{
28}
29
31{
32 if (Matrix.GetWidth() == 3 && Matrix.GetHeight() == 3)
33 {
34 *((CMatrix*)this) = Matrix;
35 }
36 else
37 {
38 TGERROR("Tried to initialise a linear transformation with a matrix of size: " << Matrix.GetWidth() << "x" << Matrix.GetHeight());
40 }
41}
42
44{
45}
46
48{
49 Identity();
50}
51
53{
54 *this = Deformation * *this;
55}
56
57void CLinearTransformation::AddScale(double dXScale, double dYScale, double dZScale)
58{
59 CMatrix Deform;
60 Deform.InitialiseIdentity(3);
61 Deform(0, 0) = dXScale;
62 Deform(1, 1) = dYScale;
63 Deform(2, 2) = dZScale;
65}
66
67/*
68void CLinearTransformation::AddShearX(double dYbydX, double dZbydX)
69{
70 CMatrix Deform;
71 Deform.InitialiseIdentity(3);
72 Deform(1, 0) = dYbydX;
73 Deform(2, 0) = dZbydX;
74 AddDeformation(Deform);
75}
76
77void CLinearTransformation::AddShearY(double dXbydY, double dZbydY)
78{
79 CMatrix Deform;
80 Deform.InitialiseIdentity(3);
81 Deform(0, 1) = dXbydY;
82 Deform(2, 1) = dZbydY;
83 AddDeformation(Deform);
84}
85
86void CLinearTransformation::AddShearZ(double dXbydZ, double dYbydZ)
87{
88 CMatrix Deform;
89 Deform.InitialiseIdentity(3);
90 Deform(0, 2) = dXbydZ;
91 Deform(1, 2) = dYbydZ;
92 AddDeformation(Deform);
93}
94*/
96{
98}
99
100
101
102
103
104
105
106
107
108
#define TGERROR(MESSAGE)
Macros used to report the file name and line number to the TexGenError and TexGenLog functions.
Definition: Logger.h:29
void AddScale(double dXScale=1, double dYScale=1, double dZScale=1)
void MultiplyTransformation(const CMatrix &Deformation)
Class to represent a matrix and perform various operations on it.
Definition: Matrix.h:33
void Identity()
Definition: Matrix.h:527
int GetHeight() const
Definition: Matrix.h:176
void InitialiseIdentity(int iSize)
Definition: Matrix.h:155
int GetWidth() const
Definition: Matrix.h:181
Namespace containing a series of customised math operations not found in the standard c++ library.
CMatrix ConvertRotation(WXYZ Q)
Definition: MatrixUtils.h:30
Struct for representing a quaternion.
Definition: mymath.h:38