void translate2D(GLfloat tx, GLfloat ty) { Matrix3x3 matTransl; matrix3x3SetIndentity(matTransl); matTransl[0][2] = tx; matTransl[1][2] = ty; matrix3x3PreMultiply(matTransl, matComposite); }
void translate2D (GLfloat tx, GLfloat ty) { Matrix3x3 matTransl; /* Initialize translation matrix to identity. */ matrix3x3SetIdentity (matTransl); matTransl [0][2] = tx; matTransl [1][2] = ty; /* Concatenate matTransl with the composite matrix. */ matrix3x3PreMultiply (matTransl, matComposite); }
void scale2D(GLfloat sx, GLfloat sy, wcPt2D fixedPt) { Matrix3x3 matScale; matrix3x3SetIndentity(matScale); matScale[0][0] = sx; matScale[0][2] = (1 - sx) * fixedPt.x; matScale[1][1] = sy; matScale[1][2] = (1 - sy) * fixedPt.y; /* concatenate matScale with the composite matrix */ matrix3x3PreMultiply(matScale, matComposite); }
void scale2D (GLfloat sx, GLfloat sy, wcPt2D fixedPt) { Matrix3x3 matScale; /* Initialize scaling matrix to identity. */ matrix3x3SetIdentity (matScale); matScale [0][0] = sx; matScale [0][2] = (1 - sx) * fixedPt.x; matScale [1][1] = sy; matScale [1][2] = (1 - sy) * fixedPt.y; /* Concatenate matScale with the composite matrix. */ matrix3x3PreMultiply (matScale, matComposite); }
void rotate2D(wcPt2D pivotPt, GLfloat theta) { Matrix3x3 matRot; matrix3x3SetIndentity(matRot); matRot[0][0] = cos(theta); matRot[0][1] = -sin(theta); matRot[0][2] = pivotPt.x * (1 - cos(theta)); matRot[1][0] = sin(theta); matRot[1][1] = cos(theta); matRot[1][2] = pivotPt.y * (1 - sin(theta)); matrix3x3PreMultiply(matRot, matComposite); }
void rotate2D (wcPt2D pivotPt, GLfloat theta) { Matrix3x3 matRot; /* Initialize rotation matrix to identity. */ matrix3x3SetIdentity (matRot); matRot [0][0] = cos (theta); matRot [0][1] = -sin (theta); matRot [0][2] = pivotPt.x * (1 - cos (theta)) + pivotPt.y * sin (theta); matRot [1][0] = sin (theta); matRot [1][1] = cos (theta); matRot [1][2] = pivotPt.y * (1 - cos (theta)) - pivotPt.x * sin (theta); /* Concatenate matRot with the composite matrix. */ matrix3x3PreMultiply (matRot, matComposite); }