You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.6 KiB
C

1 month ago
//////////////////////////////////////////////////////////////////////////////
//<2F>ļ<EFBFBD> Matrix2D.h
//<2F><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>:
//
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д: 2005-12-07
/////////////////////////////////////////////////////////////////////////////
#pragma once
//For any coordinates (x, y) in world space, the transformed coordinates in page
//space (x', y') can be determined by the following algorithm:
//x' = x * eM11 + y * eM21 + eDx,
//y' = x * eM12 + y * eM22 + eDy,
//where the transformation matrix is represented by the following:
// | eM11 eM12 | | 1 0 | | m[0] m[1] |
//Matrix = | eM21 eM22 | = | 0 1 | = | m[2] m[3] |
// | eDx eDy | | 0 0 | | m[4] m[5] |
class CMatrix2D
{
public:
CMatrix2D(void);
virtual ~CMatrix2D(void);
bool IsIdentity(void);
void Reset(void); // set identity matrix elements
void SetMatrix(double m11, double m12, double m21, double m22, double dx, double dy);
void SetMatrix(double *pm); //6<><36>
void RotateAt(double centerX, double centerY, double angle);
void Rotate(double angle);
void Translate(double dx, double dy); //ƽ<>Ʊ任
void Shear(double shearX, double shearY); //<2F><><EFBFBD>б
void Scale(double scaleX, double scaleY); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double Determinant();
CMatrix2D Invert(bool *invertible);
void operator=(const CMatrix2D& md);
void operator*=(const CMatrix2D& md);
void Exchange(double& x, double& y, BOOL bUndo=FALSE); //<2F><>bUndo=TRUEʱ<45><CAB1><EFBFBD>з<EFBFBD><D0B7>
void Exchange(long& x, long& y, BOOL bUndo=FALSE); //<2F><>bUndo=TRUEʱ<45><CAB1><EFBFBD>з<EFBFBD><D0B7>
BOOL GetElements(double* pele);
BOOL GetElements(float* pele);
protected:
double mt[6];
};