Module org.dyn4j

Class RobustGeometry


  • public final class RobustGeometry
    extends java.lang.Object
    This class provides geometric routines that have guarantees about some properties of their floating point results and operations.
    Since:
    3.4.0
    Version:
    3.4.0
    Author:
    Manolis Tsamis
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static int SPLITTER
      Constant that AdaptiveDecimal uses to split doubles when calculation multiplication error
    • Constructor Summary

      Constructors 
      Constructor Description
      RobustGeometry()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static AdaptiveDecimal cross​(double ax, double ay, double bx, double by)
      Performs cross product on four primitives and also allocates a new AdaptiveDecimal with the appropriate capacity to store the result.
      static AdaptiveDecimal cross​(double ax, double ay, double bx, double by, AdaptiveDecimal result)
      Performs the cross product of two vectors a, b, that is ax * by - ay * bx but with extended precision and stores the 4 component result in the given AdaptiveDecimal result.
      static double getLocation​(Vector2 point, Vector2 linePoint1, Vector2 linePoint2)
      Robust side-of-line test.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SPLITTER

        static final int SPLITTER
        Constant that AdaptiveDecimal uses to split doubles when calculation multiplication error
    • Constructor Detail

      • RobustGeometry

        public RobustGeometry()
    • Method Detail

      • cross

        public static AdaptiveDecimal cross​(double ax,
                                            double ay,
                                            double bx,
                                            double by)
        Performs cross product on four primitives and also allocates a new AdaptiveDecimal with the appropriate capacity to store the result.
        Parameters:
        ax - The x value of the vector a
        ay - The y value of the vector a
        bx - The x value of the vector b
        by - The y value of the vector b
        Returns:
        The result
        See Also:
        cross(double, double, double, double, AdaptiveDecimal)
      • cross

        public static AdaptiveDecimal cross​(double ax,
                                            double ay,
                                            double bx,
                                            double by,
                                            AdaptiveDecimal result)
        Performs the cross product of two vectors a, b, that is ax * by - ay * bx but with extended precision and stores the 4 component result in the given AdaptiveDecimal result. In the same way as with AdaptiveDecimal.sum(AdaptiveDecimal, AdaptiveDecimal) if result is null a new one is allocated, otherwise the existing is cleared and used.
        Parameters:
        ax - The x value of the vector a
        ay - The y value of the vector a
        bx - The x value of the vector b
        by - The y value of the vector b
        result - The AdaptiveDecimal in which the cross product is stored
        Returns:
        The result