Affine.MapTri C# (CSharp) Method

MapTri() public method

public MapTri ( float px0, float py0, float qx0, float qy0, float rx0, float ry0 ) : bool
px0 float
py0 float
qx0 float
qy0 float
rx0 float
ry0 float
return bool
	public bool MapTri(float px0, float py0, float qx0, float qy0, float rx0, float ry0)
	{
		// px0 = dx, qx0 = m11 + dx, rx0 = m21 + dx
		// py0 = dy, qy0 = m12 + dy, ry0 = m22 + dy
		fMatrix.eM11 = qx0 - px0;
		fMatrix.eM12 = qy0 - py0;
		fMatrix.eM21 = rx0 - px0;
		fMatrix.eM22 = ry0 - py0;
		fMatrix.eDx = px0;
		fMatrix.eDy = py0;

		return fMatrix.eM11 * fMatrix.eM22 != fMatrix.eM12 * fMatrix.eM21;
	}

Same methods

Affine::MapTri ( float px0, float py0, float qx0, float qy0, float rx0, float ry0, float px1, float py1, float qx1, float qy1, float rx1, float ry1 ) : bool

Usage Example

Example #1
0
	// Find a transform which maps p0, q0, and r0 to p1, p1 and r1 respectively
	public bool MapTri(float px0, float py0, float qx0, float qy0, float rx0, float ry0,
						 float px1, float py1, float qx1, float qy1, float rx1, float ry1)
	{
		if (!MapTri(px0, py0, qx0, qy0, rx0, ry0))
			return false;

		Invert();		// transform p0, q0, and r0 back to (0,0),(1,0),(0,1)

		Affine map1 = new Affine();

		if (!map1.MapTri(px1, py1, qx1, qy1, rx1, ry1))
			return false;

		return Combine(map1.fMatrix);	// then to p1,r1,q1
	}