Class Point5Float

java.lang.Object
com.github.yellowstonegames.grid.Point5Float
All Implemented Interfaces:
com.github.tommyettinger.crux.Point5<Point5Float>, com.github.tommyettinger.crux.PointN<Point5Float>, com.github.tommyettinger.crux.PointNFloat<Point5Float, com.github.tommyettinger.crux.Point5<?>>, com.github.tommyettinger.ds.PrimitiveCollection<Float>, com.github.tommyettinger.ds.PrimitiveCollection.OfFloat, PointNFloat<Point5Float, com.github.tommyettinger.crux.Point5<?>>

public class Point5Float extends Object implements com.github.tommyettinger.crux.Point5<Point5Float>, PointNFloat<Point5Float, com.github.tommyettinger.crux.Point5<?>>, com.github.tommyettinger.ds.PrimitiveCollection.OfFloat
A mutable 5D point with float components implementing Point5, PrimitiveCollection.OfFloat, and PointNFloat.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.github.tommyettinger.ds.PrimitiveCollection

    com.github.tommyettinger.ds.PrimitiveCollection.OfBoolean, com.github.tommyettinger.ds.PrimitiveCollection.OfByte, com.github.tommyettinger.ds.PrimitiveCollection.OfChar, com.github.tommyettinger.ds.PrimitiveCollection.OfDouble, com.github.tommyettinger.ds.PrimitiveCollection.OfFloat, com.github.tommyettinger.ds.PrimitiveCollection.OfInt, com.github.tommyettinger.ds.PrimitiveCollection.OfLong, com.github.tommyettinger.ds.PrimitiveCollection.OfShort
  • Field Summary

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

    Constructors
    Constructor
    Description
     
    Point5Float(float x, float y, float z, float w, float u)
     
    Point5Float(com.github.tommyettinger.crux.Point5<?> p)
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    add(float c)
    Not supported; this collection is fixed-size.
    add(float x, float y, float z, float w, float u)
     
    add(com.github.tommyettinger.crux.Point5<?> point)
     
     
    addProduct(com.github.tommyettinger.crux.Point5<?> vec, float scalar)
     
    addProduct(com.github.tommyettinger.crux.Point5<?> vec, com.github.tommyettinger.crux.Point5<?> mulVec)
     
    clampEach(float min, float max)
    For each component, this clamps it between min and max, inclusive.
    clampLength(float min, float max)
     
    void
    Not supported; this collection is fixed-size.
    boolean
    contains(float c)
    Compares c with the components of this collection using ==; if any are considered equal, this returns true.
     
    cpy()
     
    float
    distance(com.github.tommyettinger.crux.Point5<?> point)
     
    float
    distanceSquared(com.github.tommyettinger.crux.Point5<?> point)
     
    div(com.github.tommyettinger.crux.Point5<?> point)
     
     
    divide(float scalar)
     
    divide(com.github.tommyettinger.crux.Point5<?> point)
     
    float
    dot(com.github.tommyettinger.crux.Point5<?> other)
     
    static float
    dot(com.github.tommyettinger.crux.Point5<?> a, com.github.tommyettinger.crux.Point5<?> b)
     
    float
    dst2(com.github.tommyettinger.crux.Point5<?> point)
     
    float
     
    boolean
     
    boolean
    Returns true if this type of point uses float or double for its components, or false otherwise.
    Sets each component so it only has a fractional value, by subtracting the floor from each component.
     
    Sets this Point5Float to the value represented by the specified string according to the format of toString().
    float
    get(int index)
    Gets the component at the specified index.
    int
     
    interpolate(com.github.tommyettinger.crux.Point5<?> target, float alpha, com.github.tommyettinger.digital.Interpolations.Interpolator interpolation)
    Calls PointNFloat.lerp(PointN, float) with the alpha determined by the given interpolation.
    Assigns to each component of this point 1f divided by its original value.
    boolean
     
     
    float
     
    lerp(com.github.tommyettinger.crux.Point5<?> target, float alpha)
    Linear-interpolates from this point toward target, moving a distance proportional to alpha and changing this point in-place if possible.
    limit(float limit)
     
    limit2(float limit2)
     
    limitSquared(float limit2)
     
    minus(float scalar)
     
    mul(float scalar)
    Multiplies each component of this by the given scalar, in-place, and returns this.
    mul(float x, float y, float z, float w, float u)
    Multiplies each component of this by the corresponding scalar, in-place, and returns this.
    mul(com.github.tommyettinger.crux.Point5<?> point)
     
     
    mulAdd(com.github.tommyettinger.crux.Point5<?> vec, float scalar)
     
    mulAdd(com.github.tommyettinger.crux.Point5<?> vec, com.github.tommyettinger.crux.Point5<?> mulVec)
     
    multiply(float scalar)
    Multiplies each component of this by the given scalar, in-place, and returns this.
    multiply(float x, float y, float z, float w, float u)
    Multiplies each component of this by the corresponding scalar, in-place, and returns this.
    multiply(com.github.tommyettinger.crux.Point5<?> point)
     
    nor()
     
     
    boolean
     
    plus(float scalar)
     
    boolean
    remove(float c)
    Not supported; this collection is fixed-size.
    scale(float scalar)
     
    scale(float x, float y, float z, float w, float u)
     
    scale(com.github.tommyettinger.crux.Point5<?> point)
     
    scl(float x, float y, float z, float w, float u)
     
    scl(com.github.tommyettinger.crux.Point5<?> point)
     
     
    set(float x, float y, float z, float w, float u)
     
    set(com.github.tommyettinger.crux.Point5<?> point)
     
     
    setAt(int index, float value)
    Sets the component at the specified index to the specified value.
    setLength(float len)
     
    setLength2(float len2)
     
    Sets this PointNFloat to a randomly chosen unit vector.
     
    int
     
    slerpGeometric(Point5Float target, float alpha)
     
    sub(float x, float y, float z, float w, float u)
     
    sub(com.github.tommyettinger.crux.Point5<?> point)
     
     
    subtract(float x, float y, float z, float w, float u)
     
    subtract(com.github.tommyettinger.crux.Point5<?> point)
     
    times(float scalar)
     
    Converts this Point5Float to a string in the format (x,y,z,w,u).
    float
    u()
     
    u(float next)
     
    float
    w()
     
    w(float next)
     
    float
    x()
     
    x(float next)
     
    float
    y()
     
    y(float next)
     
    float
    z()
     
    z(float next)
     

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.github.tommyettinger.crux.Point5

    rank, seti, ui, ui, wi, wi, xi, xi, yi, yi, zi, zi

    Methods inherited from interface com.github.tommyettinger.crux.PointN

    dst, isUnit, isUnit, isZero, isZero, len, mutable

    Methods inherited from interface com.github.tommyettinger.ds.PrimitiveCollection.OfFloat

    addAll, addAll, addAll, addAll, addDense, addDense, addLegible, addLegible, addVarargs, appendTo, appendTo, containsAll, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, containsAny, denseAppendTo, first, forEach, removeAll, removeAll, removeAll, removeAll, removeEach, removeEach, removeEach, removeEach, removeIf, retainAll, retainAll, retainAll, toArray, toArray, toDenseString, toDenseString, toString, toString, toString
  • Field Details

    • x

      public float x
    • y

      public float y
    • z

      public float z
    • w

      public float w
    • u

      public float u
  • Constructor Details

    • Point5Float

      public Point5Float()
    • Point5Float

      public Point5Float(float x, float y, float z, float w, float u)
    • Point5Float

      public Point5Float(Point5Float p)
    • Point5Float

      public Point5Float(com.github.tommyettinger.crux.Point5<?> p)
  • Method Details

    • floatingPoint

      public boolean floatingPoint()
      Returns true if this type of point uses float or double for its components, or false otherwise. This always returns true.
      Specified by:
      floatingPoint in interface com.github.tommyettinger.crux.PointN<Point5Float>
      Specified by:
      floatingPoint in interface com.github.tommyettinger.crux.PointNFloat<Point5Float, com.github.tommyettinger.crux.Point5<?>>
      Specified by:
      floatingPoint in interface PointNFloat<Point5Float, com.github.tommyettinger.crux.Point5<?>>
      Returns:
      true
    • cpy

      public Point5Float cpy()
      Specified by:
      cpy in interface com.github.tommyettinger.crux.PointN<Point5Float>
    • copy

      public Point5Float copy()
    • len2

      public float len2()
      Specified by:
      len2 in interface com.github.tommyettinger.crux.PointN<Point5Float>
    • set

      public Point5Float set(Point5Float point)
      Specified by:
      set in interface com.github.tommyettinger.crux.PointN<Point5Float>
    • set

      public Point5Float set(com.github.tommyettinger.crux.Point5<?> point)
    • sub

      public Point5Float sub(Point5Float point)
      Specified by:
      sub in interface com.github.tommyettinger.crux.PointN<Point5Float>
    • sub

      public Point5Float sub(com.github.tommyettinger.crux.Point5<?> point)
    • subtract

      public Point5Float subtract(com.github.tommyettinger.crux.Point5<?> point)
    • add

      public Point5Float add(Point5Float point)
      Specified by:
      add in interface com.github.tommyettinger.crux.PointN<Point5Float>
    • add

      public Point5Float add(com.github.tommyettinger.crux.Point5<?> point)
    • scl

      public Point5Float scl(Point5Float point)
      Specified by:
      scl in interface com.github.tommyettinger.crux.PointN<Point5Float>
    • scl

      public Point5Float scl(com.github.tommyettinger.crux.Point5<?> point)
    • scale

      public Point5Float scale(com.github.tommyettinger.crux.Point5<?> point)
    • mul

      public Point5Float mul(Point5Float point)
    • mul

      public Point5Float mul(com.github.tommyettinger.crux.Point5<?> point)
    • multiply

      public Point5Float multiply(com.github.tommyettinger.crux.Point5<?> point)
    • div

      public Point5Float div(Point5Float point)
      Specified by:
      div in interface com.github.tommyettinger.crux.PointN<Point5Float>
    • div

      public Point5Float div(com.github.tommyettinger.crux.Point5<?> point)
    • divide

      public Point5Float divide(com.github.tommyettinger.crux.Point5<?> point)
    • dst2

      public float dst2(Point5Float point)
      Specified by:
      dst2 in interface com.github.tommyettinger.crux.PointN<Point5Float>
    • dst2

      public float dst2(com.github.tommyettinger.crux.Point5<?> point)
    • distance

      public float distance(com.github.tommyettinger.crux.Point5<?> point)
    • distanceSquared

      public float distanceSquared(com.github.tommyettinger.crux.Point5<?> point)
    • setZero

      public Point5Float setZero()
      Specified by:
      setZero in interface com.github.tommyettinger.crux.PointN<Point5Float>
    • x

      public float x()
      Specified by:
      x in interface com.github.tommyettinger.crux.Point5<Point5Float>
    • x

      public Point5Float x(float next)
      Specified by:
      x in interface com.github.tommyettinger.crux.Point5<Point5Float>
    • y

      public float y()
      Specified by:
      y in interface com.github.tommyettinger.crux.Point5<Point5Float>
    • y

      public Point5Float y(float next)
      Specified by:
      y in interface com.github.tommyettinger.crux.Point5<Point5Float>
    • z

      public float z()
      Specified by:
      z in interface com.github.tommyettinger.crux.Point5<Point5Float>
    • z

      public Point5Float z(float next)
      Specified by:
      z in interface com.github.tommyettinger.crux.Point5<Point5Float>
    • w

      public float w()
      Specified by:
      w in interface com.github.tommyettinger.crux.Point5<Point5Float>
    • w

      public Point5Float w(float next)
      Specified by:
      w in interface com.github.tommyettinger.crux.Point5<Point5Float>
    • u

      public float u()
      Specified by:
      u in interface com.github.tommyettinger.crux.Point5<Point5Float>
    • u

      public Point5Float u(float next)
      Specified by:
      u in interface com.github.tommyettinger.crux.Point5<Point5Float>
    • set

      public Point5Float set(float x, float y, float z, float w, float u)
      Specified by:
      set in interface com.github.tommyettinger.crux.Point5<Point5Float>
    • nor

      public Point5Float nor()
      Specified by:
      nor in interface com.github.tommyettinger.crux.PointN<Point5Float>
    • normalize

      public Point5Float normalize()
    • add

      public Point5Float add(float x, float y, float z, float w, float u)
    • sub

      public Point5Float sub(float x, float y, float z, float w, float u)
    • subtract

      public Point5Float subtract(float x, float y, float z, float w, float u)
    • plus

      public Point5Float plus(float scalar)
      Specified by:
      plus in interface com.github.tommyettinger.crux.PointN<Point5Float>
    • minus

      public Point5Float minus(float scalar)
      Specified by:
      minus in interface com.github.tommyettinger.crux.PointN<Point5Float>
    • times

      public Point5Float times(float scalar)
      Specified by:
      times in interface com.github.tommyettinger.crux.PointN<Point5Float>
    • scale

      public Point5Float scale(float scalar)
    • scl

      public Point5Float scl(float x, float y, float z, float w, float u)
    • scale

      public Point5Float scale(float x, float y, float z, float w, float u)
    • mul

      public Point5Float mul(float scalar)
      Multiplies each component of this by the given scalar, in-place, and returns this. This is an alias for times(float).
      Parameters:
      scalar - a float that will be multiplied with each component
      Returns:
      this, for chaining
    • multiply

      public Point5Float multiply(float scalar)
      Multiplies each component of this by the given scalar, in-place, and returns this. This is an alias for times(float).
      Parameters:
      scalar - a float that will be multiplied with each component
      Returns:
      this, for chaining
    • mul

      public Point5Float mul(float x, float y, float z, float w, float u)
      Multiplies each component of this by the corresponding scalar, in-place, and returns this. This is an alias for scl(float, float, float, float, float).
      Parameters:
      x - a float that will be multiplied with x
      y - a float that will be multiplied with y
      Returns:
      this, for chaining
    • multiply

      public Point5Float multiply(float x, float y, float z, float w, float u)
      Multiplies each component of this by the corresponding scalar, in-place, and returns this. This is an alias for scl(float, float, float, float, float).
      Parameters:
      x - a float that will be multiplied with x
      y - a float that will be multiplied with y
      Returns:
      this, for chaining
    • divide

      public Point5Float divide(float scalar)
      Specified by:
      divide in interface com.github.tommyettinger.crux.PointN<Point5Float>
    • addProduct

      public Point5Float addProduct(com.github.tommyettinger.crux.Point5<?> vec, float scalar)
    • mulAdd

      public Point5Float mulAdd(com.github.tommyettinger.crux.Point5<?> vec, float scalar)
    • mulAdd

      public Point5Float mulAdd(com.github.tommyettinger.crux.Point5<?> vec, com.github.tommyettinger.crux.Point5<?> mulVec)
    • addProduct

      public Point5Float addProduct(com.github.tommyettinger.crux.Point5<?> vec, com.github.tommyettinger.crux.Point5<?> mulVec)
    • limit

      public Point5Float limit(float limit)
    • limit2

      public Point5Float limit2(float limit2)
    • limitSquared

      public Point5Float limitSquared(float limit2)
    • clampLength

      public Point5Float clampLength(float min, float max)
    • setLength

      public Point5Float setLength(float len)
    • setLength2

      public Point5Float setLength2(float len2)
    • dot

      public float dot(com.github.tommyettinger.crux.Point5<?> other)
    • dot

      public static float dot(com.github.tommyettinger.crux.Point5<?> a, com.github.tommyettinger.crux.Point5<?> b)
    • lerp

      public Point5Float lerp(com.github.tommyettinger.crux.Point5<?> target, float alpha)
      Description copied from interface: PointNFloat
      Linear-interpolates from this point toward target, moving a distance proportional to alpha and changing this point in-place if possible. If this point is not PointN.mutable(), this will return a new or pooled point. The alpha is expected to be in the 0 to 1 range, inclusive.
      Specified by:
      lerp in interface com.github.tommyettinger.crux.PointNFloat<Point5Float, com.github.tommyettinger.crux.Point5<?>>
      Specified by:
      lerp in interface PointNFloat<Point5Float, com.github.tommyettinger.crux.Point5<?>>
      Parameters:
      target - any point with the same dimension to move toward
      alpha - between 0 and 1, inclusive
      Returns:
      this point after modifications, if possible, or a new PointNFloat if this is immutable
    • interpolate

      public Point5Float interpolate(com.github.tommyettinger.crux.Point5<?> target, float alpha, com.github.tommyettinger.digital.Interpolations.Interpolator interpolation)
      Description copied from interface: PointNFloat
      Calls PointNFloat.lerp(PointN, float) with the alpha determined by the given interpolation. Simply returns lerp(target, interpolation.apply(alpha)) .
      Specified by:
      interpolate in interface PointNFloat<Point5Float, com.github.tommyettinger.crux.Point5<?>>
      Parameters:
      target - any point with the same dimension to move toward
      alpha - between 0 and 1, inclusive
      interpolation - an Interpolator from digital, such as Interpolations.smooth
      Returns:
      this point after modifications, if possible, or a new PointNFloat if this is immutable
    • slerpGeometric

      public Point5Float slerpGeometric(Point5Float target, float alpha)
    • setToRandomDirection

      public Point5Float setToRandomDirection(Random random)
      Description copied from interface: PointNFloat
      Sets this PointNFloat to a randomly chosen unit vector. The exact algorithm is expected to vary between dimensions. In 2D, for instance, it is sufficient to get a random float between 0 and 1, and call TrigTools.cosTurns(float) and TrigTools.sinTurns(float) to get x and y. In higher dimensions, this gets more complex. A solution that works for any dimension, but is only the best option for 4D and up, is to assign to each component a normal-distributed float using Distributor.probitF(float) with random inputs, then normalize the PointNFloat with PointN.nor().
      Specified by:
      setToRandomDirection in interface PointNFloat<Point5Float, com.github.tommyettinger.crux.Point5<?>>
      Parameters:
      random - any Random or subclass thereof
      Returns:
      this point after modifications, if possible, or a new PointNFloat if this is immutable
    • clampEach

      public Point5Float clampEach(float min, float max)
      For each component, this clamps it between min and max, inclusive.
      Parameters:
      min - the minimum value allowable for any component, inclusive
      max - the maximum value allowable for any component, inclusive
      Returns:
      this, after modifications
    • fract

      public Point5Float fract()
      Sets each component so it only has a fractional value, by subtracting the floor from each component. This produces a non-negative float for each component, between 0.0 inclusive and 1.0 exclusive, unless a component is outside the safe range for MathTools.floor(float) (-16384.0 at the lowest).
      The result of fract() for a component with a value of  1.25 will be 0.25 .
      The result of fract() for a component with a value of -1.25 will be 0.75 .
      
      Returns:
      this, after modifications
    • fractional

      public Point5Float fractional()
    • inverse

      public Point5Float inverse()
      Assigns to each component of this point 1f divided by its original value. If a component is 0.0f, its value after this will be positive infinity. If a component is -0.0f, its value after this will be negative infinity.
      Specified by:
      inverse in interface com.github.tommyettinger.crux.PointNFloat<Point5Float, com.github.tommyettinger.crux.Point5<?>>
      Specified by:
      inverse in interface PointNFloat<Point5Float, com.github.tommyettinger.crux.Point5<?>>
      Returns:
      1f divided by this point, assigned in-place to this
    • get

      public float get(int index)
      Gets the component at the specified index. Kotlin-compatible using square-bracket indexing.
      Specified by:
      get in interface com.github.tommyettinger.crux.PointNFloat<Point5Float, com.github.tommyettinger.crux.Point5<?>>
      Specified by:
      get in interface PointNFloat<Point5Float, com.github.tommyettinger.crux.Point5<?>>
      Parameters:
      index - which component to get, in order
      Returns:
      the component
    • setAt

      public Point5Float setAt(int index, float value)
      Sets the component at the specified index to the specified value.
      Specified by:
      setAt in interface com.github.tommyettinger.crux.PointNFloat<Point5Float, com.github.tommyettinger.crux.Point5<?>>
      Specified by:
      setAt in interface PointNFloat<Point5Float, com.github.tommyettinger.crux.Point5<?>>
      Parameters:
      index - which component to set, in order
      value - the value to assign at index
      Returns:
      this, for chaining
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface com.github.tommyettinger.ds.PrimitiveCollection<Float>
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface com.github.tommyettinger.ds.PrimitiveCollection<Float>
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Converts this Point5Float to a string in the format (x,y,z,w,u).
      Overrides:
      toString in class Object
      Returns:
      a string representation of this object.
    • fromString

      public Point5Float fromString(String s)
      Sets this Point5Float to the value represented by the specified string according to the format of toString().
      Parameters:
      s - the string.
      Returns:
      this point for chaining
    • add

      public boolean add(float c)
      Not supported; this collection is fixed-size.
      Specified by:
      add in interface com.github.tommyettinger.ds.PrimitiveCollection.OfFloat
      Parameters:
      c - ignored
      Returns:
      never returns
      Throws:
      UnsupportedOperationException - always
    • remove

      public boolean remove(float c)
      Not supported; this collection is fixed-size.
      Specified by:
      remove in interface com.github.tommyettinger.ds.PrimitiveCollection.OfFloat
      Parameters:
      c - ignored
      Returns:
      never returns
      Throws:
      UnsupportedOperationException - always
    • clear

      public void clear()
      Not supported; this collection is fixed-size.
      Specified by:
      clear in interface com.github.tommyettinger.ds.PrimitiveCollection<Float>
      Throws:
      UnsupportedOperationException - always
    • contains

      public boolean contains(float c)
      Compares c with the components of this collection using ==; if any are considered equal, this returns true.
      Specified by:
      contains in interface com.github.tommyettinger.ds.PrimitiveCollection.OfFloat
      Parameters:
      c - a float to be compared using ==
      Returns:
      true if any component of this collection is equal to c via == comparison
    • size

      public int size()
      Specified by:
      size in interface com.github.tommyettinger.ds.PrimitiveCollection<Float>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface com.github.tommyettinger.ds.PrimitiveCollection<Float>
    • notEmpty

      public boolean notEmpty()
      Specified by:
      notEmpty in interface com.github.tommyettinger.ds.PrimitiveCollection<Float>
    • iterator

      public PointNFloatIterator iterator()
      Specified by:
      iterator in interface com.github.tommyettinger.ds.PrimitiveCollection<Float>
      Specified by:
      iterator in interface com.github.tommyettinger.ds.PrimitiveCollection.OfFloat