Skip to content

[mxcad_3d API documentation](../README. md)/Mx3dGeVec

Class: Mx3dGeVec ​

A class that represents a three-dimensional vector. Used for 3D geometric operations.

Hierarchy ​

Table of contents ​

Constructors ​

Methods ​

Constructors ​

constructor ​

• new Mx3dGeVec()

Construct a new Mx3dGeVec instance. It can be without parameters, or with three numerical parameters, or with two points.

Overrides ​

Mx3dGeObject.constructor

• new Mx3dGeVec(x, y, z)

Parameters ​

NameType
xnumber
ynumber
znumber

Overrides ​

Mx3dGeObject.constructor

• new Mx3dGeVec(thePoint1, thePoint2)

Parameters ​

NameType
thePoint1Mx3dGePoint
thePoint2Mx3dGePoint

Overrides ​

Mx3dGeObject.constructor

Methods ​

Add ​

▸ Add(other): void

Add the current vector to another vector.

Parameters ​

NameTypeDescription
Other[Mx3dGeVec] (Mx3dGeVec. md)Another vector

Returns ​

void


Added ​

▸ Added(other): Mx3dGeVec

Return the result of adding the current vector to another vector.

Parameters ​

NameTypeDescription
Other[Mx3dGeVec] (Mx3dGeVec. md)Another vector

Returns ​

Mx3dGeVec

The vector after addition.


Angle ​

▸ Angle(other): number

Calculate the angle between two vectors.

Parameters ​

NameTypeDescription
Other[Mx3dGeVec] (Mx3dGeVec. md)Another vector

Returns ​

number

Angle value.


AngleWithRef ​

▸ AngleWithRef(other, ref): number

Calculate the angle between two vectors with a reference vector.

Parameters ​

NameTypeDescription
Other[Mx3dGeVec] (Mx3dGeVec. md)Another vector
Ref[Mx3dGeVec] (Mx3dGeVec. md)Reference vector

Returns ​

number

Angle values with reference vectors.


Cross ​

▸ Cross(right): void

Calculate the cross product of two vectors.

Parameters ​

NameTypeDescription
right[Mx3dGeVec] (Mx3dGeVec. md)Another vector

Returns ​

void


CrossCross ​

▸ CrossCross(v1, v2): void

Calculate the cross product of three vectors.

Parameters ​

NameTypeDescription
V1[Mx3dGeVec] (Mx3dGeVec. md)Vector 1
V2[Mx3dGeVec] (Mx3dGeVec. md)Vector 2

Returns ​

void


CrossCrossed ​

▸ CrossCrossed(v1, v2): Mx3dGeVec

Return the cross product of three vectors.

Parameters ​

NameTypeDescription
V1[Mx3dGeVec] (Mx3dGeVec. md)Vector 1
V2[Mx3dGeVec] (Mx3dGeVec. md)Vector 2

Returns ​

Mx3dGeVec

The vector after cross product.


CrossMagnitude ​

▸ CrossMagnitude(right): number

Calculate the modulus of the cross product of two vectors.

Parameters ​

NameTypeDescription
right[Mx3dGeVec] (Mx3dGeVec. md)Another vector

Returns ​

number

The module of cross product.


CrossSquareMagnitude ​

▸ CrossSquareMagnitude(right): number

Calculate the square of the cross product modulus of two vectors.

Parameters ​

NameTypeDescription
right[Mx3dGeVec] (Mx3dGeVec. md)Another vector

Returns ​

number

The square of the cross product modulus.


Crossed ​

▸ Crossed(right): Mx3dGeVec

Return the cross product of two vectors.

Parameters ​

NameTypeDescription
right[Mx3dGeVec] (Mx3dGeVec. md)Another vector

Returns ​

Mx3dGeVec

The vector after cross product.


Divide ​

▸ Divide(scalar): void

Divide the current vector by a scalar.

Parameters ​

NameTypeDescription
ScalarNumberScalar value

Returns ​

void


Divided ​

▸ Divided(scalar): Mx3dGeVec

Returns the result of dividing the current vector by a scalar.

Parameters ​

NameTypeDescription
ScalarNumberScalar value

Returns ​

Mx3dGeVec

The vector divided by the scalar.


Dot ​

▸ Dot(other): number

Calculate the dot product of two vectors.

Parameters ​

NameTypeDescription
Other[Mx3dGeVec] (Mx3dGeVec. md)Another vector

Returns ​

number

Dot product value.


DotCross ​

▸ DotCross(v1, v2): number

Calculate the dot cross product of three vectors.

