function vdet(v1, v2, /*optional*/ v3) {
  if(Math.min(v1.length,v2.length) == 2)  // 2x2 determinant
    return (v1[0]*v2[1])-(v1[1]*v2[0]);
  else if(Math.min(v1.length,v2.length,v3.length) == 3 && v3) // 3x3 determinant
    return (v1[0]*vdet([v2[1],v2[2]],[v3[1],v3[2]])
          - v1[1]*vdet([v2[0],v2[2]],[v3[0],v3[2]])
          + v1[2]*vdet([v2[0],v2[1]],[v3[0],v3[1]]));
}
/**
 ** Compute determinant of 2D/3D vectors
 ** Remember: May return negative values (undesirable in some situations)
 */
Compute determinant of 2D/3D vectors
Remember: May return negative values (undesirable in some situations)
Compute determinant of 2D / 3D vectors Remember : May return negative values ( undesirable in some situations )
function vdet(v1, v2,  v3) {
  if(Math.min(v1.length,v2.length) == 2)  
    return (v1[0]*v2[1])-(v1[1]*v2[0]);
  else if(Math.min(v1.length,v2.length,v3.length) == 3 && v3) 
    return (v1[0]*vdet([v2[1],v2[2]],[v3[1],v3[2]])
          - v1[1]*vdet([v2[0],v2[2]],[v3[0],v3[2]])
          + v1[2]*vdet([v2[0],v2[1]],[v3[0],v3[1]]));
}
function vdet ( v1 , v2 , v3 ) { if ( Math . min ( v1 . length , v2 . length ) == 2 ) return ( v1 [ 0 ] * v2 [ 1 ] ) - ( v1 [ 1 ] * v2 [ 0 ] ) ; else if ( Math . min ( v1 . length , v2 . length , v3 . length ) == 3 && v3 ) return ( v1 [ 0 ] * vdet ( [ v2 [ 1 ] , v2 [ 2 ] ] , [ v3 [ 1 ] , v3 [ 2 ] ] ) - v1 [ 1 ] * vdet ( [ v2 [ 0 ] , v2 [ 2 ] ] , [ v3 [ 0 ] , v3 [ 2 ] ] ) + v1 [ 2 ] * vdet ( [ v2 [ 0 ] , v2 [ 1 ] ] , [ v3 [ 0 ] , v3 [ 1 ] ] ) ) ; }
Compute determinant of 2D/3D vectors
 Remember: May return negative values (undesirable in some situations)
Compute determinant of 2D / 3D vectors Remember : May return negative values ( undesirable in some situations )
/*optional*/ // 2x2 determinant // 3x3 determinant