目录

Vector3

Class Info

public class Vector3 implements Parcelable

三维向量。

Public Field Summary

Qualifier and Type

Field and Description

static final Vector3

BACK

三维向量Vector3(0, 0, 1)。

static final Vector3

DOWN

三维向量Vector3(0, -1, 0)。

static final Vector3

FORWARD

三维向量Vector3(0, 0, -1)。

static final Vector3

LEFT

三维向量Vector3(-1, 0, 0)。

static final Vector3

ONE

三维向量Vector3(1, 1, 1)。

static final Vector3

RIGHT

三维向量Vector3(1, 0, 0)。

static final Vector3

UP

三维向量Vector3(0, 1, 0)。

static final Vector3

ZERO

0向量。

float

x

三维向量的X值。

float

y

三维向量的Y值。

float

z

三维向量的Z值。

Public Constructor Summary

Constructor Name

Vector3(float x, float y, float z)

构造方法,使用X、Y、Z值进行初始化Vector3。

Vector3(Vector3 other)

构造方法,使用其他三维向量初始化Vector3。

Public Method Summary

Qualifier and Type

Method Name and Description

static Vector3

add(Vector3 lhs, Vector3 rhs)

三维向量加法。

static float

angleBetween(Vector3 lhs, Vector3 rhs)

获取两个三维向量的夹角。

static Vector3

cross(Vector3 lhs, Vector3 rhs)

三维向量叉乘。

static float

dot(Vector3 lhs, Vector3 rhs)

三维向量点乘。

float

length()

获取三维向量的模长。

Vector3

normalize()

获取当前向量的归一化向量。

static Vector3

subtract(Vector3 lhs, Vector3 rhs)

三维向量减法。

Public Fields

[h2]BACK

Property

public static final Vector3 BACK

三维向量Vector3(0, 0, 1)。

[h2]DOWN

Property

public static final Vector3 DOWN

三维向量Vector3(0, -1, 0)。

[h2]FORWARD

Property

public static final Vector3 FORWARD

三维向量Vector3(0, 0, -1)。

[h2]LEFT

Property

public static final Vector3 LEFT

三维向量Vector3(-1, 0, 0)。

[h2]ONE

Property

public static final Vector3 ONE

三维向量Vector3(1, 1, 1)。

[h2]RIGHT

Property

public static final Vector3 RIGHT

三维向量Vector3(1, 0, 0)。

[h2]UP

Property

public static final Vector3 UP

三维向量Vector3(0, 1, 0)。

[h2]ZERO

Property

public static final Vector3 ZERO

0向量。

[h2]x

Property

public float x

三维向量的X值。

[h2]y

Property

public float y

三维向量的Y值。

[h2]z

Property

public float z

三维向量的Z值。

Public Constructors

[h2]Vector3(float x, float y, float z)

Constructor

public Vector3(float x, float y, float z)

使用X、Y、Z值进行初始化。

Parameters

Name

Description

x

三维向量的X值。

y

三维向量的Y值。

z

三维向量的Z值。

[h2]Vector3(Vector3 other)

Constructor

public Vector3(Vector3 other)

使用其他三维向量初始化。

Parameters

Name

Description

other

三维向量。

Public Methods

[h2]add

Method

public static Vector3 add(Vector3 lhs, Vector3 rhs)

三维向量加法。

Parameters

Name

Description

lhs

三维向量。

rhs

三维向量。

Returns

Type

Description

Vector3

两个三维向量的和。

[h2]angleBetween

Method

public static float angleBetween(Vector3 lhs, Vector3 rhs)

获取两个三维向量的夹角。

Parameters

Name

Description

lhs

三维向量。

rhs

三维向量。

Returns

Type

Description

float

两个三维向量的夹角,单位弧度。

[h2]cross

Method

public static Vector3 cross(Vector3 lhs, Vector3 rhs)

三维向量叉乘。

Parameters

Name

Description

lhs

三维向量。

rhs

三维向量。

Returns

Type

Description

Vector3

两个三维向量的叉积。

[h2]dot

Method

public static float dot(Vector3 lhs, Vector3 rhs)

三维向量点乘。

Parameters

Name

Description

lhs

三维向量。

rhs

三维向量。

Returns

Type

Description

float

两个三维向量的点积。

[h2]length

Method

public float length()

获取三维向量的模长。

Returns

Type

Description

float

三维向量的模长。

[h2]normalize

Method

public Vector3 normalize()

归一化当前三维向量。

Returns

Type

Description

Vector3

归一化的三维向量。

[h2]subtract

Method

public static Vector3 subtract(Vector3 lhs, Vector3 rhs)

三维向量减法。

Parameters

Name

Description

lhs

三维向量被减数。

rhs

三维向量减数。

Returns

Type

Description

Vector3

两个三维向量的差。