Module org.dyn4j

Class ReferencePointComparator

  • All Implemented Interfaces:
    java.util.Comparator<Vector2>

    final class ReferencePointComparator
    extends java.lang.Object
    implements java.util.Comparator<Vector2>
    Comparator class to compare points by their angle from the positive x-axis with reference from a given point.
    Since:
    2.2.0
    Version:
    3.4.0
    Author:
    William Bittle
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) Vector2 reference
      The reference point for testing polar angles
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(Vector2 p1, Vector2 p2)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Field Detail

      • reference

        final Vector2 reference
        The reference point for testing polar angles
    • Constructor Detail

      • ReferencePointComparator

        public ReferencePointComparator​(Vector2 reference)
        Full constructor.
        Parameters:
        reference - the reference point for finding angles
    • Method Detail

      • compare

        public int compare​(Vector2 p1,
                           Vector2 p2)
        Specified by:
        compare in interface java.util.Comparator<Vector2>