Program to find X , Y and Z intercepts of a plane | Javascript program to find the X , Y and Z intercepts of a plane ; For finding the x - intercept put y = 0 and z = 0 ; For finding the y - intercept put x = 0 and z = 0 ; For finding the z - intercept put x = 0 and y = 0 ; For Finding value of A , B , C , D ; Calling the first created function ; Driver Code
function XandYandZintercept ( A , B , C , D ) { let rslt = new Array ( 3 ) ; let x = - D / A ; let y = - D / B ; let z = - D / C ; rslt [ 0 ] = x ; rslt [ 1 ] = y ; rslt [ 2 ] = z ; return rslt ; } function equation_plane ( p , q , r ) { let x1 = p [ 0 ] ; let y1 = p [ 1 ] ; let z1 = p [ 2 ] ; let x2 = q [ 0 ] ; let y2 = q [ 1 ] ; let z2 = q [ 2 ] ; let x3 = r [ 0 ] ; let y3 = r [ 1 ] ; let z3 = r [ 2 ] ; let a1 = x2 - x1 ; let b1 = y2 - y1 ; let c1 = z2 - z1 ; let a2 = x3 - x1 ; let b2 = y3 - y1 ; let c2 = z3 - z1 ; let A = b1 * c2 - b2 * c1 ; let B = a2 * c1 - a1 * c2 ; let C = a1 * b2 - b1 * a2 ; let D = ( - A * x1 - B * y1 - C * z1 ) ; let rslt = XandYandZintercept ( A , B , C , D ) ; for ( let i = 0 ; i < 3 ; i ++ ) { document . write ( rslt [ i ] + " " ) ; } } let x1 = - 1 ; let y1 = 2 ; let z1 = 1 ; let x2 = 0 ; let y2 = - 3 ; let z2 = 2 ; let x3 = 1 ; let y3 = 1 ; let z3 = - 4 ; let p = [ x1 , y1 , z1 ] ; let q = [ x2 , y2 , z2 ] ; let r = [ x3 , y3 , z3 ] ; equation_plane ( p , q , r ) ;