Interface IVector3D

All Known Implementing Classes:
Vector3Dd, Vector3Di

public sealed interface IVector3D permits Vector3Dd, Vector3Di
A 3d vector backed either by doubles or integers.
  • Method Details

    • xD

      @CheckReturnValue @Contract(pure=true) double xD()
      Returns the x value as double.
      Returns:
      The x value as double.
    • yD

      @CheckReturnValue @Contract(pure=true) double yD()
      Returns the y value as double.
      Returns:
      The y value as double.
    • zD

      @CheckReturnValue @Contract(pure=true) double zD()
      Returns the z value as double.
      Returns:
      The z value as double.
    • getDistance

      @CheckReturnValue @Contract(pure=true) default double getDistance(IVector3D point)
      Gets the distance to a point.
      Parameters:
      point - The point.
      Returns:
      The distance to the other point.
    • getDistance

      @CheckReturnValue @Contract(pure=true) default double getDistance(ILocation location)
      Gets the distance to a location.
      Parameters:
      location - The location.
      Returns:
      The distance to the other point.
    • toLocation

      @CheckReturnValue @Contract(pure=true) default ILocation toLocation(ILocationFactory locationFactory, IWorld world)
      Creates a new ILocation using the current x/y/z coordinates.
      Parameters:
      world - The world in which the ILocation will exist.
      Returns:
      A new ILocation.
    • magnitude

      @CheckReturnValue @Contract(pure=true) default double magnitude()
      Returns the magnitude of this vector.
      Returns:
      The magnitude of this vector.
    • floor

      IVector3D floor()
      Returns a new vector with Math.floor(double) applied to the current values.
      Returns:
      A new vector with Math.floor(double) applied to the current values.
    • round

      IVector3D round()
      Returns a new vector with Math.round(double) applied to the current values.
      Returns:
      A new vector with Math.round(double) applied to the current values.
    • ceil

      IVector3D ceil()
      Returns a new vector with Math.ceil(double) applied to the current values.
      Returns:
      A new vector with Math.ceil(double) applied to the current values.
    • toRadians

      default Vector3Dd toRadians()
      Converts all the values in this 3d vector to tadians.

      See Math.toRadians(double).

      Returns:
      The new 3d vector.
    • toDegrees

      default Vector3Dd toDegrees()
      Converts all the values in this 3d vector to degrees.

      See Math.toDegrees(double).

      Returns:
      The new 3d vector.
    • toInteger

      @CheckReturnValue @Contract(pure=true) Vector3Di toInteger()
      Creates a new integer-based 3d vector from this 3d vector.

      The values of a double-based vector will be rounded to obtain the integer values.

      Returns:
      A new integer-based vector.
    • toDouble

      @CheckReturnValue @Contract(pure=true) Vector3Dd toDouble()
      Creates a new double-based 3d vector from this integer-based 3d vector.
      Returns:
      A new double-based vector.