7. Vectors - JulTob/Analysis GitHub Wiki
Vectors
Vectors can be used for geometry.
type Coordinates is (X, Y, Z);
type Vector is array (Coordinates) of Float;
Vector adition
function "+" (L, R : Vector) return Vector
is
Result: Vector;
begin
Result(X) := L(X) + R(X); Result(Y) := L(Y) + R(Y); Result(Z) := L(Z) + R(Z);
return Result;
end "+"
Triangle
π΄Μ + π΅Μ + πΆΜ = 0
Vector decomposition
π΄Μ = π΄Β·uπ΄Μ
π΄Μ_π΅ = π΄_π΅ Β· uπ΅Μ
π΄_π΅ = π΄ΜΒ·uπ΅Μ
π·β = π΄Μ - π΄Μ_π΅
Lines
The points of a Line are defined { πββ + πΒ·π·β } Such as πββ is a point on the line and π·β is the direction, making the points of the line a scalation of that vector, making the scalar π an β set.
type Line is record
Point : Vector := (0,0,0)
Direction : Vector := (1,0,0)
end record;
Distance of two lines
- Line A: Reference Point O'
- Line B:
- Random Point B1'
- Closest point to A: Ba'
- Distance D
πΜ : ABa' Β· AB1' = cos Ξ±