Class: Navi3DPoint
Vector 3D
Hierarchy
↳
Navi3DPoint
Constructors
Properties
- MAX
- MIN
- SAFE_MAX
- SAFE_MIN
- X_AXIS
- neg_X_AXIS
- Y_AXIS
- Z_AXIS
- x
- y
- z
- w
- CALC_VECTOR3D1
- CALC_VECTOR3D2
- CALC_VECTOR3D3
- CALC_VECTOR3D4
- CALC_VECTOR3D5
Accessors
Methods
- getTowPointbyDir
- pointToLine
- dot
- getPoints
- getPointNumbers
- getAngle
- sqrMagnitude
- getZYAngle
- sub
- add
- distance
- squareDistance
- distanceXZ
- set
- add
- subVectors
- addScalar
- subScalar
- min
- max
- distanceToSquared
- addXYZW
- clone
- copyFrom
- decrementBy
- dotProduct
- equals
- incrementBy
- divide
- negate
- normalize
- applyQuaternion
- applyMatrix4
- scaleBy
- mul
- scale
- scaleToRef
- setTo
- copy
- subtract
- multiply
- divided
- div
- lerp
- clamp
- toString
- normalizeToWay2D_XY
- toArray
- copyToBytes
- crossProduct
- crossVectors
- multiplyScalar
- setFromArray
- divideScalar
- clampLength
- setScalar
- addScaledVector
- pointInsideTriangle
- serialize
- equalPoint
- calcDistance
Constructors
constructor
• new Navi3DPoint(id
, X
, Y
, Z
): Navi3DPoint
Parameters
Name | Type |
---|---|
id | number |
X | number |
Y | number |
Z | number |
Returns
Overrides
Defined in
src/math/navigation/Navi3DPoint.ts:18
Properties
MAX
▪ Static
Readonly
MAX: Vector3
Vector maximum
Inherited from
Defined in
MIN
▪ Static
Readonly
MIN: Vector3
Vector minimum
Inherited from
Defined in
SAFE_MAX
▪ Static
Readonly
SAFE_MAX: Vector3
Vector maximum integer value
Inherited from
Defined in
SAFE_MIN
▪ Static
Readonly
SAFE_MIN: Vector3
Vector minimum integer value
Inherited from
Defined in
X_AXIS
▪ Static
Readonly
X_AXIS: Vector3
X axis positive axis coordinate (1, 0, 0).
Inherited from
Defined in
neg_X_AXIS
▪ Static
Readonly
neg_X_AXIS: Vector3
The X-axis is negative (-1, 0, 0).
Inherited from
Defined in
Y_AXIS
▪ Static
Readonly
Y_AXIS: Vector3
The y axis defined as a Vector3 object with coordinates (0,1,0).
Inherited from
Defined in
Z_AXIS
▪ Static
Readonly
Z_AXIS: Vector3
The z axis defined as a Vector3 object with coordinates (0,0,1).
Inherited from
Defined in
x
• x: number
= 0
The first element of a Vector3 object, such as the x coordinate of a point in the three-dimensional space. The default value is 0.
Inherited from
Defined in
y
• y: number
= 0
The second element of a Vector3 object, such as the y coordinate of a point in the three-dimensional space. The default value is 0.
Inherited from
Defined in
z
• z: number
= 0
The third element of a Vector3 object, such as the y coordinate of a point in the three-dimensional space. The default value is 0.
Inherited from
Defined in
w
• w: number
= 1
The z component of the vector, A three-dimensional position or projection that can be used as a perspective projection We can also do w in the quaternion
Inherited from
Defined in
CALC_VECTOR3D1
▪ Static
CALC_VECTOR3D1: Vector3
Defined in
src/math/navigation/Navi3DPoint.ts:6
CALC_VECTOR3D2
▪ Static
CALC_VECTOR3D2: Vector3
Defined in
src/math/navigation/Navi3DPoint.ts:8
CALC_VECTOR3D3
▪ Static
CALC_VECTOR3D3: Vector3
Defined in
src/math/navigation/Navi3DPoint.ts:10
CALC_VECTOR3D4
▪ Static
CALC_VECTOR3D4: Vector3
Defined in
src/math/navigation/Navi3DPoint.ts:12
CALC_VECTOR3D5
▪ Static
CALC_VECTOR3D5: Vector3
Defined in
src/math/navigation/Navi3DPoint.ts:14
Accessors
ZERO
• get
ZERO(): Vector3
Returns a new vector with zero x, y, and z components
Returns
Inherited from
Vector3.ZERO
Defined in
ONE
• get
ONE(): Vector3
Returns a new vector whose x, y, and z components are all 1
Returns
Inherited from
Vector3.ONE
Defined in
LEFT
• get
LEFT(): Vector3
Returns a new vector pointing to the left, x is -1, y is 0, and z is 0
Returns
Inherited from
Vector3.LEFT
Defined in
RIGHT
• get
RIGHT(): Vector3
Returns a new vector pointing in the right direction, where x is 1, y is 0, and z is 0
Returns
Inherited from
Vector3.RIGHT
Defined in
UP
• get
UP(): Vector3
Returns a new vector pointing upwards, that is, x equals 0, y equals 1, and z equals 0
Returns
Inherited from
Vector3.UP
Defined in
DOWN
• get
DOWN(): Vector3
Returns a new vector pointing down, where x is 0, y is -1, and z is 0
Returns
Inherited from
Vector3.DOWN
Defined in
BACK
• get
BACK(): Vector3
Returns a new backward vector, x equals 0, y equals 0, and z equals negative 1
Returns
Inherited from
Vector3.BACK
Defined in
FORWARD
• get
FORWARD(): Vector3
Returns a new forward-pointing vector, that is, x is 0, y is 0, and z is 1
Returns
Inherited from
Vector3.FORWARD
Defined in
a
• get
a(): number
get the w component
Returns
number
value of w
Inherited from
Vector3.a
Defined in
• set
a(value
): void
Set w component
Parameters
Name | Type |
---|---|
value | number |
Returns
void
Inherited from
Vector3.a
Defined in
r
• get
r(): number
get the x component
Returns
number
value of x
Inherited from
Vector3.r
Defined in
• set
r(value
): void
Set x component
Parameters
Name | Type |
---|---|
value | number |
Returns
void
Inherited from
Vector3.r
Defined in
g
• get
g(): number
get the y component
Returns
number
value of y
Inherited from
Vector3.g
Defined in
• set
g(value
): void
Set the y component
Parameters
Name | Type |
---|---|
value | number |
Returns
void
Inherited from
Vector3.g
Defined in
b
• get
b(): number
get the z component
Returns
number
value of z
Inherited from
Vector3.b
Defined in
• set
b(value
): void
Set z component
Parameters
Name | Type |
---|---|
value | number |
Returns
void
Inherited from
Vector3.b
Defined in
length
• get
length(): number
The length of the vector, the distance from the origin (0, 0, 0) to (x, y, z)
Returns
number
Inherited from
Vector3.length
Defined in
lengthSquared
• get
lengthSquared(): number
You get the square of the length of the vector
Returns
number
Inherited from
Vector3.lengthSquared
Defined in
position
• get
position(): this
Get the current vector
Returns
this
Inherited from
Vector3.position
Defined in
id
• get
id(): number
Returns
number
Defined in
src/math/navigation/Navi3DPoint.ts:23
Methods
getTowPointbyDir
▸ getTowPointbyDir(dir
, tp1
, tp2
, width
, aix
): void
Obtain a vertical line segment with width through an orientation
Parameters
Name | Type |
---|---|
dir | Vector3 |
tp1 | Vector3 |
tp2 | Vector3 |
width | number |
aix | Vector3 |
Returns
void
Inherited from
Defined in
pointToLine
▸ pointToLine(point1
, point2
, position
): number
Calculate the distance from the point to the line
Parameters
Name | Type | Description |
---|---|---|
point1 | Vector3 | Starting point of line segment |
point2 | Vector3 | End point of line segment |
position | Vector3 | Point position |
Returns
number
Distance from a point to a line segment
Inherited from
Defined in
dot
▸ dot(a
, b
): number
Take the dot product of two vectors.
Parameters
Name | Type | Description |
---|---|---|
a | Vector3 | Vector a |
b | Vector3 | Vector b |
Returns
number
Inherited from
Defined in
getPoints
▸ getPoints(total
, randSeed
): any
[]
Parameters
Name | Type |
---|---|
total | number |
randSeed | number |
Returns
any
[]
Inherited from
Defined in
getPointNumbers
▸ getPointNumbers(total
, randSeed
): any
[]
Parameters
Name | Type |
---|---|
total | number |
randSeed | number |
Returns
any
[]
Inherited from
Defined in
getAngle
▸ getAngle(from
, to
): number
Returns the Angle, in degrees, between the source vector and the target vector.
Parameters
Name | Type | Description |
---|---|---|
from | Vector3 | source vector. |
to | Vector3 | target vector. |
Returns
number
Inherited from
Defined in
sqrMagnitude
▸ sqrMagnitude(arg0
): number
Parameters
Name | Type |
---|---|
arg0 | Vector3 |
Returns
number
Inherited from
Defined in
getZYAngle
▸ getZYAngle(zd
, yd
): number
Parameters
Name | Type |
---|---|
zd | Vector3 |
yd | Vector3 |
Returns
number
Inherited from
Defined in
sub
▸ sub(a
, b
, target?
): Vector3
Subtract two vectors
Parameters
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | undefined | Vector a |
b | Vector3 | undefined | Vector b |
target | Vector3 | null | output vector |
Returns
Inherited from
Defined in
add
▸ add(a
, b
, target?
): Vector3
Add two vectors
Parameters
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | undefined | Vector a |
b | Vector3 | undefined | Vector b |
target | Vector3 | null | output vector |
Returns
Inherited from
Defined in
distance
▸ distance(pt1
, pt2
): number
Calculate the distance between two vectors
Parameters
Name | Type | Description |
---|---|---|
pt1 | Vector3 | Vector 1 |
pt2 | Vector3 | Vector 2 |
Returns
number
number The distance between two vectors
Inherited from
Defined in
squareDistance
▸ squareDistance(pt1
, pt2
): number
Calculate the square distance between two vectors
Parameters
Name | Type | Description |
---|---|---|
pt1 | Vector3 | Vector 1 |
pt2 | Vector3 | Vector 2 |
Returns
number
number The square distance between two vectors
Inherited from
Defined in
distanceXZ
▸ distanceXZ(pt1
, pt2
): number
Calculate the distance between two vectors XZ axes
Parameters
Name | Type | Description |
---|---|---|
pt1 | Vector3 | Vector 1 |
pt2 | Vector3 | Vector 2 |
Returns
number
number The distance between two vectors
Inherited from
Defined in
set
▸ set(x
, y
, z
, w?
): Navi3DPoint
Sets the current vector x, y, z, and w components
Parameters
Name | Type | Default value |
---|---|---|
x | number | undefined |
y | number | undefined |
z | number | undefined |
w | number | 1 |
Returns
Inherited from
Defined in
add
▸ add(a
, target?
): Vector3
The vector is added to the vector
Parameters
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | undefined | Additive vector |
target | Vector3 | null | Return vector |
Returns
result
Inherited from
Defined in
subVectors
▸ subVectors(a
, b
): this
Parameters
Name | Type |
---|---|
a | Vector3 |
b | Vector3 |
Returns
this
Inherited from
Defined in
addScalar
▸ addScalar(scalar
): Vector3
Parameters
Name | Type |
---|---|
scalar | number |
Returns
Inherited from
Defined in
subScalar
▸ subScalar(scalar
): Vector3
Parameters
Name | Type |
---|---|
scalar | number |
Returns
Inherited from
Defined in
min
▸ min(v
, target?
): Vector3
Parameters
Name | Type |
---|---|
v | Vector3 |
target | Vector3 |
Returns
Inherited from
Defined in
max
▸ max(v
, target?
): Vector3
Parameters
Name | Type |
---|---|
v | Vector3 |
target | Vector3 |
Returns
Inherited from
Defined in
distanceToSquared
▸ distanceToSquared(v
): number
Parameters
Name | Type |
---|---|
v | Vector3 |
Returns
number
Inherited from
Defined in
addXYZW
▸ addXYZW(x
, y
, z
, w
, target?
): Vector3
Parameters
Name | Type | Default value |
---|---|---|
x | number | undefined |
y | number | undefined |
z | number | undefined |
w | number | undefined |
target | Vector3 | null |
Returns
Inherited from
Defined in
clone
▸ clone(): Vector3
Clone a vector with the same components as the current vector
Returns
Inherited from
Defined in
copyFrom
▸ copyFrom(src
): Vector3
The components of the source vector are set to the current vector
Parameters
Name | Type | Description |
---|---|---|
src | Vector3 | Original vector |
Returns
Inherited from
Defined in
decrementBy
▸ decrementBy(a
): void
Subtract two vectors and assign the result to yourself
Parameters
Name | Type | Description |
---|---|---|
a | Vector3 | Minus vector |
Returns
void
Inherited from
Defined in
dotProduct
▸ dotProduct(a
): number
Calculate the dot product of two vectors and return the Angle relationship between the two vectors
Parameters
Name | Type | Description |
---|---|---|
a | Vector3 | The vector that you need to compute |
Returns
number
number Returns the Angle relationship between two vectors
Inherited from
Defined in
equals
▸ equals(toCompare
, allFour?
): boolean
Find whether the values of two vectors are identical
Parameters
Name | Type | Default value | Description |
---|---|---|---|
toCompare | Vector3 | undefined | The vector to compare |
allFour | boolean | false | The default parameter is 1, whether to compare the w component |
Returns
boolean
A value of true if the specified Vector3 object is equal to the current Vector3 object; false if it is not equal.
Inherited from
Defined in
incrementBy
▸ incrementBy(a
): void
The current vector plus is equal to the vector, plus just the x, y, and z components
Parameters
Name | Type | Description |
---|---|---|
a | Vector3 | vector |
Returns
void
Inherited from
Defined in
divide
▸ divide(v
): Vector3
The current vector divided by the vector or component
Parameters
Name | Type | Description |
---|---|---|
v | any | The vector or component that you want to divide |
Returns
Vector3 Returns the result of the calculation
Inherited from
Defined in
negate
▸ negate(): Navi3DPoint
Sets the current Vector3 object to its inverse. The inverse object is also considered the opposite of the original object. The value of the x, y, and z properties of the current Vector3 object is changed to -x, -y, and -z.
Returns
Inherited from
Defined in
normalize
▸ normalize(thickness?
): Vector3
Scales the line segment between(0,0) and the current point to a set length.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
thickness | number | 1 | The scaling value. For example, if the current Vector3 object is (0,3,4), and you normalize it to 1, the point returned is at(0,0.6,0.8). |
Returns
Inherited from
Defined in
applyQuaternion
▸ applyQuaternion(q
): Navi3DPoint
Apply the rotation quaternion
Parameters
Name | Type | Description |
---|---|---|
q | any | quaternion |
Returns
Inherited from
Defined in
applyMatrix4
▸ applyMatrix4(m
): Vector3
Parameters
Name | Type |
---|---|
m | any |
Returns
Inherited from
Defined in
scaleBy
▸ scaleBy(s
): Vector3
Scales the current Vector3 object by a scalar, a magnitude. The Vector3 object's x, y, and z elements are multiplied by the scalar number specified in the parameter. For example, if the vector is scaled by ten, the result is a vector that is ten times longer. The scalar can also change the direction of the vector. Multiplying the vector by a negative number reverses its direction.
Parameters
Name | Type | Description |
---|---|---|
s | number | A multiplier (scalar) used to scale a Vector3 object. |
Returns
Inherited from
Defined in
mul
▸ mul(s
): Vector3
The current vector times the scalar s
Parameters
Name | Type | Description |
---|---|---|
s | number | scalar s |
Returns
Inherited from
Defined in
scale
▸ scale(s
): Vector3
Parameters
Name | Type |
---|---|
s | Vector3 |
Returns
Inherited from
Defined in
scaleToRef
▸ scaleToRef(s
, ref
): Vector3
Parameters
Name | Type |
---|---|
s | number |
ref | Vector3 |
Returns
Inherited from
Defined in
setTo
▸ setTo(xa
, ya
, za
, wa?
): void
Parameters
Name | Type | Default value | Description |
---|---|---|---|
xa | number | undefined | The first element, such as the x coordinate. |
ya | number | undefined | The second element, such as the y coordinate. |
za | number | undefined | The third element, such as the z coordinate. |
wa | number | 1 | - |
Returns
void
Language
en_US Sets the members of Vector3 to the specified values
Inherited from
Defined in
copy
▸ copy(src
): this
Copy the components of the source vector to this vector
Parameters
Name | Type | Description |
---|---|---|
src | Vector3 | Source vector |
Returns
this
Inherited from
Defined in
subtract
▸ subtract(a
, target?
): Vector3
Parameters
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | undefined | The Vector3 object to be subtracted from the current Vector3 object. |
target | Vector3 | null | - |
Returns
A new Vector3 object that is the difference between the current Vector3 and the specified Vector3 object.
Language
en_US Subtracts the value of the x, y, and z elements of the current Vector3 object from the values of the x, y, and z elements of another Vector3 object. The subtract()
method does not change the current Vector3 object. Instead, this method returns a new Vector3 object with the new values.
Inherited from
Defined in
multiply
▸ multiply(other
, target?
): Vector3
Let's multiply that vector times that vector.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
other | Vector3 | undefined | Multiplied vectors |
target | Vector3 | null | Returned vector |
Returns
Inherited from
Defined in
divided
▸ divided(other
, target?
): Vector3
Let's divide this vector by this vector.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
other | Vector3 | undefined | The vector that divides |
target | Vector3 | null | Returned vector |
Returns
Inherited from
Defined in
div
▸ div(v
, target?
): Vector3
Divide that vector by the scalar
Parameters
Name | Type | Description |
---|---|---|
v | number | The scalar that divides |
target? | Vector3 | Output a Vector3 vector |
Returns
Inherited from
Defined in
lerp
▸ lerp(v0
, v1
, t
): void
Computes the linear interpolation between two Vector3, and the result is the current object
Parameters
Name | Type | Description |
---|---|---|
v0 | Vector3 | Vector 1 |
v1 | Vector3 | Vector 2 |
t | number | Interpolation factor |
Returns
void
Inherited from
Defined in
clamp
▸ clamp(min
, max
): Vector3
The x, y, and z components of this vector are rounded upward to the nearest integers.
Parameters
Name | Type | Description |
---|---|---|
min | Vector3 | minimum value |
max | Vector3 | maximum value |
Returns
Inherited from
Defined in
toString
▸ toString(): string
Returns the string form of the current vector
Returns
string
Inherited from
Defined in
normalizeToWay2D_XY
▸ normalizeToWay2D_XY(): void
Returns
void
Inherited from
Defined in
toArray
▸ toArray(): number
[]
Returns
number
[]
Inherited from
Defined in
copyToBytes
▸ copyToBytes(byte
): void
Parameters
Name | Type |
---|---|
byte | DataView |
Returns
void
Inherited from
Defined in
crossProduct
▸ crossProduct(a
, target?
): Vector3
You take the cross product of two vectors, The cross product is going to be the perpendicular vector between these two vectors
Parameters
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | undefined | Take the cross product of another vector |
target | Vector3 | null | - |
Returns
Vector3 returns the cross product vector
Inherited from
Defined in
crossVectors
▸ crossVectors(a
, b
): this
Parameters
Name | Type |
---|---|
a | Vector3 |
b | Vector3 |
Returns
this
Inherited from
Defined in
multiplyScalar
▸ multiplyScalar(scalar
): Navi3DPoint
Parameters
Name | Type |
---|---|
scalar | number |
Returns
Inherited from
Defined in
setFromArray
▸ setFromArray(array
, firstElementPos?
): void
Parameters
Name | Type | Default value |
---|---|---|
array | number [] | undefined |
firstElementPos | number | 0 |
Returns
void
Inherited from
Defined in
divideScalar
▸ divideScalar(scalar
): Navi3DPoint
Parameters
Name | Type |
---|---|
scalar | any |
Returns
Inherited from
Defined in
clampLength
▸ clampLength(min
, max
): Navi3DPoint
Parameters
Name | Type |
---|---|
min | number |
max | number |
Returns
Inherited from
Defined in
setScalar
▸ setScalar(value
): Navi3DPoint
Parameters
Name | Type |
---|---|
value | number |
Returns
Inherited from
Defined in
addScaledVector
▸ addScaledVector(v
, scale
): Vector3
Parameters
Name | Type |
---|---|
v | Vector3 |
scale | number |
Returns
Inherited from
Defined in
pointInsideTriangle
▸ pointInsideTriangle(pt
, pt0
, pt1
, pt2
): boolean
Parameters
Name | Type |
---|---|
pt | Vector3 |
pt0 | Vector3 |
pt1 | Vector3 |
pt2 | Vector3 |
Returns
boolean
Inherited from
Defined in
serialize
▸ serialize(position
): Vector3
Parameters
Name | Type |
---|---|
position | Vector3 |
Returns
Inherited from
Defined in
equalPoint
▸ equalPoint(p1
, p2
): boolean
Parameters
Name | Type |
---|---|
p1 | Vector3 |
p2 | Vector3 |
Returns
boolean
Defined in
src/math/navigation/Navi3DPoint.ts:27
calcDistance
▸ calcDistance(pt1
, pt2
): number
Parameters
Name | Type |
---|---|
pt1 | Vector3 |
pt2 | Vector3 |
Returns
number