com.bergerkiller.bukkit.common.math

## Class Vector3

• java.lang.Object
• com.bergerkiller.bukkit.common.math.Vector3
• Direct Known Subclasses:
Vector3f

```public class Vector3
extends java.lang.Object```
• ### Field Summary

Fields
Modifier and Type Field and Description
`double` `x`
`double` `y`
`double` `z`
• ### Constructor Summary

Constructors
Constructor and Description
`Vector3()`
```Vector3(double x, double y, double z)```
`Vector3(org.bukkit.util.Vector vector)`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static Vector3` ```add(Vector3 v1, Vector3 v2)```
`static Vector3` ```average(Vector3 v1, Vector3 v2)```
Returns the vector average of two vectors ((v1 + v2) / 2)
`Vector3` `clone()`
`static Vector3` ```cross(Vector3 v1, Vector3 v2)```
Returns the cross product of two vectors
`double` `distanceSquared(Vector3 v)`
`static double` ```dot(Vector3 v1, Vector3 v2)```
Returns the vector dot product of two vectors (v1 .
`boolean` `equals(Vector3 p)`
`Vector2` `getXY()`
`Vector2` `getXZ()`
`Vector3` `negate()`
Returns a new vector with the x/y/z values inverted.
`Vector3` `normalize()`
Returns a new normalized vector of this vector (length = 1)
`static Vector3` ```subtract(Vector3 v1, Vector3 v2)```
Returns the vector subtraction of two vectors (v1 - v2)
`java.lang.String` `toString()`
• ### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`
• ### Field Detail

• #### x

`public double x`
• #### y

`public double y`
• #### z

`public double z`
• ### Constructor Detail

• #### Vector3

`public Vector3()`
• #### Vector3

`public Vector3(org.bukkit.util.Vector vector)`
• #### Vector3

```public Vector3(double x,
double y,
double z)```
• ### Method Detail

• #### getXY

`public Vector2 getXY()`
• #### getXZ

`public Vector2 getXZ()`
• #### negate

`public Vector3 negate()`
Returns a new vector with the x/y/z values inverted.
Returns:
negated vector
• #### normalize

`public Vector3 normalize()`
Returns a new normalized vector of this vector (length = 1)
Returns:
normalized vector
• #### distanceSquared

`public double distanceSquared(Vector3 v)`
• #### clone

`public Vector3 clone()`
Overrides:
`clone` in class `java.lang.Object`
• #### toString

`public java.lang.String toString()`
Overrides:
`toString` in class `java.lang.Object`
• #### equals

`public boolean equals(Vector3 p)`
• #### cross

```public static Vector3 cross(Vector3 v1,
Vector3 v2)```
Returns the cross product of two vectors
Parameters:
`v1` - first vector
`v2` - second vector
Returns:
cross product
• #### subtract

```public static Vector3 subtract(Vector3 v1,
Vector3 v2)```
Returns the vector subtraction of two vectors (v1 - v2)
Parameters:
`v1` -
`v2` -
Returns:
subtracted vector

```public static Vector3 add(Vector3 v1,
Vector3 v2)```
• #### average

```public static Vector3 average(Vector3 v1,
Vector3 v2)```
Returns the vector average of two vectors ((v1 + v2) / 2)
Parameters:
`v1` -
`v2` -
Returns:
average vector
• #### dot

```public static double dot(Vector3 v1,
Vector3 v2)```
Returns the vector dot product of two vectors (v1 . v2)
Parameters:
`v1` -
`v2` -
Returns:
vector dot product