-
- All Implemented Interfaces:
public final class Vec22D Vectors class
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classVec2.Companion
-
Method Summary
Modifier and Type Method Description final Vec2getNormalized()final BooleangetIsValid()final BooleangetIsZero()final DoublegetX()final UnitsetX(Double x)final DoublegetY()final UnitsetY(Double y)final Vec2set(Double x, Double y)Sets a vector to equal an x/y value and returns this. final Vec2set(Vec2 v1)Sets a vector to another vector and returns this. final Vec2copy()Copy method to return a new copy of the current instance vector. final Vec2unaryMinus()Negates the current instance vector and return this. final Vec2copyNegative()Negates the current instance vector and return this. final Vec2add(Vec2 v)Adds a vector to the current instance and return this. final Vec2plus(Vec2 v)Adds a vector and the current instance vector together and returns a new vector of them added together. final Vec2normal()Generates a normal of a vector. final Vec2normalize()Normalizes the current instance vector to length 1 and returns this. final Doubledistance(Vec2 v)Finds the distance between two vectors. final Vec2minus(Vec2 v1)Subtract a vector from the current instance vector. final Doublecross(Vec2 v1)Finds cross product between two vectors. final Vec2cross(Double a)final Vec2scalar(Double a)final Doubledot(Vec2 v1)Finds dotproduct between two vectors. final Doublelength()Gets the length of instance vector. StringtoString()Booleanequals(Object other)-
-
Method Detail
-
getNormalized
final Vec2 getNormalized()
-
getIsValid
final Boolean getIsValid()
-
set
final Vec2 set(Double x, Double y)
Sets a vector to equal an x/y value and returns this.
- Parameters:
x- x value.y- y value.
-
set
final Vec2 set(Vec2 v1)
Sets a vector to another vector and returns this.
- Parameters:
v1- Vector to set x/y values to.
-
unaryMinus
final Vec2 unaryMinus()
Negates the current instance vector and return this.
-
copyNegative
final Vec2 copyNegative()
Negates the current instance vector and return this.
-
add
final Vec2 add(Vec2 v)
Adds a vector to the current instance and return this.
- Parameters:
v- Vector to add.
-
plus
final Vec2 plus(Vec2 v)
Adds a vector and the current instance vector together and returns a new vector of them added together.
- Parameters:
v- Vector to add.
-
normal
final Vec2 normal()
Generates a normal of a vector. Normal facing to the right clock wise 90 degrees.
-
normalize
final Vec2 normalize()
Normalizes the current instance vector to length 1 and returns this.
-
distance
final Double distance(Vec2 v)
Finds the distance between two vectors.
- Parameters:
v- Vector to find distance from.
-
minus
final Vec2 minus(Vec2 v1)
Subtract a vector from the current instance vector.
- Parameters:
v1- Vector to subtract.
-
cross
final Double cross(Vec2 v1)
Finds cross product between two vectors.
- Parameters:
v1- Other vector to apply cross product to
-
dot
final Double dot(Vec2 v1)
Finds dotproduct between two vectors.
- Parameters:
v1- Other vector to apply dotproduct to.
-
-
-
-