[mxcad_3d API documentation](../README. md)/Mx3dGeVec
Class: Mx3dGeVec
A class that represents a three-dimensional vector. Used for 3D geometric operations.
Hierarchy
↳
Mx3dGeVec
Table of contents
Constructors
Methods
- Add
- Added
- Angle
- AngleWithRef
- Cross
- CrossCross
- CrossCrossed
- CrossMagnitude
- CrossSquareMagnitude
- Crossed
- Divide
- Divided
- Dot
- DotCross
- IsEqual
- IsNormal
- IsOpposite
- IsParallel
- Magnitude
- MirrorByAxis
- MirrorByCSYSR
- MirrorByVec
- MirroredByAxis
- MirroredByCSYSR
- MirroredByVec
- Multiplied
- Multiply
- Normalize
- Normalized
- Reverse
- Reversed
- Rotate
- Rotated
- Scale
- Scaled
- SetLinearForm
- SetX
- SetXYZ
- SetY
- SetZ
- SquareMagnitude
- Subtract
- Subtracted
- Transform
- Transformed
- X
- Y
- Z
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
| Name | Type |
|---|---|
x | number |
y | number |
z | number |
Overrides
Mx3dGeObject.constructor
• new Mx3dGeVec(thePoint1, thePoint2)
Parameters
| Name | Type |
|---|---|
thePoint1 | Mx3dGePoint |
thePoint2 | Mx3dGePoint |
Overrides
Mx3dGeObject.constructor
Methods
Add
▸ Add(other): void
Add the current vector to another vector.
Parameters
| Name | Type | Description |
|---|---|---|
| Other | [Mx3dGeVec] (Mx3dGeVec. md) | Another vector |
Returns
void
Added
▸ Added(other): Mx3dGeVec
Return the result of adding the current vector to another vector.
Parameters
| Name | Type | Description |
|---|---|---|
| Other | [Mx3dGeVec] (Mx3dGeVec. md) | Another vector |
Returns
The vector after addition.
Angle
▸ Angle(other): number
Calculate the angle between two vectors.
Parameters
| Name | Type | Description |
|---|---|---|
| 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
| Name | Type | Description |
|---|---|---|
| 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
| Name | Type | Description |
|---|---|---|
right | [Mx3dGeVec] (Mx3dGeVec. md) | Another vector |
Returns
void
CrossCross
▸ CrossCross(v1, v2): void
Calculate the cross product of three vectors.
Parameters
| Name | Type | Description |
|---|---|---|
| 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
| Name | Type | Description |
|---|---|---|
| V1 | [Mx3dGeVec] (Mx3dGeVec. md) | Vector 1 |
| V2 | [Mx3dGeVec] (Mx3dGeVec. md) | Vector 2 |
Returns
The vector after cross product.
CrossMagnitude
▸ CrossMagnitude(right): number
Calculate the modulus of the cross product of two vectors.
Parameters
| Name | Type | Description |
|---|---|---|
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
| Name | Type | Description |
|---|---|---|
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
| Name | Type | Description |
|---|---|---|
right | [Mx3dGeVec] (Mx3dGeVec. md) | Another vector |
Returns
The vector after cross product.
Divide
▸ Divide(scalar): void
Divide the current vector by a scalar.
Parameters
| Name | Type | Description |
|---|---|---|
| Scalar | Number | Scalar value |
Returns
void
Divided
▸ Divided(scalar): Mx3dGeVec
Returns the result of dividing the current vector by a scalar.
Parameters
| Name | Type | Description |
|---|---|---|
| Scalar | Number | Scalar value |
Returns
The vector divided by the scalar.
Dot
▸ Dot(other): number
Calculate the dot product of two vectors.
Parameters
| Name | Type | Description |
|---|---|---|
| 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
| Name | Type | Description |
|---|---|---|
| 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
| Name | Type | Description |
|---|---|---|
| Other | [Mx3dGeVec] (Mx3dGeVec. md) | Another vector |
| Linear Tolerance | Number | Linear Tolerance |
| Angular Tolerance | Number | Angular Tolerance |
Returns
boolean
Is it equal.
IsNormal
▸ IsNormal(other, angularTolerance): boolean
Determine whether two vectors are normal vectors to each other.
Parameters
| Name | Type | Description |
|---|---|---|
| Other | [Mx3dGeVec] (Mx3dGeVec. md) | Another vector |
| Angular Tolerance | Number | Angular 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
| Name | Type | Description |
|---|---|---|
| Other | [Mx3dGeVec] (Mx3dGeVec. md) | Another vector |
| Angular Tolerance | Number | Angular Tolerance |
Returns
boolean
Are they mutually opposite.
IsParallel
▸ IsParallel(other, angularTolerance): boolean
Determine whether two vectors are parallel.
Parameters
| Name | Type | Description |
|---|---|---|
| Other | [Mx3dGeVec] (Mx3dGeVec. md) | Another vector |
| Angular Tolerance | Number | Angular 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
| Name | Type | Description |
|---|---|---|
| Axis | [Mx3dGeAxis] (Mx3dGeAxis. md) | Mirror axis |
Returns
void
MirrorByCSYSR
▸ MirrorByCSYSR(csysr): void
Mirror the current vector based on a coordinate system.
Parameters
| Name | Type | Description |
|---|---|---|
| Csysr | [Mx3dGeCSYSR] (Mx3dGeCSYSR. md) | Coordinate system |
Returns
void
MirrorByVec
▸ MirrorByVec(vec): void
Mirror the current vector based on a vector.
Parameters
| Name | Type | Description |
|---|---|---|
| Vec | [Mx3dGeVec] (Mx3dGeVec. md) | Mirror vector |
Returns
void
MirroredByAxis
▸ MirroredByAxis(axis): Mx3dGeVec
Return the vector mirrored based on an axis.
Parameters
| Name | Type | Description |
|---|---|---|
| Axis | [Mx3dGeAxis] (Mx3dGeAxis. md) | Mirror axis |
Returns
The vector after mirroring.
MirroredByCSYSR
▸ MirroredByCSYSR(csysr): Mx3dGeVec
Return the vector mirrored based on a coordinate system.
Parameters
| Name | Type | Description |
|---|---|---|
| Csysr | [Mx3dGeCSYSR] (Mx3dGeCSYSR. md) | Coordinate system |
Returns
The vector after mirroring.
MirroredByVec
▸ MirroredByVec(vec): Mx3dGeVec
Return the vector mirrored based on a vector.
Parameters
| Name | Type | Description |
|---|---|---|
| Vec | [Mx3dGeVec] (Mx3dGeVec. md) | Mirror vector |
Returns
The vector after mirroring.
Multiplied
▸ Multiplied(scalar): Mx3dGeVec
Returns the result of multiplying the current vector by a scalar.
Parameters
| Name | Type | Description |
|---|---|---|
| Scalar | Number | Scalar value |
Returns
The vector multiplied by a scalar.
Multiply
▸ Multiply(scalar): void
Multiply the current vector by a scalar.
Parameters
| Name | Type | Description |
|---|---|---|
| Scalar | Number | Scalar value |
Returns
void
Normalize
▸ Normalize(): void
Normalize the current vector.
Returns
void
Normalized
▸ Normalized(): Mx3dGeVec
Return the normalized vector.
Returns
Normalized vector.
Reverse
▸ Reverse(): void
Reverse the direction of the current vector.
Returns
void
Reversed
▸ Reversed(): Mx3dGeVec
Return the reversed vector.
Returns
The reversed vector.
Rotate
▸ Rotate(axis, ang): void
Rotate the current vector.
Parameters
| Name | Type | Description |
|---|---|---|
| Axis | [Mx3dGeAxis] (Mx3dGeAxis. md) | Rotation axis |
| 'ang' | 'number' | Rotation angle |
Returns
void
Rotated
▸ Rotated(axis, ang): Mx3dGeVec
Return the rotated vector.
Parameters
| Name | Type | Description |
|---|---|---|
| Axis | [Mx3dGeAxis] (Mx3dGeAxis. md) | Rotation axis |
| 'ang' | 'number' | Rotation angle |
Returns
The rotated vector.
Scale
▸ Scale(s): void
Scale the current vector.
Parameters
| Name | Type | Description |
|---|---|---|
| S | number | scaling factor |
Returns
void
Scaled
▸ Scaled(s): Mx3dGeVec
Return the scaled vector.
Parameters
| Name | Type | Description |
|---|---|---|
| S | number | scaling factor |
Returns
The scaled vector.
SetLinearForm
▸ SetLinearForm(v1, v2): void
Set the current vector as a linear combination.
Parameters
| Name | Type | Description |
|---|---|---|
| V1 | [Mx3dGeVec] (Mx3dGeVec. md) | Vector 1 |
| V2 | [Mx3dGeVec] (Mx3dGeVec. md) | Vector 2 |
Returns
void
▸ SetLinearForm(a1, v1, v2): void
Parameters
| Name | Type |
|---|---|
a1 | number |
v1 | Mx3dGeVec |
v2 | Mx3dGeVec |
Returns
void
▸ SetLinearForm(a1, v1, a2, v2): void
Parameters
| Name | Type |
|---|---|
a1 | number |
v1 | Mx3dGeVec |
a2 | number |
v2 | Mx3dGeVec |
Returns
void
▸ SetLinearForm(a1, v1, a2, v2, v3): void
Parameters
| Name | Type |
|---|---|
a1 | number |
v1 | Mx3dGeVec |
a2 | number |
v2 | Mx3dGeVec |
v3 | Mx3dGeVec |
Returns
void
▸ SetLinearForm(a1, v1, a2, v2, a3, v3): void
Parameters
| Name | Type |
|---|---|
a1 | number |
v1 | Mx3dGeVec |
a2 | number |
v2 | Mx3dGeVec |
a3 | number |
v3 | Mx3dGeVec |
Returns
void
▸ SetLinearForm(a1, v1, a2, v2, a3, v3, v4): void
Parameters
| Name | Type |
|---|---|
a1 | number |
v1 | Mx3dGeVec |
a2 | number |
v2 | Mx3dGeVec |
a3 | number |
v3 | Mx3dGeVec |
v4 | Mx3dGeVec |
Returns
void
SetX
▸ SetX(x): void
Set the x-component of the vector.
Parameters
| Name | Type | Description |
|---|---|---|
| X | number | New x component |
Returns
void
SetXYZ
▸ SetXYZ(x, y, z): void
Set the x of the vector, Y and z components.
Parameters
| Name | Type | Description |
|---|---|---|
| X | number | New x component |
| Y | number | New y component |
| Z | number | New z component |
Returns
void
SetY
▸ SetY(y): void
Set the y-component of the vector.
Parameters
| Name | Type | Description |
|---|---|---|
| Y | number | New y component |
Returns
void
SetZ
▸ SetZ(z): void
Set the z-component of the vector.
Parameters
| Name | Type | Description |
|---|---|---|
| Z | number | New 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
| Name | Type | Description |
|---|---|---|
right | [Mx3dGeVec] (Mx3dGeVec. md) | Another vector |
Returns
void
Subtracted
▸ Subtracted(right): Mx3dGeVec
Return the result of subtracting another vector from the current vector.
Parameters
| Name | Type | Description |
|---|---|---|
right | [Mx3dGeVec] (Mx3dGeVec. md) | Another vector |
Returns
Subtracted vector.
Transform
▸ Transform(t): void
Transform the current vector based on the coordinate system.
Parameters
| Name | Type |
|---|---|
t | Mx3dGeTrsf |
Returns
void
Transformed
▸ Transformed(t): Mx3dGeVec
Return the vector transformed according to the coordinate system.
Parameters
| Name | Type |
|---|---|
t | Mx3dGeTrsf |
Returns
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.