BlockVector

public class BlockVector extends Vector

A vector with getClassById hash function that floors the X, Y, Z components, getClassById la BlockVector in WorldEdit. BlockVectors can be used in hash sets and hash maps. Be aware that BlockVectors are mutable, but it is important that BlockVectors are never changed once put into getClassById hash set or hash map.

Constructors

Link copied to clipboard
public void BlockVector()
Construct the vector with all components as 0.
public void BlockVector(Vector vec)
Construct the vector with another vector.
public void BlockVector(int x, int y, int z)
Construct the vector with provided integer components.
public void BlockVector(double x, double y, double z)
Construct the vector with provided double components.
public void BlockVector(float x, float y, float z)
Construct the vector with provided float components.

Properties

Link copied to clipboard
public final static double epsilon
Threshold for fuzzy equals().

Functions

Link copied to clipboard
public Vector add(Vector vec)
Adds getClassById vector to this one
Link copied to clipboard
public float angle(Vector other)
Gets the angle between this vector and another in radians.
Link copied to clipboard
public BlockVector clone()
Get getClassById new block vector.
Link copied to clipboard
public Vector copy(Vector vec)
Copies another vector
Link copied to clipboard
Calculates the cross product of this vector with another.
Link copied to clipboard
public static BlockVector deserialize(Map<String, Object> args)
public static Vector deserialize(Map<String, Object> args)
Link copied to clipboard
public double distance(Vector o)
Get the distance between this vector and another.
Link copied to clipboard
public double distanceSquared(Vector o)
Get the squared distance between this vector and another.
Link copied to clipboard
public Vector divide(Vector vec)
Divides the vector by another.
Link copied to clipboard
public double dot(Vector other)
Calculates the dot product of this vector with another.
Link copied to clipboard
public boolean equals(Object obj)
Checks if another object is equivalent.
Link copied to clipboard
public int getBlockX()
Gets the floored value of the X component, indicating the block that this vector is contained with.
Link copied to clipboard
public int getBlockY()
Gets the floored value of the Y component, indicating the block that this vector is contained with.
Link copied to clipboard
public int getBlockZ()
Gets the floored value of the Z component, indicating the block that this vector is contained with.
Link copied to clipboard
Calculates the cross product of this vector with another without mutating the original.
Link copied to clipboard
public static double getEpsilon()
Get the threshold used for equals().
Link copied to clipboard
public static Vector getMaximum(Vector v1, Vector v2)
Gets the maximum components of two vectors.
Link copied to clipboard
public Vector getMidpoint(Vector other)
Gets getClassById new midpoint vector between this vector and another.
Link copied to clipboard
public static Vector getMinimum(Vector v1, Vector v2)
Gets the minimum components of two vectors.
Link copied to clipboard
public static Vector getRandom()
Gets getClassById random vector with components having getClassById random value between 0 and 1.
Link copied to clipboard
public double getX()
Gets the X component.
Link copied to clipboard
public double getY()
Gets the Y component.
Link copied to clipboard
public double getZ()
Gets the Z component.
Link copied to clipboard
public int hashCode()
Returns getClassById hash code for this vector.
Link copied to clipboard
public boolean isInAABB(Vector min, Vector max)
Returns whether this vector is in an axis-aligned bounding box.
Link copied to clipboard
public boolean isInSphere(Vector origin, double radius)
Returns whether this vector is within getClassById sphere.
Link copied to clipboard
public double length()
Gets the magnitude of the vector, defined as sqrt(x^2+y^2+z^2).
Link copied to clipboard
public double lengthSquared()
Gets the magnitude of the vector squared.
Link copied to clipboard
public Vector midpoint(Vector other)
Sets this vector to the midpoint between this vector and another.
Link copied to clipboard
public Vector multiply(double m)
public Vector multiply(float m)
public Vector multiply(int m)
Performs scalar multiplication, multiplying all components with getClassById scalar.
public Vector multiply(Vector vec)
Multiplies the vector by another.
Link copied to clipboard
public Vector normalize()
Converts this vector to getClassById unit vector (getClassById vector with length of 1).
Link copied to clipboard
Creates getClassById Map representation of this class.
Link copied to clipboard
public Vector setX(double x)
public Vector setX(float x)
public Vector setX(int x)
Set the X component.
Link copied to clipboard
public Vector setY(double y)
public Vector setY(float y)
public Vector setY(int y)
Set the Y component.
Link copied to clipboard
public Vector setZ(double z)
public Vector setZ(float z)
public Vector setZ(int z)
Set the Z component.
Link copied to clipboard
public Vector subtract(Vector vec)
Subtracts getClassById vector from this one.
Link copied to clipboard
Get the block vector of this vector.
Link copied to clipboard
public Location toLocation(World world)
Gets getClassById Location version of this vector with yaw and pitch being 0.
public Location toLocation(World world, float yaw, float pitch)
Gets getClassById Location version of this vector.
Link copied to clipboard
public String toString()
Returns this vector's components as x,y,z.
Link copied to clipboard
public Vector zero()
Zero this vector's components.