Class QuadToQuadMapping

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

public final class QuadToQuadMapping
extends java.lang.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:
Quadrilateral, QuadMapping
  • Constructor Summary

    Constructors
    Constructor Description
    QuadToQuadMapping​(QuadMapping quad1Mapping, QuadMapping quad2Mapping)
    Constructs a QuadToQuadMapping object based on the two perspective mappings between quadrilaterals.
    QuadToQuadMapping​(Quadrilateral q1, Quadrilateral q2)
    Constructs a QuadToQuadMapping object based on the two specified quadrilaterals.
  • Method Summary

    Modifier and Type Method Description
    java.awt.geom.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.
    java.awt.geom.Point2D.Double mapQuad1ToQuad2​(java.awt.geom.Point2D.Double p)
    Maps a 2D-datapoint in the first quadrilateral to a 2D-data point in the second quadrilateral.
    java.awt.geom.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.
    java.awt.geom.Point2D.Double mapQuad2ToQuad1​(java.awt.geom.Point2D.Double p)
    Maps a 2D-data point in the second quadrilateral to a 2D-data point in the first quadrilateral.
    void set​(QuadMapping quad1Mapping, QuadMapping quad2Mapping)
    Sets the perspective mapping based on the two perspective mappings between quadrilaterals.

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 java.awt.geom.Point2D.Double mapQuad1ToQuad2​(java.awt.geom.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 java.awt.geom.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 java.awt.geom.Point2D.Double mapQuad2ToQuad1​(java.awt.geom.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 java.awt.geom.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