Parameters ​

NameTypeDescription
V1[Mx3dGeVec] (Mx3dGeVec. md)Vector 1
V2[Mx3dGeVec] (Mx3dGeVec. md)Vector 2

Returns ​

number

Point cross product value.


IsEqual ​

▸ IsEqual(other, linearTolerance, angularTolerance): boolean

Determine whether two vectors are equal.

Parameters ​

NameTypeDescription
Other[Mx3dGeVec] (Mx3dGeVec. md)Another vector
Linear ToleranceNumberLinear Tolerance
Angular ToleranceNumberAngular Tolerance

Returns ​

boolean

Is it equal.


IsNormal ​

▸ IsNormal(other, angularTolerance): boolean

Determine whether two vectors are normal vectors to each other.

Parameters ​

NameTypeDescription
Other[Mx3dGeVec] (Mx3dGeVec. md)Another vector
Angular ToleranceNumberAngular Tolerance

Returns ​

boolean

Are they normal vectors to each other.


IsOpposite ​

▸ IsOpposite(other, angularTolerance): boolean

Determine whether two vectors are opposite to each other.

Parameters ​

NameTypeDescription
Other[Mx3dGeVec] (Mx3dGeVec. md)Another vector
Angular ToleranceNumberAngular Tolerance

Returns ​

boolean

Are they mutually opposite.


IsParallel ​

▸ IsParallel(other, angularTolerance): boolean

Determine whether two vectors are parallel.

Parameters ​

NameTypeDescription
Other[Mx3dGeVec] (Mx3dGeVec. md)Another vector
Angular ToleranceNumberAngular Tolerance

Returns ​

boolean

Is it parallel.


Magnitude ​

▸ Magnitude(): number

Obtain the modulus of the vector.

Returns ​

number

The modulus of a vector.


MirrorByAxis ​

▸ MirrorByAxis(axis): void

Mirror the current vector based on an axis.

Parameters ​

NameTypeDescription
Axis[Mx3dGeAxis] (Mx3dGeAxis. md)Mirror axis

Returns ​

void


MirrorByCSYSR ​

▸ MirrorByCSYSR(csysr): void

Mirror the current vector based on a coordinate system.

Parameters ​

NameTypeDescription
Csysr[Mx3dGeCSYSR] (Mx3dGeCSYSR. md)Coordinate system

Returns ​

void


MirrorByVec ​

▸ MirrorByVec(vec): void

Mirror the current vector based on a vector.

Parameters ​

NameTypeDescription
Vec[Mx3dGeVec] (Mx3dGeVec. md)Mirror vector

Returns ​

void


MirroredByAxis ​

▸ MirroredByAxis(axis): Mx3dGeVec

Return the vector mirrored based on an axis.

Parameters ​

NameTypeDescription
Axis[Mx3dGeAxis] (Mx3dGeAxis. md)Mirror axis

Returns ​

Mx3dGeVec

The vector after mirroring.


MirroredByCSYSR ​

▸ MirroredByCSYSR(csysr): Mx3dGeVec

Return the vector mirrored based on a coordinate system.

Parameters ​

NameTypeDescription
Csysr[Mx3dGeCSYSR] (Mx3dGeCSYSR. md)Coordinate system

Returns ​

Mx3dGeVec

The vector after mirroring.


MirroredByVec ​

▸ MirroredByVec(vec): Mx3dGeVec

Return the vector mirrored based on a vector.

Parameters ​

NameTypeDescription
Vec[Mx3dGeVec] (Mx3dGeVec. md)Mirror vector

Returns ​

Mx3dGeVec

The vector after mirroring.


Multiplied ​

▸ Multiplied(scalar): Mx3dGeVec

Returns the result of multiplying the current vector by a scalar.

Parameters ​

NameTypeDescription
ScalarNumberScalar value

Returns ​

Mx3dGeVec

The vector multiplied by a scalar.


Multiply ​

▸ Multiply(scalar): void

Multiply the current vector by a scalar.

Parameters ​

NameTypeDescription
ScalarNumberScalar value

Returns ​

void


Normalize ​

▸ Normalize(): void

Normalize the current vector.

Returns ​

void


Normalized ​

▸ Normalized(): Mx3dGeVec

Return the normalized vector.

Returns ​

Mx3dGeVec

Normalized vector.


Reverse ​

▸ Reverse(): void

Reverse the direction of the current vector.

Returns ​

void


Reversed ​

▸ Reversed(): Mx3dGeVec

Return the reversed vector.

Returns ​

Mx3dGeVec

