Interface PointNInt<P extends PointNInt<P,R>, R extends com.github.tommyettinger.crux.PointN<?>>

Type Parameters:
P - should be the subclassing type itself
R - should be a wildcard-generic type for a sub-interface of PointN, such as Point3<?>
All Superinterfaces:
com.github.tommyettinger.crux.PointN<P>, com.github.tommyettinger.crux.PointNInt<P,R>
All Known Implementing Classes:
Coord, Point2Int, Point3Int, Point4Int, Point5Int, Point6Int

public interface PointNInt<P extends PointNInt<P,R>, R extends com.github.tommyettinger.crux.PointN<?>> extends com.github.tommyettinger.crux.PointNInt<P,R>
Groups functionality common to points with int components, in any dimension.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
     
    int
    get(int index)
    Gets the component at the specified index.
    default P
    interpolate(R target, float alpha, com.github.tommyettinger.digital.Interpolations.Interpolator interpolation)
    Calls lerp(PointN, float) with the alpha determined by the given interpolation.
    lerp(R target, float alpha)
    Linear-interpolates from this point toward target, moving a distance proportional to alpha and changing this point in-place if possible.
    setAt(int index, int value)
    Sets the component at the specified index to the specified value.

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

    add, cpy, div, divide, dst, dst2, isUnit, isUnit, isZero, isZero, len, len2, minus, mutable, nor, plus, rank, scl, set, setZero, sub, times
  • Method Details

    • floatingPoint

      default boolean floatingPoint()
      Specified by:
      floatingPoint in interface com.github.tommyettinger.crux.PointN<P extends PointNInt<P,R>>
      Specified by:
      floatingPoint in interface com.github.tommyettinger.crux.PointNInt<P extends PointNInt<P,R>, R extends com.github.tommyettinger.crux.PointN<?>>
    • get

      int 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.PointNInt<P extends PointNInt<P,R>, R extends com.github.tommyettinger.crux.PointN<?>>
      Parameters:
      index - which component to get, in order
      Returns:
      the component
    • setAt

      P setAt(int index, int value)
      Sets the component at the specified index to the specified value.
      Specified by:
      setAt in interface com.github.tommyettinger.crux.PointNInt<P extends PointNInt<P,R>, R extends com.github.tommyettinger.crux.PointN<?>>
      Parameters:
      index - which component to set, in order
      value - the value to assign at index
      Returns:
      this, for chaining
    • lerp

      P lerp(R target, float alpha)
      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.PointNInt<P extends PointNInt<P,R>, R extends com.github.tommyettinger.crux.PointN<?>>
      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 PointNInt if this is immutable
    • interpolate

      default P interpolate(R target, float alpha, com.github.tommyettinger.digital.Interpolations.Interpolator interpolation)
      Calls lerp(PointN, float) with the alpha determined by the given interpolation. Simply returns lerp(target, interpolation.apply(alpha)) .
      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 PointNInt if this is immutable