Coplanarity of Two Lines in 3D Geometry | Function to generate determinant ; Return the sum ; Position vector of first line ; Direction ratios of line to which first line is parallel ; Position vectors of second line ; Direction ratios of line to which second line is parallel ; Determinant to check coplanarity ; If determinant is zero ; Otherwise
function det ( d ) { let Sum = d [ 0 ] [ 0 ] * ( ( d [ 1 ] [ 1 ] * d [ 2 ] [ 2 ] ) - ( d [ 2 ] [ 1 ] * d [ 1 ] [ 2 ] ) ) ; Sum -= d [ 0 ] [ 1 ] * ( ( d [ 1 ] [ 0 ] * d [ 2 ] [ 2 ] ) - ( d [ 1 ] [ 2 ] * d [ 2 ] [ 0 ] ) ) ; Sum += d [ 0 ] [ 2 ] * ( ( d [ 0 ] [ 1 ] * d [ 1 ] [ 2 ] ) - ( d [ 0 ] [ 2 ] * d [ 1 ] [ 1 ] ) ) ; return Sum ; } let x1 = - 3 , y1 = 1 , z1 = 5 ; let a1 = - 3 , b1 = 1 , c1 = 5 ; let x2 = - 1 , y2 = 2 , z2 = 5 ; let a2 = - 1 , b2 = 2 , c2 = 5 ; let det_list = [ [ x2 - x1 , y2 - y1 , z2 - z1 ] , [ a1 , b1 , c1 ] , [ a2 , b2 , c2 ] ] ; if ( det ( det_list ) == 0 ) document . write ( " " ) ; else document . write ( " " ) ;