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 Ξ±