Package arc.math.geom

Class Point3

java.lang.Object
arc.math.geom.Point3

public class Point3 extends Object
A point in a 3D grid, with integer x and y coordinates
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    int
     
    int
     
    int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a 3D grid point with all coordinates pointing to the origin (0, 0, 0).
    Point3(int x, int y, int z)
    Constructs a 3D grid point.
    Point3(Point3 point)
    Copy constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    add(int x, int y, int z)
    Adds another 3D grid point to this point.
    add(Point3 other)
    Adds another 3D grid point to this point.
    cpy()
     
    float
    dst(int x, int y, int z)
     
    float
    dst(Point3 other)
     
    float
    dst2(int x, int y, int z)
     
    float
    dst2(Point3 other)
     
    boolean
     
    int
     
    set(int x, int y, int z)
    Sets the coordinates of this GridPoint3D.
    set(Point3 point)
    Sets the coordinates of this 3D grid point to that of another.
    sub(int x, int y, int z)
    Subtracts another 3D grid point from this point.
    sub(Point3 other)
    Subtracts another 3D grid point from this point.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • x

      public int x
    • y

      public int y
    • z

      public int z
  • Constructor Details

    • Point3

      public Point3()
      Constructs a 3D grid point with all coordinates pointing to the origin (0, 0, 0).
    • Point3

      public Point3(int x, int y, int z)
      Constructs a 3D grid point.
      Parameters:
      x - X coordinate
      y - Y coordinate
      z - Z coordinate
    • Point3

      public Point3(Point3 point)
      Copy constructor
      Parameters:
      point - The 3D grid point to make a copy of.
  • Method Details

    • set

      public Point3 set(Point3 point)
      Sets the coordinates of this 3D grid point to that of another.
      Parameters:
      point - The 3D grid point to copy coordinates of.
      Returns:
      this Point3 for chaining.
    • set

      public Point3 set(int x, int y, int z)
      Sets the coordinates of this GridPoint3D.
      Parameters:
      x - X coordinate
      y - Y coordinate
      z - Z coordinate
      Returns:
      this GridPoint3D for chaining.
    • dst2

      public float dst2(Point3 other)
      Parameters:
      other - The other point
      Returns:
      the squared distance between this point and the other point.
    • dst2

      public float dst2(int x, int y, int z)
      Parameters:
      x - The x-coordinate of the other point
      y - The y-coordinate of the other point
      z - The z-coordinate of the other point
      Returns:
      the squared distance between this point and the other point.
    • dst

      public float dst(Point3 other)
      Parameters:
      other - The other point
      Returns:
      the distance between this point and the other vector.
    • dst

      public float dst(int x, int y, int z)
      Parameters:
      x - The x-coordinate of the other point
      y - The y-coordinate of the other point
      z - The z-coordinate of the other point
      Returns:
      the distance between this point and the other point.
    • add

      public Point3 add(Point3 other)
      Adds another 3D grid point to this point.
      Parameters:
      other - The other point
      Returns:
      this 3d grid point for chaining.
    • add

      public Point3 add(int x, int y, int z)
      Adds another 3D grid point to this point.
      Parameters:
      x - The x-coordinate of the other point
      y - The y-coordinate of the other point
      z - The z-coordinate of the other point
      Returns:
      this 3d grid point for chaining.
    • sub

      public Point3 sub(Point3 other)
      Subtracts another 3D grid point from this point.
      Parameters:
      other - The other point
      Returns:
      this 3d grid point for chaining.
    • sub

      public Point3 sub(int x, int y, int z)
      Subtracts another 3D grid point from this point.
      Parameters:
      x - The x-coordinate of the other point
      y - The y-coordinate of the other point
      z - The z-coordinate of the other point
      Returns:
      this 3d grid point for chaining.
    • cpy

      public Point3 cpy()
      Returns:
      a copy of this grid point
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object