MACRO VBA FOR FUNDAMENTAL VECTORS HANDLING - SanjoyNath/SanjoyNathGeometrifyingTrigonometry GitHub Wiki
Public Type SAANSOLTEK_VECTOR_TYPE X As Double Y As Double Z As Double
End Type 'Public Type SAANSOLTEK_VECTOR_TYPE
Public Function GET_LENGTH_OF_SAANSOLTEC_VECTOR(VECT As SAANSOLTEK_VECTOR_TYPE) As Double
GET_LENGTH_OF_SAANSOLTEC_VECTOR = (((VECT.X ^ 2) + (VECT.Y ^ 2) + (VECT.Z ^ 2)) ^ 0.5)
End Function 'Public Function GET_LENGTH_OF_SAANSOLTEC_VECTOR(VECT As SAANSOLTEK_VECTOR) As Double
Public Function GET_UNIT_VECTOR_OF_SAANSOLTEC_VECTOR(VECT As SAANSOLTEK_VECTOR_TYPE) As SAANSOLTEK_VECTOR_TYPE Dim LENGTH_OF_VECTOR As Double LENGTH_OF_VECTOR = 0 LENGTH_OF_VECTOR = (((VECT.X ^ 2) + (VECT.Y ^ 2) + (VECT.Z ^ 2)) ^ 0.5)
Dim TEMP_RETURNING_VECTOR As SAANSOLTEK_VECTOR_TYPE
TEMP_RETURNING_VECTOR.X = VECT.X / LENGTH_OF_VECTOR TEMP_RETURNING_VECTOR.Y = VECT.Y / LENGTH_OF_VECTOR TEMP_RETURNING_VECTOR.Z = VECT.Z / LENGTH_OF_VECTOR
GET_UNIT_VECTOR_OF_SAANSOLTEC_VECTOR = TEMP_RETURNING_VECTOR
End Function 'Public Function GET_UNIT_VECTOR_OF_SAANSOLTEC_VECTOR(VECT As SAANSOLTEK_VECTOR) As SAANSOLTEK_VECTOR
Public Function GET_SAANSOLTEC_VECTOR_FROM_POINT(INPUT_POINT As SAANSOLTEK_POINT_TYPE) As SAANSOLTEK_VECTOR_TYPE
Dim TEMP_VECTOR As SAANSOLTEK_VECTOR_TYPE
TEMP_VECTOR.X = INPUT_POINT.X TEMP_VECTOR.Y = INPUT_POINT.Y TEMP_VECTOR.Z = INPUT_POINT.Z
GET_SAANSOLTEC_VECTOR_FROM_POINT = TEMP_VECTOR
End Function 'Public Function GET_SAANSOLTEC_VECTOR_FROM_POINT(INPUT_POINT As SAANSOLTEK_POINT_TYPE) As SAANSOLTEK_VECTOR
Public Function GET_SAANSOLTEC_TRANSLATED_POINT_FROM_POINT(INPUT_POINT As SAANSOLTEK_POINT_TYPE, VECT As SAANSOLTEK_VECTOR_TYPE) As SAANSOLTEK_POINT_TYPE
Dim TEMP_POINT As SAANSOLTEK_POINT_TYPE
TEMP_VECTOR.X = INPUT_POINT.X + VECT.X TEMP_VECTOR.Y = INPUT_POINT.Y + VECT.Y TEMP_VECTOR.Z = INPUT_POINT.Z + VECT.Z
GET_SAANSOLTEC_TRANSLATED_POINT_FROM_POINT = TEMP_POINT
End Function 'Public Function GET_SAANSOLTEC_VECTOR_FROM_POINT(INPUT_POINT As SAANSOLTEK_POINT_TYPE) As SAANSOLTEK_VECTOR
Public Function GET_NORMAL_VECTOR_OF_TWO_GIVEN_VECTORS(VECT_1 As SAANSOLTEK_VECTOR_TYPE, VECT_2 As SAANSOLTEK_VECTOR_TYPE) As SAANSOLTEK_VECTOR_TYPE
Dim X1, Y1, Z1, X2, Y2, Z2 As Double
X1 = VECT_1.X Y1 = VECT_1.Y Z1 = VECT_1.Z
X2 = VECT_2.X Y2 = VECT_2.Y Z2 = VECT_2.Z
Dim TEMP_NORMAL_VECTOR As SAANSOLTEK_VECTOR_TYPE
TEMP_NORMAL_VECTOR.X = (Y1 * Z2 - Y2 * Z1) TEMP_NORMAL_VECTOR.Y = (-1) * (X1 * Z2 - X2 * Z1) TEMP_NORMAL_VECTOR.Z = (X1 * Y2 - X2 * Y1)
GET_NORMAL_VECTOR_OF_TWO_GIVEN_VECTORS = TEMP_NORMAL_VECTOR
End Function 'Public Function GET_NORMAL_VECTOR_OF_TWO_GIVEN_VECTORS(VECT_1 As SAANSOLTEK_VECTOR_TYPE, VECT_2 As SAANSOLTEK_VECTOR_TYPE) As SAANSOLTEK_VECTOR_TYPE
Public Function GET_NORMAL_UNIT_VECTOR_OF_TWO_GIVEN_VECTORS(VECT_1 As SAANSOLTEK_VECTOR_TYPE, VECT_2 As SAANSOLTEK_VECTOR_TYPE) As SAANSOLTEK_VECTOR_TYPE
Dim X1, Y1, Z1, X2, Y2, Z2 As Double
X1 = VECT_1.X Y1 = VECT_1.Y Z1 = VECT_1.Z
X2 = VECT_2.X Y2 = VECT_2.Y Z2 = VECT_2.Z
Dim TEMP_NORMAL_VECTOR As SAANSOLTEK_VECTOR_TYPE
TEMP_NORMAL_VECTOR.X = (Y1 * Z2 - Y2 * Z1) TEMP_NORMAL_VECTOR.Y = (-1) * (X1 * Z2 - X2 * Z1) TEMP_NORMAL_VECTOR.Z = (X1 * Y2 - X2 * Y1)
GET_NORMAL_UNIT_VECTOR_OF_TWO_GIVEN_VECTORS = GET_UNIT_VECTOR_OF_SAANSOLTEC_VECTOR(TEMP_NORMAL_VECTOR)
End Function 'Public Function GET_NORMAL_VECTOR_OF_TWO_GIVEN_VECTORS(VECT_1 As SAANSOLTEK_VECTOR_TYPE, VECT_2 As SAANSOLTEK_VECTOR_TYPE) As SAANSOLTEK_VECTOR_TYPE