public Point2d?Perspective(RelativePoint point) { if (!GeometryHelpers.IsInside(point, BL, TL, TR, BR)) { return(null); } double px = p[0].X; double py = p[0].Y; double xp = point.Norm.X; double yp = point.Norm.Y; double detD = ((a + g * px - g * xp) * (e + h * py - h * yp)) - ((d + g * py - g * yp) * (b + h * px - h * xp)); double detDx = ((xp - px) * (e + h * py - h * yp)) - ((yp - py) * (b + h * px - h * xp)); double detDy = ((a + g * px - g * xp) * (yp - py)) - ((d + g * py - g * yp) * (xp - px)); double x = detDx / detD; double y = detDy / detD; double normX = x * TopBottomDistance; double normY = y * LeftRightDistance; return(new Point2d(normX, normY)); }