Class Point4Int
java.lang.Object
com.github.yellowstonegames.grid.Point4Int
- All Implemented Interfaces:
com.github.tommyettinger.crux.Point4<Point4Int>, com.github.tommyettinger.crux.PointN<Point4Int>, com.github.tommyettinger.crux.PointNInt<Point4Int, com.github.tommyettinger.crux.Point4<?>>, com.github.tommyettinger.ds.PrimitiveCollection<Integer>, com.github.tommyettinger.ds.PrimitiveCollection.OfInt, PointNInt<Point4Int, com.github.tommyettinger.crux.Point4<?>>
public class Point4Int
extends Object
implements com.github.tommyettinger.crux.Point4<Point4Int>, PointNInt<Point4Int, com.github.tommyettinger.crux.Point4<?>>, com.github.tommyettinger.ds.PrimitiveCollection.OfInt
A mutable 4D point with int components implementing
Point4, PrimitiveCollection.OfInt,
and PointNInt.-
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(float x, float y, float z, float w) booleanadd(int c) Not supported; this collection is fixed-size.add(int x, int y, int z, int w) add(com.github.tommyettinger.crux.Point4<?> point) addProduct(com.github.tommyettinger.crux.Point4<?> vec, float scalar) addProduct(com.github.tommyettinger.crux.Point4<?> vec, com.github.tommyettinger.crux.Point4<?> mulVec) clampEach(int min, int max) For each component, this clamps it between min and max, inclusive.clampLength(float min, float max) voidclear()Not supported; this collection is fixed-size.booleancontains(int c) Comparescwith the components of this collection using==; if any are considered equal, this returns true.copy()cpy()floatdistance(com.github.tommyettinger.crux.Point4<?> point) intdistanceSquared(com.github.tommyettinger.crux.Point4<?> point) divide(float scalar) floatdot(com.github.tommyettinger.crux.Point4<?> other) static floatdot(com.github.tommyettinger.crux.Point4<?> a, com.github.tommyettinger.crux.Point4<?> b) intdst2(com.github.tommyettinger.crux.Point4<?> point) floatbooleanbooleanReturns true if this type of point usesfloatordoublefor its components, or false otherwise.fromString(String s) Sets thisPoint4Intto the value represented by the specified string according to the format oftoString().intget(int index) Gets the component at the specified index.inthashCode()interpolate(com.github.tommyettinger.crux.Point4<?> target, float alpha, com.github.tommyettinger.digital.Interpolations.Interpolator interpolation) CallsPointNInt.lerp(PointN, float)with the alpha determined by the giveninterpolation.booleanisEmpty()iterator()floatlen2()lerp(com.github.tommyettinger.crux.Point4<?> 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) Multiplies each component of this by the corresponding scalar, in-place, and returns this.mul(int scalar) Multiplies each component of this by the given scalar, in-place, and returns this.mul(int x, int y, int z, int w) Multiplies each component of this by the corresponding scalar, in-place, and returns this.mul(com.github.tommyettinger.crux.Point4<?> point) mulAdd(com.github.tommyettinger.crux.Point4<?> vec, float scalar) mulAdd(com.github.tommyettinger.crux.Point4<?> vec, com.github.tommyettinger.crux.Point4<?> 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) Multiplies each component of this by the corresponding scalar, in-place, and returns this.multiply(int scalar) Multiplies each component of this by the given scalar, in-place, and returns this.multiply(int x, int y, int z, int w) Multiplies each component of this by the corresponding scalar, in-place, and returns this.multiply(com.github.tommyettinger.crux.Point4<?> point) booleannotEmpty()plus(float scalar) booleanremove(int c) Not supported; this collection is fixed-size.scale(float scalar) scale(float x, float y, float z, float w) scale(int scalar) scale(int x, int y, int z, int w) scale(com.github.tommyettinger.crux.Point4<?> point) scl(float scalar) scl(float x, float y, float z, float w) scl(int scalar) scl(int x, int y, int z, int w) scl(com.github.tommyettinger.crux.Point4<?> point) set(float x, float y, float z, float w) set(int x, int y, int z, int w) set(com.github.tommyettinger.crux.Point4<?> point) setAt(int index, int value) Sets the component at the specified index to the specified value.setLength(float len) setLength2(float len2) setZero()intsize()sub(float x, float y, float z, float w) sub(int x, int y, int z, int w) sub(com.github.tommyettinger.crux.Point4<?> point) subtract(float x, float y, float z, float w) subtract(int x, int y, int z, int w) subtract(com.github.tommyettinger.crux.Point4<?> point) times(float scalar) toString()Converts thisPoint4Intto a string in the format(x,y,z,w).floatw()w(float next) intwi()wi(int next) floatx()x(float next) intxi()xi(int next) floaty()y(float next) intyi()yi(int next) floatz()z(float next) intzi()zi(int next) Methods inherited from interface com.github.tommyettinger.crux.Point4
rank, setiMethods inherited from interface com.github.tommyettinger.crux.PointN
dst, isUnit, isUnit, isZero, isZero, len, mutable, norMethods inherited from interface com.github.tommyettinger.ds.PrimitiveCollection.OfInt
addAll, addAll, addAll, addAll, addDense, addDense, addLegible, addLegible, addVarargs, appendTo, appendTo, containsAll, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, containsAny, denseAppendTo, equalContents, 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 int x -
y
public int y -
z
public int z -
w
public int w
-
-
Constructor Details
-
Point4Int
public Point4Int() -
Point4Int
public Point4Int(int x, int y, int z, int w) -
Point4Int
-
Point4Int
public Point4Int(com.github.tommyettinger.crux.Point4<?> p)
-
-
Method Details
-
floatingPoint
public boolean floatingPoint()Returns true if this type of point usesfloatordoublefor its components, or false otherwise. This always returns false.- Specified by:
floatingPointin interfacecom.github.tommyettinger.crux.PointN<Point4Int>- Specified by:
floatingPointin interfacecom.github.tommyettinger.crux.PointNInt<Point4Int, com.github.tommyettinger.crux.Point4<?>>- Specified by:
floatingPointin interfacePointNInt<Point4Int, com.github.tommyettinger.crux.Point4<?>>- Returns:
- false
-
cpy
-
copy
-
len2
public float len2()- Specified by:
len2in interfacecom.github.tommyettinger.crux.PointN<Point4Int>
-
set
-
set
-
sub
-
sub
-
subtract
-
add
-
add
-
scl
-
scl
-
scale
-
mul
-
mul
-
multiply
-
dst2
-
dst2
public int dst2(com.github.tommyettinger.crux.Point4<?> point) -
distance
public float distance(com.github.tommyettinger.crux.Point4<?> point) -
distanceSquared
public int distanceSquared(com.github.tommyettinger.crux.Point4<?> point) -
setZero
-
x
public float x()- Specified by:
xin interfacecom.github.tommyettinger.crux.Point4<Point4Int>
-
x
-
xi
public int xi()- Specified by:
xiin interfacecom.github.tommyettinger.crux.Point4<Point4Int>
-
xi
-
y
public float y()- Specified by:
yin interfacecom.github.tommyettinger.crux.Point4<Point4Int>
-
y
-
yi
public int yi()- Specified by:
yiin interfacecom.github.tommyettinger.crux.Point4<Point4Int>
-
yi
-
z
public float z()- Specified by:
zin interfacecom.github.tommyettinger.crux.Point4<Point4Int>
-
z
-
zi
public int zi()- Specified by:
ziin interfacecom.github.tommyettinger.crux.Point4<Point4Int>
-
zi
-
w
public float w()- Specified by:
win interfacecom.github.tommyettinger.crux.Point4<Point4Int>
-
w
-
wi
public int wi()- Specified by:
wiin interfacecom.github.tommyettinger.crux.Point4<Point4Int>
-
wi
-
set
-
set
-
add
-
sub
-
subtract
-
scl
-
scale
-
scl
-
scale
-
mul
Multiplies each component of this by the given scalar, in-place, and returns this. This is an alias forscl(float).- Parameters:
scalar- a float that will be multiplied with each component- Returns:
- this, for chaining
-
multiply
Multiplies each component of this by the given scalar, in-place, and returns this. This is an alias forscl(float).- Parameters:
scalar- a float that will be multiplied with each component- Returns:
- this, for chaining
-
mul
Multiplies each component of this by the corresponding scalar, in-place, and returns this. This is an alias forscl(float, float, float, float).- Parameters:
x- a float that will be multiplied with xy- a float that will be multiplied with y- Returns:
- this, for chaining
-
multiply
Multiplies each component of this by the corresponding scalar, in-place, and returns this. This is an alias forscl(float, float, float, float).- Parameters:
x- a float that will be multiplied with xy- a float that will be multiplied with y- Returns:
- this, for chaining
-
add
-
sub
-
subtract
-
plus
-
minus
-
times
-
scl
-
scale
-
scl
-
scale
-
mul
-
multiply
-
mul
Multiplies each component of this by the corresponding scalar, in-place, and returns this. This is an alias forscl(int, int, int, int).- Parameters:
x- an int that will be multiplied with xy- an int that will be multiplied with y- Returns:
- this, for chaining
-
multiply
Multiplies each component of this by the corresponding scalar, in-place, and returns this. This is an alias forscl(int, int, int, int).- Parameters:
x- an int that will be multiplied with xy- an int that will be multiplied with y- Returns:
- this, for chaining
-
div
-
divide
-
addProduct
-
mulAdd
-
mulAdd
public Point4Int mulAdd(com.github.tommyettinger.crux.Point4<?> vec, com.github.tommyettinger.crux.Point4<?> mulVec) -
addProduct
public Point4Int addProduct(com.github.tommyettinger.crux.Point4<?> vec, com.github.tommyettinger.crux.Point4<?> mulVec) -
limit
-
limit2
-
limitSquared
-
clampLength
-
setLength
-
setLength2
-
dot
public float dot(com.github.tommyettinger.crux.Point4<?> other) -
dot
public static float dot(com.github.tommyettinger.crux.Point4<?> a, com.github.tommyettinger.crux.Point4<?> b) -
lerp
Description copied from interface:PointNIntLinear-interpolates from this point toward target, moving a distance proportional to alpha and changing this point in-place if possible. If this point is notPointN.mutable(), this will return a new or pooled point. The alpha is expected to be in the 0 to 1 range, inclusive.- Specified by:
lerpin interfacecom.github.tommyettinger.crux.PointNInt<Point4Int, com.github.tommyettinger.crux.Point4<?>>- Specified by:
lerpin interfacePointNInt<Point4Int, com.github.tommyettinger.crux.Point4<?>>- Parameters:
target- any point with the same dimension to move towardalpha- between 0 and 1, inclusive- Returns:
- this point after modifications, if possible, or a new PointNInt if this is immutable
-
interpolate
public Point4Int interpolate(com.github.tommyettinger.crux.Point4<?> target, float alpha, com.github.tommyettinger.digital.Interpolations.Interpolator interpolation) Description copied from interface:PointNIntCallsPointNInt.lerp(PointN, float)with the alpha determined by the giveninterpolation. Simply returnslerp(target, interpolation.apply(alpha)).- Specified by:
interpolatein interfacePointNInt<Point4Int, com.github.tommyettinger.crux.Point4<?>>- Parameters:
target- any point with the same dimension to move towardalpha- between 0 and 1, inclusiveinterpolation- an Interpolator from digital, such asInterpolations.smooth- Returns:
- this point after modifications, if possible, or a new PointNInt if this is immutable
-
clampEach
For each component, this clamps it between min and max, inclusive.- Parameters:
min- the minimum value allowable for any component, inclusivemax- the maximum value allowable for any component, inclusive- Returns:
- this, after modifications
-
get
public int get(int index) Gets the component at the specified index. Kotlin-compatible using square-bracket indexing. -
setAt
Sets the component at the specified index to the specified value.- Specified by:
setAtin interfacecom.github.tommyettinger.crux.PointNInt<Point4Int, com.github.tommyettinger.crux.Point4<?>>- Specified by:
setAtin interfacePointNInt<Point4Int, com.github.tommyettinger.crux.Point4<?>>- Parameters:
index- which component to set, in ordervalue- the value to assign at index- Returns:
- this, for chaining
-
equals
-
hashCode
-
toString
-
fromString
Sets thisPoint4Intto the value represented by the specified string according to the format oftoString().- Parameters:
s- the string.- Returns:
- this point for chaining
-
add
public boolean add(int c) Not supported; this collection is fixed-size.- Specified by:
addin interfacecom.github.tommyettinger.ds.PrimitiveCollection.OfInt- Parameters:
c- ignored- Returns:
- never returns
- Throws:
UnsupportedOperationException- always
-
remove
public boolean remove(int c) Not supported; this collection is fixed-size.- Specified by:
removein interfacecom.github.tommyettinger.ds.PrimitiveCollection.OfInt- Parameters:
c- ignored- Returns:
- never returns
- Throws:
UnsupportedOperationException- always
-
clear
public void clear()Not supported; this collection is fixed-size.- Specified by:
clearin interfacecom.github.tommyettinger.ds.PrimitiveCollection<Integer>- Throws:
UnsupportedOperationException- always
-
contains
public boolean contains(int c) Comparescwith the components of this collection using==; if any are considered equal, this returns true.- Specified by:
containsin interfacecom.github.tommyettinger.ds.PrimitiveCollection.OfInt- Parameters:
c- an int to be compared using==- Returns:
- true if any component of this collection is equal to
cvia==comparison
-
size
public int size()- Specified by:
sizein interfacecom.github.tommyettinger.ds.PrimitiveCollection<Integer>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfacecom.github.tommyettinger.ds.PrimitiveCollection<Integer>
-
notEmpty
public boolean notEmpty()- Specified by:
notEmptyin interfacecom.github.tommyettinger.ds.PrimitiveCollection<Integer>
-
iterator
- Specified by:
iteratorin interfacecom.github.tommyettinger.ds.PrimitiveCollection<Integer>- Specified by:
iteratorin interfacecom.github.tommyettinger.ds.PrimitiveCollection.OfInt
-