Class Vector<V extends Vector<V>>
java.lang.Object
dev.prozilla.pine.common.math.vector.Vector<V>
- Direct Known Subclasses:
VectorFloat,VectorInt
Abstract class for vectors.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract VAdds another vector to this vector.abstract Vclone()Returns a new object that is equal to this object.divide(float scalar) Divides this vector by a scalar.booleanabstract booleanChecks if the given object is equal to this object.inthashCode()abstract booleanisZero()abstract floatlength()Calculates the length of this vector.Calculates a linear interpolation between this vector with another vector.negate()Negates this vector.Normalizes this vector.protected static Float[]parseToFloats(String input) protected static Float[]parseToFloats(String input, int count) protected static Integer[]parseToIntegers(String input) protected static Integer[]parseToIntegers(String input, int count) protected static <T> T[]parseToNumbers(String input, Function<String, T> parser, Class<T> type) abstract Vscale(float scalar) Scales this vector by a scalar.abstract VSubtracts another vector from this vector.abstract @NotNull StringtoString()Converts this vector to a string representation.
-
Constructor Details
-
Vector
public Vector()
-
-
Method Details
-
length
public abstract float length()Calculates the length of this vector. -
normalize
Normalizes this vector.- Returns:
- Self.
-
add
Adds another vector to this vector.- Returns:
- Self
-
negate
Negates this vector.- Returns:
- Self
-
subtract
Subtracts another vector from this vector.- Returns:
- Self
-
scale
Scales this vector by a scalar.- Returns:
- Self
-
divide
Divides this vector by a scalar.- Returns:
- Self
-
lerp
Calculates a linear interpolation between this vector with another vector.- Parameters:
alpha- The alpha value, in the range of0fand1f- Returns:
- Self
-
isZero
public abstract boolean isZero() -
equals
-
hashCode
public int hashCode() -
equals
Description copied from interface:CloneableChecks if the given object is equal to this object. -
clone
Description copied from interface:CloneableReturns a new object that is equal to this object. -
toString
Converts this vector to a string representation. -
parseToNumbers
protected static <T> T[] parseToNumbers(String input, Function<String, T> parser, Class<T> type) throws InvalidStringException- Throws:
InvalidStringException
-
parseToFloats
protected static Float[] parseToFloats(String input, int count) throws InvalidStringException, InvalidArrayException -
parseToFloats
- Throws:
InvalidStringException
-
parseToIntegers
protected static Integer[] parseToIntegers(String input, int count) throws InvalidStringException, InvalidArrayException -
parseToIntegers
- Throws:
InvalidStringException
-