Class QuadMapping

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

public final class QuadMapping extends Object
The QuadMapping class provides a perspective mapping for a convex quadrilateral.

This class maps 2D-data points between a convex quadrilateral and a normalised square:

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

    • QuadMapping

      public QuadMapping(Quadrilateral q)
      Constructs a QuadMapping object based on the perspective mapping of the specified quadrilateral.
      Parameters:
      q - the quadrilateral to use for the perspective mapping
      See Also:
  • Method Details

    • setQuadrilateral

      public void setQuadrilateral(Quadrilateral q)
      Calculates the perspective mapping of the specified quadrilateral.
      Parameters:
      q - the quadrilateral to use for the perspective mapping
    • mapSquareToQuadrilateral

      public Point2D.Double mapSquareToQuadrilateral(Point2D.Double p)
      Maps a 2D-data point in the normalised square to a 2D-data point in the quadrilateral.
      Parameters:
      p - the 2D-data point in the normalised square to map
      Returns:
      the corresponding 2D-data point in the quadrilateral
      See Also:
    • mapSquareToQuadrilateral

      public Point2D.Double mapSquareToQuadrilateral(double u, double v)
      Maps a 2D-data point in the normalised square to a 2D-data point in the quadrilateral.
      Parameters:
      u - the x coordinate of the 2D-data point in the normalised square to map
      v - the y coordinate of the 2D-data point in the normalised square to map
      Returns:
      the corresponding 2D-data point in the quadrilateral
      See Also:
    • mapQuadrilateralToSquare

      public Point2D.Double mapQuadrilateralToSquare(Point2D.Double p)
      Inversely maps a 2D-data point in the quadrilateral to a 2D-data point in the normalised square.
      Parameters:
      p - the 2D-data point in the quadrilateral to map inversely
      Returns:
      the corresponding 2D-data point in the normalised square
      See Also:
    • mapQuadrilateralToSquare

      public Point2D.Double mapQuadrilateralToSquare(double x, double y)
      Inversely maps a 2D-data point in the quadrilateral to a 2D-data point in the normalised square.
      Parameters:
      x - the x coordinate of the 2D-data point in the quadrilateral to map inversely
      y - the y coordinate of the 2D-data point in the quadrilateral to map inversely
      Returns:
      the corresponding 2D-data point in the normalised square
      See Also: