apply method

Position<double> apply(
  1. Position<num> point
)

Applies this transformation to a given point and returns the transformed point.

Implementation

Position<double> apply(Position point) {
  final x = point.x.toDouble();
  final y = point.y.toDouble();
  final denominator = _matrix(1, 3) * x + _matrix(2, 3) * y + _matrix(3, 3);
  return Position<double>(
    (_matrix(1, 1) * x + _matrix(2, 1) * y + _matrix(3, 1)) / denominator,
    (_matrix(1, 2) * x + _matrix(2, 2) * y + _matrix(3, 2)) / denominator,
  );
}