Determine position of two points with respect to a 3D plane | Function to check position of two points with respect to a plane in 3D ; Put coordinates in plane equation ; If both values have same sign ; If both values have different sign ; If both values are zero ; If either of the two values is zero ; Given Input ; Coordinates of points ; Function Call
function check_position ( a , b , c , d , x1 , y1 , z1 , x2 , y2 , z2 ) { var value_1 = a * x1 + b * y1 + c * z1 + d ; var value_2 = a * x2 + b * y2 + c * z2 + d ; if ( ( value_1 > 0 && value_2 > 0 ) || ( value_1 < 0 && value_2 < 0 ) ) document . write ( " " ) ; if ( ( value_1 > 0 && value_2 < 0 ) || ( value_1 < 0 && value_2 > 0 ) ) document . write ( " " ) ; if ( value_1 == 0 && value_2 == 0 ) document . write ( " " ) ; if ( value_1 == 0 && value_2 != 0 ) document . write ( " " ) ; if ( value_1 != 0 && value_2 == 0 ) document . write ( " " ) ; } var a = 1 , b = 2 , c = 3 , d = 4 ; var x1 = - 2 , y1 = - 2 , z1 = 1 ; var x2 = - 4 , y2 = 11 , z2 = - 1 ; check_position ( a , b , c , d , x1 , y1 , z1 , x2 , y2 , z2 ) ;