Class QuadToQuadMapping

java.lang.Object
org.sm.smtools.math.quadmapping.QuadToQuadMapping

public final class QuadToQuadMapping extends Object
The QuadToQuadMapping class provides a perspective mapping between two convex quadrilaterals.

This class maps 2D-data points between two convex quadrilaterals:

Note: it is assumed that the X axis points to the right and the Y axis points upwards.

Note that this class cannot be subclassed!

Version:
09/12/2004
Author:
Sven Maerivoet
See Also:
  • Constructor Details

  • Method Details

    • set

      public void set(QuadMapping quad1Mapping, QuadMapping quad2Mapping)
      Sets the perspective mapping based on the two perspective mappings between quadrilaterals.
      Parameters:
      quad1Mapping - the first perspective mapping to use
      quad2Mapping - the second perspective mapping to use
    • mapQuad1ToQuad2

      public Point2D.Double mapQuad1ToQuad2(Point2D.Double p)
      Maps a 2D-datapoint in the first quadrilateral to a 2D-data point in the second quadrilateral.
      Parameters:
      p - the 2D-data point in the first quadrilateral
      Returns:
      the corresponding 2D-data point in the second quadrilateral
    • mapQuad1ToQuad2

      public Point2D.Double mapQuad1ToQuad2(double x, double y)
      Maps a 2D-data point in the first quadrilateral to a 2D-data point in the second quadrilateral.
      Parameters:
      x - the x coordinate of the 2D-data point in the first quadrilateral
      y - the y coordinate of the 2D-data point in the first quadrilateral
      Returns:
      the corresponding 2D-data point in the second quadrilateral
    • mapQuad2ToQuad1

      public Point2D.Double mapQuad2ToQuad1(Point2D.Double p)
      Maps a 2D-data point in the second quadrilateral to a 2D-data point in the first quadrilateral.
      Parameters:
      p - the 2D-data point in the second quadrilateral
      Returns:
      the corresponding 2D-data point in the first quadrilateral
    • mapQuad2ToQuad1

      public Point2D.Double mapQuad2ToQuad1(double x, double y)
      Maps a 2D-data point in the second quadrilateral to a 2D-data point in the first quadrilateral.
      Parameters:
      x - the x coordinate of the 2D-data point in the second quadrilateral
      y - the y coordinate of the 2D-data point in the second quadrilateral
      Returns:
      the corresponding 2D-data point in the first quadrilateral