def fast_cross_3d(x, y):
 assert (x.ndim == 2)
 assert (y.ndim == 2)
 assert (x.shape[1] == 3)
 assert (y.shape[1] == 3)
 assert (((x.shape[0] == 1) or (y.shape[0] == 1)) or (x.shape[0] == y.shape[0]))
 if (max([x.shape[0], y.shape[0]]) >= 500):
  return np.c_[(((x[:, 1] * y[:, 2]) - (x[:, 2] * y[:, 1])), ((x[:, 2] * y[:, 0]) - (x[:, 0] * y[:, 2])), ((x[:, 0] * y[:, 1]) - (x[:, 1] * y[:, 0])))]
 else:
  return np.cross(x, y)

def fast_cross_3d ( x , y ) : assert ( x . ndim == 2 ) assert ( y . ndim == 2 ) assert ( x . shape [ 1 ] == 3 ) assert ( y . shape [ 1 ] == 3 ) assert ( ( ( x . shape [ 0 ] == 1 ) or ( y . shape [ 0 ] == 1 ) ) or ( x . shape [ 0 ] == y . shape [ 0 ] ) ) if ( max ( [ x . shape [ 0 ] , y . shape [ 0 ] ] ) >= 500 ) : return np . c_ [ ( ( ( x [ : , 1 ] * y [ : , 2 ] ) - ( x [ : , 2 ] * y [ : , 1 ] ) ) , ( ( x [ : , 2 ] * y [ : , 0 ] ) - ( x [ : , 0 ] * y [ : , 2 ] ) ) , ( ( x [ : , 0 ] * y [ : , 1 ] ) - ( x [ : , 1 ] * y [ : , 0 ] ) ) ) ] else : return np . cross ( x , y )
compute cross product between list of 3d vectors .