The reversed vector.


Rotate ​

▸ Rotate(axis, ang): void

Rotate the current vector.

Parameters ​

NameTypeDescription
Axis[Mx3dGeAxis] (Mx3dGeAxis. md)Rotation axis
'ang''number'Rotation angle

Returns ​

void


Rotated ​

▸ Rotated(axis, ang): Mx3dGeVec

Return the rotated vector.

Parameters ​

NameTypeDescription
Axis[Mx3dGeAxis] (Mx3dGeAxis. md)Rotation axis
'ang''number'Rotation angle

Returns ​

Mx3dGeVec

The rotated vector.


Scale ​

▸ Scale(s): void

Scale the current vector.

Parameters ​

NameTypeDescription
Snumberscaling factor

Returns ​

void


Scaled ​

▸ Scaled(s): Mx3dGeVec

Return the scaled vector.

Parameters ​

NameTypeDescription
Snumberscaling factor

Returns ​

Mx3dGeVec

The scaled vector.


SetLinearForm ​

▸ SetLinearForm(v1, v2): void

Set the current vector as a linear combination.

Parameters ​

NameTypeDescription
V1[Mx3dGeVec] (Mx3dGeVec. md)Vector 1
V2[Mx3dGeVec] (Mx3dGeVec. md)Vector 2

Returns ​

void

▸ SetLinearForm(a1, v1, v2): void

Parameters ​

NameType
a1number
v1Mx3dGeVec
v2Mx3dGeVec

Returns ​

void

▸ SetLinearForm(a1, v1, a2, v2): void

Parameters ​

NameType
a1number
v1Mx3dGeVec
a2number
v2Mx3dGeVec

Returns ​

void

▸ SetLinearForm(a1, v1, a2, v2, v3): void

Parameters ​

NameType
a1number
v1Mx3dGeVec
a2number
v2Mx3dGeVec
v3Mx3dGeVec

Returns ​

void

▸ SetLinearForm(a1, v1, a2, v2, a3, v3): void

Parameters ​

NameType
a1number
v1Mx3dGeVec
a2number
v2Mx3dGeVec
a3number
v3Mx3dGeVec

Returns ​

void

▸ SetLinearForm(a1, v1, a2, v2, a3, v3, v4): void

Parameters ​

NameType
a1number
v1Mx3dGeVec
a2number
v2Mx3dGeVec
a3number
v3Mx3dGeVec
v4Mx3dGeVec

Returns ​

void


SetX ​

▸ SetX(x): void

Set the x-component of the vector.

Parameters ​

NameTypeDescription
XnumberNew x component

Returns ​

void


SetXYZ ​

▸ SetXYZ(x, y, z): void

Set the x of the vector, Y and z components.

Parameters ​

NameTypeDescription
XnumberNew x component
YnumberNew y component
ZnumberNew z component

Returns ​

void


SetY ​

▸ SetY(y): void

Set the y-component of the vector.

Parameters ​

NameTypeDescription
YnumberNew y component

Returns ​

void


SetZ ​

▸ SetZ(z): void

Set the z-component of the vector.

Parameters ​

NameTypeDescription
ZnumberNew z component

Returns ​

void


SquareMagnitude ​

▸ SquareMagnitude(): number

Obtain the square of the vector modulus.

Returns ​

number

The square of the vector modulus.


Subtract ​

▸ Subtract(right): void

Subtract another vector from the current vector.

Parameters ​

NameTypeDescription
right[Mx3dGeVec] (Mx3dGeVec. md)Another vector

Returns ​

void


Subtracted ​

▸ Subtracted(right): Mx3dGeVec

Return the result of subtracting another vector from the current vector.

Parameters ​

NameTypeDescription
right[Mx3dGeVec] (Mx3dGeVec. md)Another vector

Returns ​

Mx3dGeVec

Subtracted vector.


Transform ​

▸ Transform(t): void

Transform the current vector based on the coordinate system.

Parameters ​

NameType
tMx3dGeTrsf

Returns ​

void


Transformed ​

▸ Transformed(t): Mx3dGeVec

Return the vector transformed according to the coordinate system.

Parameters ​

NameType
tMx3dGeTrsf

Returns ​

Mx3dGeVec

The transformed vector.


X ​

▸ X(): number

Obtain the x-component of the vector.

Returns ​

number

X component.


Y ​

▸ Y(): number

Obtain the y-component of the vector.

Returns ​

number

Y component.


Z ​

▸ Z(): number

Obtain the z-component of the vector.

Returns ​

number

Z component.