Class: Vector3Ex
extra function of vector3
Constructors
Methods
- add
- sub
- mul
- mulScale
- div
- normalize
- dot
- calculateVectorAngle_xz
- distance
- getRandomXYZ
- getRandomV3
- sphere
- sphereXYZ
Constructors
constructor
• new Vector3Ex(): Vector3Ex
Returns
Methods
add
▸ add(v1
, v2
, target?
): Vector3
vector3 add
Parameters
Name | Type |
---|---|
v1 | Vector3 |
v2 | Vector3 |
target? | Vector3 |
Returns
Defined in
sub
▸ sub(v1
, v2
, target?
): Vector3
vector3 sub
Parameters
Name | Type |
---|---|
v1 | Vector3 |
v2 | Vector3 |
target? | Vector3 |
Returns
Defined in
mul
▸ mul(v1
, v2
, target?
): Vector3
vector3 mul
Parameters
Name | Type |
---|---|
v1 | Vector3 |
v2 | Vector3 |
target? | Vector3 |
Returns
Defined in
mulScale
▸ mulScale(v1
, v
, target?
): Vector3
vector3 mul
Parameters
Name | Type |
---|---|
v1 | Vector3 |
v | number |
target? | Vector3 |
Returns
Defined in
div
▸ div(v1
, v2
, target?
): Vector3
vector3 div
Parameters
Name | Type |
---|---|
v1 | Vector3 |
v2 | Vector3 |
target? | Vector3 |
Returns
Defined in
normalize
▸ normalize(v1
): Vector3
normalize
Parameters
Name | Type | Description |
---|---|---|
v1 | Vector3 | source vector |
Returns
result vector
Defined in
dot
▸ dot(v1
, v2
): number
dot
Parameters
Name | Type | Description |
---|---|---|
v1 | Vector3 | first vector |
v2 | Vector3 | second vector |
Returns
number
result
Defined in
calculateVectorAngle_xz
▸ calculateVectorAngle_xz(v1
, v2
): number
Calculate the angle between two vectors
Parameters
Name | Type | Description |
---|---|---|
v1 | Vector3 | first vector |
v2 | Vector3 | second vector |
Returns
number
Angle result in radians
Defined in
distance
▸ distance(v1
, v2
): number
Calculate the distance between two points
Parameters
Name | Type | Description |
---|---|---|
v1 | Vector3 | first vector |
v2 | Vector3 | second vector |
Returns
number
distance
Static
Defined in
getRandomXYZ
▸ getRandomXYZ(min?
, max?
): Vector3
make a Random 3D Vector
Parameters
Name | Type | Default value | Description |
---|---|---|---|
min | number | -100 | The min random value of vector components |
max | number | 100 | The max random value of vector components |
Returns
random vector
Defined in
getRandomV3
▸ getRandomV3(min?
, max?
, yMin
, yMax
): Vector3
make a Random 3D Vector
Parameters
Name | Type | Default value | Description |
---|---|---|---|
min | number | -100 | The min random value of vector component-x |
max | number | 100 | The max random value of vector component-x |
yMin | number | undefined | The min random value of vector component-y |
yMax | number | undefined | The max random value of vector component-y |
Returns
random vector
Defined in
sphere
▸ sphere(radius
): Vector3
Parameters
Name | Type |
---|---|
radius | number |
Returns
Defined in
sphereXYZ
▸ sphereXYZ(radiusMin
, radiusMax
, x?
, y?
, z?
): Vector3
Parameters
Name | Type | Default value |
---|---|---|
radiusMin | number | undefined |
radiusMax | number | undefined |
x | number | 1 |
y | number | 1 |
z | number | 1 |