#include <trans2d.h>
Inheritance diagram for Trans2DMatrix:
Public Member Functions | |
Trans2DMatrix () | |
Builds a 2D Tranform object of the identiry matrix (ie it has no effect). | |
Trans2DMatrix (DocCoord CentreOfRot, ANGLE RotateBy) | |
Creates a 2D Matrix transform object that will perform a rotation about the given point by the given number of degrees. | |
Trans2DMatrix (INT32 TransX, INT32 TransY) | |
Builds a 2D Tranform object that will perform a translation by an offset Transx, TransY. | |
Trans2DMatrix (const Matrix &NewMatrix) | |
constructor | |
Trans2DMatrix (const Trans2DMatrix &) | |
Copy constructor. | |
void | InitDecomposedTransforms () |
ensure all member vars are init'ed | |
void | SetTransform () |
void | SetTransform (DocCoord CentreOfRot, ANGLE RotateBy) |
void | SetTransform (INT32 TransX, INT32 TransY) |
void | SetTransform (const Matrix &NewMatrix) |
void | SetTransform (const Trans2DMatrix &) |
virtual void | Transform (DocCoord *Coords, INT32 NumPoints) |
Transform the coordinates in the array using the matrix in the transform object. | |
virtual BOOL | IsInvertable () |
To see if this transform is really invertable. | |
virtual void | Invert () |
Inverts the transformation matrix held by this transform object. future calls to the transform() member function will cause it to transform coordinates back to their original positions. ie, call Transform(), call Invert() and call Transform() again should give you the same set of coords as you started with. | |
virtual BOOL | IsTranslation () |
Determine whether the transformation is a simple translation. | |
INT32 | GetWorkingQuadrant () |
To find out which quadrant the current matrix is working in. OR To help find out if the matrix is flipping an object and in which way. | |
Trans2DMatrix & | operator *= (const Trans2DMatrix &) |
Overloads the *= operator for Trans2DMatrix. | |
Trans2DMatrix & | operator= (const Trans2DMatrix &) |
Overloads the = operator for Trans2DMatrix. | |
Matrix | GetMatrix () |
Matrix * | GetpMatrix () |
void | EnsureDecomposedTransformsCached () |
ensures the decomposed transforms are cached | |
FIXED16 | GetScale () |
get the transform's scale component | |
FIXED16 | GetAspect () |
get the transform's Aspect component | |
ANGLE | GetRotation () |
get the transform's Rotation component | |
ANGLE | GetSkew () |
get the transform's Skew component | |
DocCoord | GetTranslation () |
get the transform's Translation component | |
virtual FIXED16 | GetScalar () |
get the transform's directionless scale component (used for scaling line widths, bevel widths, brush widths, etc.) For compatibility reasons this is defined to be the Y scale factor of the matrix! | |
Protected Attributes | |
Matrix | TransMatrix |
FIXED16 | Scale |
FIXED16 | Aspect |
ANGLE | Rotation |
ANGLE | Skew |
DocCoord | Translation |
FIXED16 | ScaleY |
Private Member Functions | |
CC_DECLARE_DYNAMIC (Trans2DMatrix) |
Definition at line 126 of file trans2d.h.
|
Builds a 2D Tranform object of the identiry matrix (ie it has no effect).
Definition at line 140 of file trans2d.cpp. 00141 { 00142 SetTransform(); 00143 }
|
|
Creates a 2D Matrix transform object that will perform a rotation about the given point by the given number of degrees.
Definition at line 170 of file trans2d.cpp. 00171 { 00172 SetTransform(CentreOfRot,RotateBy); 00173 }
|
|
Builds a 2D Tranform object that will perform a translation by an offset Transx, TransY.
Definition at line 209 of file trans2d.cpp. 00210 { 00211 SetTransform(TransX,TransY); 00212 }
|
|
constructor
Definition at line 238 of file trans2d.cpp. 00239 { 00240 SetTransform(NewMatrix); 00241 }
|
|
Copy constructor.
Definition at line 267 of file trans2d.cpp. 00268 { 00269 SetTransform(Other); 00270 }
|
|
|
|
ensures the decomposed transforms are cached
Definition at line 452 of file trans2d.cpp. 00453 { 00454 if (Scale==0) 00455 { 00456 GetpMatrix()->Decompose(&Scale, &Aspect, &Rotation, &Skew, &Translation, &ScaleY); 00457 Rotation = (Rotation*180)/PI; 00458 Skew = (Skew *180)/PI; // convert to degrees!? 00459 } 00460 }
|
|
get the transform's Aspect component
Definition at line 486 of file trans2d.cpp. 00487 { 00488 EnsureDecomposedTransformsCached(); 00489 return Aspect; 00490 }
|
|
Definition at line 158 of file trans2d.h. 00158 { return TransMatrix; }
|
|
Definition at line 159 of file trans2d.h. 00159 { return &TransMatrix; }
|
|
get the transform's Rotation component
Definition at line 501 of file trans2d.cpp. 00502 { 00503 EnsureDecomposedTransformsCached(); 00504 return Rotation; 00505 }
|
|
get the transform's directionless scale component (used for scaling line widths, bevel widths, brush widths, etc.) For compatibility reasons this is defined to be the Y scale factor of the matrix!
Reimplemented from TransformBase. Definition at line 550 of file trans2d.cpp. 00551 { 00552 EnsureDecomposedTransformsCached(); 00553 return ScaleY; 00554 }
|
|
get the transform's scale component
Definition at line 471 of file trans2d.cpp. 00472 { 00473 EnsureDecomposedTransformsCached(); 00474 return Scale; 00475 }
|
|
get the transform's Skew component
Definition at line 516 of file trans2d.cpp. 00517 { 00518 EnsureDecomposedTransformsCached(); 00519 return Skew; 00520 }
|
|
get the transform's Translation component
Definition at line 531 of file trans2d.cpp. 00532 { 00533 EnsureDecomposedTransformsCached(); 00534 return Translation; 00535 }
|
|
To find out which quadrant the current matrix is working in. OR To help find out if the matrix is flipping an object and in which way.
Quadrant 1: A > 0 && D > 0 Quadrant 2: A < 0 && D > 0 Quadrant 4: A > 0 && D < 0 Quadrant 3: A < 0 && D < 0 The return value is the quadrant in which the matrix is working in. Definition at line 360 of file trans2d.cpp. 00361 { 00362 FIXED16 ZERO = 0; 00363 FIXED16 ABCD[4]; 00364 INT32 XY[2]; 00365 00366 TransMatrix.GetComponents(&ABCD[0],&XY[0]); 00367 00368 if(ABCD[3] >= ZERO) 00369 { 00370 // either 1 or 2 00371 if(ABCD[0] >= ZERO) 00372 return 1; 00373 else 00374 return 2; 00375 } 00376 else 00377 { 00378 // either 3 or 4 00379 if(ABCD[0] >= ZERO) 00380 return 4; 00381 else 00382 return 3; 00383 } 00384 00385 return 1; 00386 }
|
|
ensure all member vars are init'ed
Definition at line 122 of file trans2d.cpp. 00123 { 00124 Scale = 0; // 0 indicates cached values invalid 00125 Aspect = 1; 00126 Rotation = 0; 00127 Skew = 0; 00128 Translation = DocCoord(0,0); 00129 }
|
|
Inverts the transformation matrix held by this transform object. future calls to the transform() member function will cause it to transform coordinates back to their original positions. ie, call Transform(), call Invert() and call Transform() again should give you the same set of coords as you started with.
Implements TransInvertable. Definition at line 316 of file trans2d.cpp. 00317 { 00318 // Invert the transformation matrix 00319 TransMatrix = TransMatrix.Inverse(); 00320 00321 InitDecomposedTransforms(); 00322 }
|
|
To see if this transform is really invertable.
Reimplemented from TransInvertable. Definition at line 568 of file trans2d.cpp. 00569 { 00570 if (TransMatrix.Type == TRANS_IDENTITY) 00571 return TRUE; 00572 00573 // The inverse has failed if we get an identity matrix 00574 Matrix Inversed = TransMatrix.Inverse(); 00575 00576 return (Inversed.Type != TRANS_IDENTITY); 00577 }
|
|
Determine whether the transformation is a simple translation.
Reimplemented from TransformBase. Definition at line 333 of file trans2d.cpp. 00334 { 00335 return TransMatrix.IsTranslation(); 00336 }
|
|
Overloads the *= operator for Trans2DMatrix.
Definition at line 407 of file trans2d.cpp. 00408 { 00409 TransMatrix*=op.TransMatrix; 00410 InitDecomposedTransforms(); 00411 return *this; 00412 }
|
|
Overloads the = operator for Trans2DMatrix.
Definition at line 430 of file trans2d.cpp. 00431 { 00432 TransMatrix = rhs.TransMatrix; 00433 00434 //Graham 12/8/96: Added these because, well, you need them 00435 //Fixes bug 4938 00436 TransLines = rhs.TransLines; 00437 TransFills = rhs.TransFills; 00438 00439 InitDecomposedTransforms(); 00440 return *this; 00441 }
|
|
Definition at line 272 of file trans2d.cpp. 00273 { 00274 // Copy all the elements from the other trans2dmatrix to this new one. 00275 TransMatrix = Other.TransMatrix; 00276 TransLines = Other.TransLines; 00277 TransFills = Other.TransFills; 00278 InitDecomposedTransforms(); 00279 }
|
|
Definition at line 243 of file trans2d.cpp. 00244 { 00245 // Take a copy of the matrix 00246 TransMatrix = NewMatrix; 00247 00248 // Set the flags 00249 TransLines = FALSE; 00250 TransFills = TRUE; 00251 InitDecomposedTransforms(); 00252 }
|
|
Definition at line 214 of file trans2d.cpp. 00215 { 00216 // Build the translation matrix 00217 TransMatrix = Matrix(TransX, TransY); 00218 00219 // Set the flags 00220 TransLines = FALSE; 00221 TransFills = TRUE; 00222 InitDecomposedTransforms(); 00223 }
|
|
Definition at line 175 of file trans2d.cpp. 00176 { 00177 // Build the matricies we need 00178 Matrix RotateIt(RotateBy); 00179 Matrix TransFromOrigin( CentreOfRot.x, CentreOfRot.y ); 00180 00181 // need to translate the centre of rotation to the origin 00182 TransMatrix = Matrix( -CentreOfRot.x, -CentreOfRot.y ); 00183 00184 // rotate about the origin 00185 TransMatrix *= RotateIt; 00186 00187 // translate back to the centre of rotation 00188 TransMatrix *= TransFromOrigin; 00189 00190 // Set the flags 00191 TransLines = FALSE; 00192 TransFills = TRUE; 00193 InitDecomposedTransforms(); 00194 }
|
|
Definition at line 145 of file trans2d.cpp. 00146 { 00147 // Build the translation matrix 00148 TransMatrix = Matrix(); 00149 00150 // Set the flags 00151 TransLines = FALSE; 00152 TransFills = TRUE; 00153 InitDecomposedTransforms(); 00154 }
|
|
Transform the coordinates in the array using the matrix in the transform object.
Implements TransformBase. Definition at line 295 of file trans2d.cpp. 00296 { 00297 // Get the matrix to transform all the coords passed in 00298 TransMatrix.transform( (Coord*)Coords, NumCoords ); 00299 InitDecomposedTransforms(); 00300 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|