Skip to content

Instantly share code, notes, and snippets.

@ergo70
Created January 18, 2019 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ergo70/9ecc48d858c18bb22bc19feec93b80a2 to your computer and use it in GitHub Desktop.
Save ergo70/9ecc48d858c18bb22bc19feec93b80a2 to your computer and use it in GitHub Desktop.
orientation.py
from vectors import Vector
from math import atan2
v1 = Vector(70.47130647130646,93.56190476190476,316.37118437118437) # Schreibtisch
v2 = Vector(73.91990231990232,96.26080586080586,328.06642246642247) # Schreibtisch + 20 h
v3 = Vector(-87.71428571428571,-183.37533577533577,-63.27423687423687) # Fenster
m1 = v1.magnitude()
m2 = v2.magnitude()
m3 = v3.magnitude()
a1 = v1.angle(v2)
a2 = v1.angle(v3)
print(m1, m2, m3) #TMI
print(a1, a2)
h1=180-atan2(v1.x, v1.y)/0.0174532925 # 359=N, 90=E, 180=S, 270=W
h2=180-atan2(v2.x, v2.y)/0.0174532925 # 359=N, 90=E, 180=S, 270=W
h3=180-atan2(v3.x, v3.y)/0.0174532925 # 359=N, 90=E, 180=S, 270=W
print(h1, h2, h3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment