Class Point

java.lang.Object
icyllis.arc3d.core.Point

public class Point extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static float
    crossProduct(float ax, float ay, float bx, float by)
    Returns the cross product of vector a and vector b.
    static float
    distanceTo(float ax, float ay, float bx, float by)
     
    static float
    distanceToLineBetween(float px, float py, float ax, float ay, float bx, float by)
     
    static float
    distanceToLineBetweenSq(float px, float py, float ax, float ay, float bx, float by)
     
    static float
    distanceToLineSegmentBetween(float px, float py, float ax, float ay, float bx, float by)
     
    static float
    distanceToLineSegmentBetweenSq(float px, float py, float ax, float ay, float bx, float by)
     
    static float
    distanceToSq(float ax, float ay, float bx, float by)
     
    static float
    dotProduct(float ax, float ay, float bx, float by)
    Returns the dot product of vector a and vector b.
    static boolean
    equals(float x1, float y1, float x2, float y2)
    Returns true if two points are equal.
    static boolean
    isApproxEqual(float x1, float y1, float x2, float y2, float tolerance)
    Returns true if two points are equal within the given tolerance.
    static boolean
    isDegenerate(float dx, float dy)
    Returns true if the given vector is degenerate or infinite.
    static float
    length(float x, float y)
     
    static float
    lengthSq(float x, float y)
     
    static boolean
    normalize(float[] pos, int off)
     
    static boolean
    setLength(float[] pos, int off, float length)
    Sets vector to (x, y) scaled to length, if possible.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Point

      public Point()
  • Method Details

    • isDegenerate

      @Contract(pure=true) public static boolean isDegenerate(float dx, float dy)
      Returns true if the given vector is degenerate or infinite. If so, the vector cannot be normalized.
    • equals

      @Contract(pure=true) public static boolean equals(float x1, float y1, float x2, float y2)
      Returns true if two points are equal.
    • isApproxEqual

      @Contract(pure=true) public static boolean isApproxEqual(float x1, float y1, float x2, float y2, float tolerance)
      Returns true if two points are equal within the given tolerance.
    • dotProduct

      @Contract(pure=true) public static float dotProduct(float ax, float ay, float bx, float by)
      Returns the dot product of vector a and vector b.
      Returns:
      product of input magnitudes and cosine of the angle between them
    • crossProduct

      @Contract(pure=true) public static float crossProduct(float ax, float ay, float bx, float by)
      Returns the cross product of vector a and vector b.

      a and b form three-dimensional vectors with z-axis value equal to zero. The cross product is a three-dimensional vector with x-axis and y-axis values equal to zero. The cross product z-axis component is returned.

      Returns:
      area spanned by vectors signed by angle direction
    • normalize

      public static boolean normalize(float[] pos, int off)
    • setLength

      public static boolean setLength(float[] pos, int off, float length)
      Sets vector to (x, y) scaled to length, if possible. If new length is zero or NaN, returns false; otherwise returns true.

      The vector is given by (v[off], v[off+1]), off must be even. length must be >= 0.

    • length

      @Contract(pure=true) public static float length(float x, float y)
    • lengthSq

      @Contract(pure=true) public static float lengthSq(float x, float y)
    • distanceTo

      @Contract(pure=true) public static float distanceTo(float ax, float ay, float bx, float by)
    • distanceToSq

      @Contract(pure=true) public static float distanceToSq(float ax, float ay, float bx, float by)
    • distanceToLineBetweenSq

      public static float distanceToLineBetweenSq(float px, float py, float ax, float ay, float bx, float by)
    • distanceToLineBetween

      public static float distanceToLineBetween(float px, float py, float ax, float ay, float bx, float by)
    • distanceToLineSegmentBetweenSq

      public static float distanceToLineSegmentBetweenSq(float px, float py, float ax, float ay, float bx, float by)
    • distanceToLineSegmentBetween

      public static float distanceToLineSegmentBetween(float px, float py, float ax, float ay, float bx, float by)