hexagon logo

real cross product function

Here a little code to avoid the problem of applying "UNIT" to "CROSS" in the tool box (the cross product of the tool box gives a vector of length = 1 even if the vectors are parallels - in this case, a real cross product gives <0,0,0>Wink
Thanks to davehocum and !

F1 =GENERIC/PLANE,DEPENDENT,CARTESIAN,$
NOM/XYZ,<10,5,0>,$
MEAS/XYZ,<10,5,0>,$
NOM/IJK,<0.9922779,0,0.1240347>,$
MEAS/IJK,<0.9922779,0,0.1240347>
F2 =GENERIC/PLANE,DEPENDENT,CARTESIAN,$
NOM/XYZ,<-3,0,10>,$
MEAS/XYZ,<-3,0,10>,$
NOM/IJK,<0.5,0.7071068,0.5>,$
MEAS/IJK,<0.5,0.7071068,0.5>
ASSIGN/V1="F1"
ASSIGN/V2="F2"
ASSIGN/REAL_CROSS=FUNCTION((A,B),MPOINT(A.J*B.K-A.K*B.J,A.K*B.I-A.I*B.K,A.I*B.J-A.J*B.I))
ASSIGN/V3=REAL_CROSS(V1,V2)
ASSIGN/V4=F1.XYZ-F2.XYZ
ASSIGN/V5=MPOINT(10,-2,10)
ASSIGN/V6="V4"
ASSIGN/V7="V5"
ASSIGN/V8=REAL_CROSS(V6,V7)


I didn't found a way to use directly F1 instead of V​1="F1".
It gives <0,0,0> for ASSIGN/V8=REAL_CROSS(V6,V6) Slight smile

As usual, I'm not sure that it's usefull...
Parents Reply Children
No Data