transformPoint function

List<num> transformPoint(
  1. List<num> m,
  2. List<num> v
)

Implementation

List<num> transformPoint(List<num> m, List<num> v) {
  final v0 = v[0];
  final v1 = v[1];
  final d = v0 * m[0 * 3 + 2] + v1 * m[1 * 3 + 2] + m[2 * 3 + 2];
  return [
    (v0 * m[0 * 3 + 0] + v1 * m[1 * 3 + 0] + m[2 * 3 + 0]) / d,
    (v0 * m[0 * 3 + 1] + v1 * m[1 * 3 + 1] + m[2 * 3 + 1]) / d,
  ];
}