Find mirror image of a point in 2 | JavaScript function which finds coordinates of mirror image . This function return a pair of double ; Driver code to test above function
function mirrorImage ( a , b , c , x1 , y1 ) { var temp = ( - 2 * ( a * x1 + b * y1 + c ) ) / ( a * a + b * b ) ; var x = temp * a + x1 ; var y = temp * b + y1 ; return [ x , y ] ; } var a = - 1.0 ; var b = 1.0 ; var c = 0.0 ; var x1 = 1.0 ; var y1 = 0.0 ; var [ x , y ] = mirrorImage ( a , b , c , x1 , y1 ) ; document . write ( " " + x1 + " " + y1 + " " ) ; document . write ( " " + a + " " + b + " " + c + " " ) ; document . write ( " " + x + " " + y + " " ) ;