public class Vector3 extends Object
| Modifier and Type | Field and Description |
|---|---|
float |
X
Public members
|
float |
Y
Public members
|
float |
Z
Public members
|
| Constructor and Description |
|---|
Vector3()
Default constructor, sets x, y and z to 0
|
Vector3(float x,
float y,
float z)
Constructor with arguments
|
Vector3(Vector3 vector)
Constructor from another Vector3
|
| Modifier and Type | Method and Description |
|---|---|
static Vector3 |
cross(Vector3 v1,
Vector3 v2)
The cross product of two vectors
|
float |
distanceTo(Vector3 vectorTo)
Gets the distance to another Vector (as a point)
|
Vector3 |
divide(float scalar)
Returns the vector divided by the scalar
|
static float |
dot(Vector3 v1,
Vector3 v2)
The dot product of two vectors
|
boolean |
equals(Object obj) |
static Vector3 |
getOne() |
static Vector3 |
getUnitX() |
static Vector3 |
getUnitY() |
static Vector3 |
getUnitZ() |
static Vector3 |
getZero() |
int |
hashCode() |
Vector3 |
increment(Vector3 vector)
Increments this vector
|
float |
length() |
float |
magnitude()
Gets the magnitude of a vector
|
float |
magnitudeSqr()
Gets the squared magnitude of the vector
|
Vector3 |
minus(Vector3 v1)
Subtracts one vector from another
|
Vector3 |
multiply(float scalar) |
Vector3 |
negate()
Gets the negated vector
|
static Vector3 |
normalize(Vector3 value) |
Vector3 |
plus(Vector3 v1)
Adds two vectors
|
Vector3 |
scale(float scalar)
Returns the scaled vector
|
String |
toString() |
static Vector3 |
transform(Vector3 position,
Matrix4x4 matrix) |
static Vector3 |
transform(Vector3 value,
Quaternion rotation) |
static Vector3 |
transformNormal(Vector3 normal,
Matrix4x4 matrix) |
Vector3 |
unitVector()
Gets the unit (normalised) vector from this vector
|
public float X
public float Y
public float Z
public Vector3()
public Vector3(float x,
float y,
float z)
x - The x-coordinatey - The y-coordinatez - The z-coordinatepublic Vector3(Vector3 vector)
vector - Another 3D Vectorpublic static Vector3 getZero()
public static Vector3 getOne()
public static Vector3 getUnitX()
public static Vector3 getUnitY()
public static Vector3 getUnitZ()
public static Vector3 transform(Vector3 value, Quaternion rotation)
public static float dot(Vector3 v1, Vector3 v2)
v1 - The first vectorv2 - The second vectorpublic static Vector3 cross(Vector3 v1, Vector3 v2)
v1 - The first vectorv2 - The second vectorpublic float magnitude()
public float magnitudeSqr()
public Vector3 negate()
public Vector3 scale(float scalar)
scalar - the scalar to scale bypublic Vector3 increment(Vector3 vector)
vector - the vector to increment bypublic Vector3 multiply(float scalar)
Vector3.scale(float)public Vector3 divide(float scalar)
scalar - the scalar to divide bypublic Vector3 plus(Vector3 v1)
v1 - the other vectorpublic Vector3 minus(Vector3 v1)
v1 - vector to subtract from thispublic float distanceTo(Vector3 vectorTo)
vectorTo - the vector to measure topublic Vector3 unitVector()
public float length()
Copyright (c) 2008-2025 Aspose Pty Ltd. All Rights Reserved.