Coreform Cubit 2022.9 & 2022.11 - Fedora
Truely mind bending error, I have a python script which takes in a bunch of planes, does some maths - largely irrelevant. However, I’ve spent an ungodly amount of time tracking this down, but bizzarely, when running the same script inside of Coreform Cubit and in my system python I get different results!
When I run this script;
#!/usr/env/python3
import numpy as np
def plane_intersect(a, b):
a_vec, b_vec = np.array(a[:3]), np.array(b[:3])
aXb_vec = np.cross(a_vec, b_vec)
A = np.array([a_vec, b_vec, aXb_vec])
d = np.array([-a[3], -b[3], 0.]).reshape(3,1)
# could add np.linalg.det(A) == 0 test to prevent linalg.solve throwing error
print(f'A={A}')
print(f'd={d}')
p_inter = np.linalg.solve(A, d).T
return p_inter[0]
plane1 = [0,0,-1,0.946948223999989]
plane2 = [0,1,0,-0.124051900705194]
x = plane_intersect(plane1,plane2)
print(x)
print(np.__version__)
On my system I get; - which is the correct result
A=[[ 0 0 -1]
[ 0 1 0]
[ 1 0 0]]
d=[[-0.94694822]
[ 0.1240519 ]
[ 0. ]]
[0. 0.1240519 0.94694822]
1.22.0
Inside of Cubit I get
A=[[ 0. 0. -1.]
[ 0. 1. 0.]
[ 1. -0. 0.]]
d=[[-0.94694822]
[ 0.1240519 ]
[ 0. ]]
[[-0.94694822 0.1240519 0. ]]
array([-0.94694822, 0.1240519 , 0. ])
Note how the inputs are identical, but the output vector is reversed!
I am at a loss to explain this, any ideas?