Class AABB.Vec3D
java.lang.Object
studio.magemonkey.fabled.api.target.AABB.Vec3D
- Direct Known Subclasses:
AABB.Ray3D
- Enclosing class:
AABB
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AABB.Vec3D
Point with the coordinate (1, 1, 1).final double
X coordinate.final double
Y coordinate.final double
Z coordinate. -
Constructor Summary
ConstructorsConstructorDescriptionVec3D
(double x, double y, double z) Creates a new vector with the given coordinates.Vec3D
(AABB.Vec3D v) Creates a new vector with the coordinates of the given vector. -
Method Summary
Modifier and TypeMethodDescriptionfinal AABB.Vec3D
add
(AABB.Vec3D v) Add vector v and returns result as new vector.boolean
static AABB.Vec3D
fromLocation
(org.bukkit.Location loc) Construct a vector from a Bukkit location.static AABB.Vec3D
fromVector
(org.bukkit.util.Vector v) Construct a copy of our immutable vector from Bukkit's mutable vector.int
hashCode()
Normalizes the vector so that its magnitude = 1.scale
(double s) Scales vector uniformly and returns result as new vector.toString()
-
Field Details
-
UNIT_MAX
Point with the coordinate (1, 1, 1). -
x
public final double xX coordinate. -
y
public final double yY coordinate. -
z
public final double zZ coordinate.
-
-
Constructor Details
-
Vec3D
public Vec3D(double x, double y, double z) Creates a new vector with the given coordinates.- Parameters:
x
- the xy
- the yz
- the z
-
Vec3D
Creates a new vector with the coordinates of the given vector.- Parameters:
v
- vector to copy.
-
-
Method Details
-
fromLocation
Construct a vector from a Bukkit location.- Parameters:
loc
- - the Bukkit location.
-
fromVector
Construct a copy of our immutable vector from Bukkit's mutable vector.- Parameters:
v
- - Bukkit vector.- Returns:
- A copy of the given vector.
-
add
Add vector v and returns result as new vector.- Parameters:
v
- vector to add- Returns:
- result as new vector
-
scale
Scales vector uniformly and returns result as new vector.- Parameters:
s
- scale factor- Returns:
- new vector
-
normalize
Normalizes the vector so that its magnitude = 1.- Returns:
- The normalized vector.
-
equals
-
hashCode
public int hashCode() -
toString
-