Class Point6Float
java.lang.Object
com.github.yellowstonegames.grid.Point6Float
- All Implemented Interfaces:
com.github.tommyettinger.crux.Point6<Point6Float>, com.github.tommyettinger.crux.PointN<Point6Float>, com.github.tommyettinger.crux.PointNFloat<Point6Float, com.github.tommyettinger.crux.Point6<?>>, com.github.tommyettinger.ds.PrimitiveCollection<Float>, com.github.tommyettinger.ds.PrimitiveCollection.OfFloat, PointNFloat<Point6Float, com.github.tommyettinger.crux.Point6<?>>
public class Point6Float
extends Object
implements com.github.tommyettinger.crux.Point6<Point6Float>, PointNFloat<Point6Float, com.github.tommyettinger.crux.Point6<?>>, com.github.tommyettinger.ds.PrimitiveCollection.OfFloat
A mutable 6D point with float components implementing
Point6, 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 -
Constructor Summary
ConstructorsConstructorDescriptionPoint6Float(float x, float y, float z, float w, float u, float v) Point6Float(com.github.tommyettinger.crux.Point6<?> p) -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(float c) Not supported; this collection is fixed-size.add(float x, float y, float z, float w, float u, float v) add(com.github.tommyettinger.crux.Point6<?> point) add(Point6Float point) addProduct(com.github.tommyettinger.crux.Point6<?> vec, float scalar) addProduct(com.github.tommyettinger.crux.Point6<?> vec, com.github.tommyettinger.crux.Point6<?> mulVec) clampEach(float min, float 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(float c) Comparescwith the components of this collection using==; if any are considered equal, this returns true.copy()cpy()floatdistance(com.github.tommyettinger.crux.Point6<?> point) floatdistanceSquared(com.github.tommyettinger.crux.Point6<?> point) div(com.github.tommyettinger.crux.Point6<?> point) div(Point6Float point) divide(float scalar) divide(com.github.tommyettinger.crux.Point6<?> point) floatdot(com.github.tommyettinger.crux.Point6<?> other) static floatdot(com.github.tommyettinger.crux.Point6<?> a, com.github.tommyettinger.crux.Point6<?> b) floatdst2(com.github.tommyettinger.crux.Point6<?> point) floatdst2(Point6Float point) booleanbooleanReturns true if this type of point usesfloatordoublefor its components, or false otherwise.fract()Sets each component so it only has a fractional value, by subtracting the floor from each component.fromString(String s) Sets thisPoint6Floatto the value represented by the specified string according to the format oftoString().floatget(int index) Gets the component at the specified index.inthashCode()interpolate(com.github.tommyettinger.crux.Point6<?> target, float alpha, com.github.tommyettinger.digital.Interpolations.Interpolator interpolation) CallsPointNFloat.lerp(PointN, float)with the alpha determined by the giveninterpolation.inverse()Assigns to each component of this point1fdivided by its original value.booleanisEmpty()iterator()floatlen2()lerp(com.github.tommyettinger.crux.Point6<?> 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, float v) Multiplies each component of this by the corresponding scalar, in-place, and returns this.mul(com.github.tommyettinger.crux.Point6<?> point) mul(Point6Float point) mulAdd(com.github.tommyettinger.crux.Point6<?> vec, float scalar) mulAdd(com.github.tommyettinger.crux.Point6<?> vec, com.github.tommyettinger.crux.Point6<?> 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, float v) Multiplies each component of this by the corresponding scalar, in-place, and returns this.multiply(com.github.tommyettinger.crux.Point6<?> point) nor()booleannotEmpty()plus(float scalar) booleanremove(float c) Not supported; this collection is fixed-size.scale(float scalar) scale(float x, float y, float z, float w, float u, float v) scale(com.github.tommyettinger.crux.Point6<?> point) scl(float x, float y, float z, float w, float u, float v) scl(com.github.tommyettinger.crux.Point6<?> point) scl(Point6Float point) set(float x, float y, float z, float w, float u, float v) set(com.github.tommyettinger.crux.Point6<?> point) set(Point6Float point) setAt(int index, float value) Sets the component at the specified index to the specified value.setLength(float len) setLength2(float len2) setToRandomDirection(Random random) Sets this PointNFloat to a randomly chosen unit vector.setZero()intsize()slerpGeometric(Point6Float target, float alpha) sub(float x, float y, float z, float w, float u, float v) sub(com.github.tommyettinger.crux.Point6<?> point) sub(Point6Float point) subtract(float x, float y, float z, float w, float u, float v) subtract(com.github.tommyettinger.crux.Point6<?> point) times(float scalar) toString()Converts thisPoint6Floatto a string in the format(x,y,z,w,u,v).floatu()u(float next) floatv()v(float next) floatw()w(float next) floatx()x(float next) floaty()y(float next) floatz()z(float next) Methods inherited from interface com.github.tommyettinger.crux.Point6
rank, seti, ui, ui, vi, vi, wi, wi, xi, xi, yi, yi, zi, ziMethods inherited from interface com.github.tommyettinger.crux.PointN
dst, isUnit, isUnit, isZero, isZero, len, mutableMethods 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 -
v
public float v
-
-
Constructor Details
-
Point6Float
public Point6Float() -
Point6Float
public Point6Float(float x, float y, float z, float w, float u, float v) -
Point6Float
-
Point6Float
public Point6Float(com.github.tommyettinger.crux.Point6<?> 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<Point6Float>- Specified by:
floatingPointin interfacecom.github.tommyettinger.crux.PointNFloat<Point6Float, com.github.tommyettinger.crux.Point6<?>>- Specified by:
floatingPointin interfacePointNFloat<Point6Float, com.github.tommyettinger.crux.Point6<?>>- Returns:
- false
-
cpy
- Specified by:
cpyin interfacecom.github.tommyettinger.crux.PointN<Point6Float>
-
copy
-
len2
public float len2()- Specified by:
len2in interfacecom.github.tommyettinger.crux.PointN<Point6Float>
-
set
- Specified by:
setin interfacecom.github.tommyettinger.crux.PointN<Point6Float>
-
set
-
sub
- Specified by:
subin interfacecom.github.tommyettinger.crux.PointN<Point6Float>
-
sub
-
subtract
-
add
- Specified by:
addin interfacecom.github.tommyettinger.crux.PointN<Point6Float>
-
add
-
scl
- Specified by:
sclin interfacecom.github.tommyettinger.crux.PointN<Point6Float>
-
scl
-
scale
-
mul
-
mul
-
multiply
-
div
- Specified by:
divin interfacecom.github.tommyettinger.crux.PointN<Point6Float>
-
div
-
divide
-
dst2
- Specified by:
dst2in interfacecom.github.tommyettinger.crux.PointN<Point6Float>
-
dst2
public float dst2(com.github.tommyettinger.crux.Point6<?> point) -
distance
public float distance(com.github.tommyettinger.crux.Point6<?> point) -
distanceSquared
public float distanceSquared(com.github.tommyettinger.crux.Point6<?> point) -
setZero
- Specified by:
setZeroin interfacecom.github.tommyettinger.crux.PointN<Point6Float>
-
x
public float x()- Specified by:
xin interfacecom.github.tommyettinger.crux.Point6<Point6Float>
-
x
- Specified by:
xin interfacecom.github.tommyettinger.crux.Point6<Point6Float>
-
y
public float y()- Specified by:
yin interfacecom.github.tommyettinger.crux.Point6<Point6Float>
-
y
- Specified by:
yin interfacecom.github.tommyettinger.crux.Point6<Point6Float>
-
z
public float z()- Specified by:
zin interfacecom.github.tommyettinger.crux.Point6<Point6Float>
-
z
- Specified by:
zin interfacecom.github.tommyettinger.crux.Point6<Point6Float>
-
w
public float w()- Specified by:
win interfacecom.github.tommyettinger.crux.Point6<Point6Float>
-
w
- Specified by:
win interfacecom.github.tommyettinger.crux.Point6<Point6Float>
-
u
public float u()- Specified by:
uin interfacecom.github.tommyettinger.crux.Point6<Point6Float>
-
u
- Specified by:
uin interfacecom.github.tommyettinger.crux.Point6<Point6Float>
-
v
public float v()- Specified by:
vin interfacecom.github.tommyettinger.crux.Point6<Point6Float>
-
v
- Specified by:
vin interfacecom.github.tommyettinger.crux.Point6<Point6Float>
-
set
- Specified by:
setin interfacecom.github.tommyettinger.crux.Point6<Point6Float>
-
nor
- Specified by:
norin interfacecom.github.tommyettinger.crux.PointN<Point6Float>
-
normalize
-
add
-
sub
-
subtract
-
plus
- Specified by:
plusin interfacecom.github.tommyettinger.crux.PointN<Point6Float>
-
minus
- Specified by:
minusin interfacecom.github.tommyettinger.crux.PointN<Point6Float>
-
times
- Specified by:
timesin interfacecom.github.tommyettinger.crux.PointN<Point6Float>
-
scale
-
scl
-
scale
-
mul
Multiplies each component of this by the given scalar, in-place, and returns this. This is an alias fortimes(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 fortimes(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, 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, float, float).- Parameters:
x- a float that will be multiplied with xy- a float that will be multiplied with y- Returns:
- this, for chaining
-
divide
- Specified by:
dividein interfacecom.github.tommyettinger.crux.PointN<Point6Float>
-
addProduct
-
mulAdd
-
mulAdd
public Point6Float mulAdd(com.github.tommyettinger.crux.Point6<?> vec, com.github.tommyettinger.crux.Point6<?> mulVec) -
addProduct
public Point6Float addProduct(com.github.tommyettinger.crux.Point6<?> vec, com.github.tommyettinger.crux.Point6<?> mulVec) -
limit
-
limit2
-
limitSquared
-
clampLength
-
setLength
-
setLength2
-
dot
public float dot(com.github.tommyettinger.crux.Point6<?> other) -
dot
public static float dot(com.github.tommyettinger.crux.Point6<?> a, com.github.tommyettinger.crux.Point6<?> b) -
lerp
Description copied from interface:PointNFloatLinear-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.PointNFloat<Point6Float, com.github.tommyettinger.crux.Point6<?>>- Specified by:
lerpin interfacePointNFloat<Point6Float, com.github.tommyettinger.crux.Point6<?>>- 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 PointNFloat if this is immutable
-
interpolate
public Point6Float interpolate(com.github.tommyettinger.crux.Point6<?> target, float alpha, com.github.tommyettinger.digital.Interpolations.Interpolator interpolation) Description copied from interface:PointNFloatCallsPointNFloat.lerp(PointN, float)with the alpha determined by the giveninterpolation. Simply returnslerp(target, interpolation.apply(alpha)).- Specified by:
interpolatein interfacePointNFloat<Point6Float, com.github.tommyettinger.crux.Point6<?>>- 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 PointNFloat if this is immutable
-
slerpGeometric
-
setToRandomDirection
Description copied from interface:PointNFloatSets 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 callTrigTools.cosTurns(float)andTrigTools.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 usingDistributor.probitF(float)with random inputs, then normalize the PointNFloat withPointN.nor().- Specified by:
setToRandomDirectionin interfacePointNFloat<Point6Float, com.github.tommyettinger.crux.Point6<?>>- Parameters:
random- any Random or subclass thereof- Returns:
- this point after modifications, if possible, or a new PointNFloat 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
-
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 forMathTools.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
-
inverse
Assigns to each component of this point1fdivided 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:
inversein interfacecom.github.tommyettinger.crux.PointNFloat<Point6Float, com.github.tommyettinger.crux.Point6<?>>- Specified by:
inversein interfacePointNFloat<Point6Float, com.github.tommyettinger.crux.Point6<?>>- 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:
getin interfacecom.github.tommyettinger.crux.PointNFloat<Point6Float, com.github.tommyettinger.crux.Point6<?>>- Specified by:
getin interfacePointNFloat<Point6Float, com.github.tommyettinger.crux.Point6<?>>- Parameters:
index- which component to get, in order- Returns:
- the component
-
setAt
Sets the component at the specified index to the specified value.- Specified by:
setAtin interfacecom.github.tommyettinger.crux.PointNFloat<Point6Float, com.github.tommyettinger.crux.Point6<?>>- Specified by:
setAtin interfacePointNFloat<Point6Float, com.github.tommyettinger.crux.Point6<?>>- Parameters:
index- which component to set, in ordervalue- the value to assign at index- Returns:
- this, for chaining
-
equals
-
hashCode
-
toString
-
fromString
Sets thisPoint6Floatto 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(float c) Not supported; this collection is fixed-size.- Specified by:
addin interfacecom.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:
removein interfacecom.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:
clearin interfacecom.github.tommyettinger.ds.PrimitiveCollection<Float>- Throws:
UnsupportedOperationException- always
-
contains
public boolean contains(float c) Comparescwith the components of this collection using==; if any are considered equal, this returns true.- Specified by:
containsin interfacecom.github.tommyettinger.ds.PrimitiveCollection.OfFloat- Parameters:
c- a float 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<Float>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfacecom.github.tommyettinger.ds.PrimitiveCollection<Float>
-
notEmpty
public boolean notEmpty()- Specified by:
notEmptyin interfacecom.github.tommyettinger.ds.PrimitiveCollection<Float>
-
iterator
- Specified by:
iteratorin interfacecom.github.tommyettinger.ds.PrimitiveCollection<Float>- Specified by:
iteratorin interfacecom.github.tommyettinger.ds.PrimitiveCollection.OfFloat
-