Source
Point<num> transformPoint(math.Point<num> point, [Point<num> returnPoint]) { var px = point.x.toDouble(); var py = point.y.toDouble(); var td = m03 * px + m13 * py + m33; var tx = m00 * px + m10 * py + m30; var ty = m01 * px + m11 * py + m31; if (returnPoint is Point) { returnPoint.setTo(tx / td, ty / td); return returnPoint; } else { return new Point<num>(tx / td, ty / td); } }