Class Quadrilateral

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

public final class Quadrilateral extends Object
The Quadrilateral class provides a container for a 2D quadrilateral.

Note that a counter clockwise specified quadrilateral is preferred:

Note that this class cannot be subclassed!

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

  • Constructor Details

  • Method Details

    • clear

      public void clear()
      Sets all four 2D-points of this Quadrilateral object equal to (0,0).
    • set

      public void set(Point2D.Double p1, Point2D.Double p2, Point2D.Double p3, Point2D.Double p4)
      Sets all four 2D points of this Quadrilateral object equal to the specified points.

      Note that internally, the four specified points are referenced; this means that any changes to the specified points are reflected in the internal Point2D objects.

      Parameters:
      p1 - the quadrilateral's first point (shallow copy)
      p2 - the quadrilateral's second point (shallow copy)
      p3 - the quadrilateral's third point (shallow copy)
      p4 - the quadrilateral's fourth point (shallow copy)
      See Also:
    • set

      public void set(Quadrilateral q)
      Sets all four 2D points of this Quadrilateral object equal to those of the specified Quadrilateral object.

      Note that internally, the four specified points are referenced; this means that any changes to the specified points are reflected in the internal Point2D.Double objects.

      Parameters:
      q - the quadrilateral's 2D-data points to shallow copy
      See Also:
    • permuteCounterClockwise

      public void permuteCounterClockwise()
      Permutes all four 2D points of this Quadrilateral object counter clockwise.

      After the operation, the 2D points have changed as follows:

      • fP1 → fP2
      • fP2 → fP3
      • fP3 → fP4
      • fP4 → fP1
      See Also:
    • permuteVertical

      public void permuteVertical()
      Permutes all four 2D points of this Quadrilateral object vertically.

      After the operation, the 2D points have changed as follows:

      • fP1 → fP3
      • fP2 → fP4
      • fP3 → fP1
      • fP4 → fP2

      This corresponds to two consecutive counter clockwise permutations.

      See Also:
    • isConvex

      public boolean isConvex()
      Returns whether or not this Quadrilateral object is convex shaped.

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

      Returns:
      true if this Quadrilateral object is convex shaped, false otherwise
      See Also:
    • isScreenConvex

      public boolean isScreenConvex()
      Returns whether or not this Quadrilateral object is convex shaped on the screen.

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

      Returns:
      true if this Quadrilateral object is convex shaped on the screen, false otherwise
      See Also: