Find coordinates of the triangle given midpoint of each side | PHP program to find coordinate of the triangle given midpoint of each side ; Return after solving the equations and finding the vertices coordinate . ; Finding sum of all three coordinate . ; Solving the equation . ; Finds vertices of a triangles from given middle vertices . ; Find X coordinates of vertices . ; Find Y coordinates of vertices . ; Output the solution . ; Driver code
< ? php $ N = 3 ; function solve ( $ v ) { $ res = array ( ) ; $ all3 = $ v [ 0 ] + $ v [ 1 ] + $ v [ 2 ] ; array_push ( $ res , $ all3 - $ v [ 1 ] * 2 ) ; array_push ( $ res , $ all3 - $ v [ 2 ] * 2 ) ; array_push ( $ res , $ all3 - $ v [ 0 ] * 2 ) ; return $ res ; } function findVertex ( $ xmid , $ ymid ) { $ V1 = solve ( $ xmid ) ; $ V2 = solve ( $ ymid ) ; for ( $ i = 0 ; $ i < 3 ; $ i ++ ) print ( $ V1 [ $ i ] . " ▁ " . $ V2 [ $ i ] . " STRNEWLINE " ) ; } $ xmid = array ( 5 , 4 , 5 ) ; $ ymid = array ( 3 , 4 , 5 ) ; findVertex ( $ xmid , $ ymid ) ? >