PerspectiveTransform.fromQuadrilaterals constructor

PerspectiveTransform.fromQuadrilaterals(
  1. List<Position<num>> originVertices,
  2. List<Position<num>> destinationVertices
)

Creates a PerspectiveTransform that transforms a given quadrilateral into another given quadrilateral, expressed as a list of its vertices.

Implementation

factory PerspectiveTransform.fromQuadrilaterals(
  List<Position> originVertices,
  List<Position> destinationVertices,
) {
  final fromOriginToSquare =
      PerspectiveTransform.fromTransformedSquare(originVertices).inverse();
  final fromSquareToDestination =
      PerspectiveTransform.fromTransformedSquare(destinationVertices);
  return fromSquareToDestination.compose(fromOriginToSquare);
}