Revision 9a250b6f4fe5d73008effba15a4030051d7ccd9c (click the page title to view the current version)
#! /usr/bin/env python3
import numpy as np
import numpy.linalg as linalg
K = np.array( [ [ 2, 1/np.sqrt(3), 4 ],
[ 0, 2, 4 ],
[ 0, 0, 1 ] )
S = linalg.inv(K.T) @ linalg.inv( K )
def innerproduct(a,b): return a.T @ S @ b
def angle(a,b): return np.acos( (a.T @ b) /
np.sqrt( innerproduct(a,a) * innerproduct(b,b) ) )
A = np.array( [ 0,0,1 ] ).reshape(3,1)
B = np.array( [ 2,0,1 ] ).reshape(3,1)
C = np.array( [ 2,1,1 ] ).reshape(3,1)
A0 = K @ A
B0 = K @ B
C0 = K @ C
print ( "A' = ", A0 )
print ( "B' = ", B0 )
print ( "C' = ", C0 )
alpha0 = angle( B0-A0, C0-A0 )
beta0 = angle( B0-C0, A0-C0 )
print ( "alpha0", alpha0 )
print ( "beta0", beta0 )