Find if it 's possible to rotate the page by an angle or not. | C ++ program to find if its possible to rotate page or not ; function to find if it 's possible to rotate page or not ; Calculating distance b / w points ; If distance is not equal ; If the points are in same line ; Driver Code ; Points a , b , and c
#include <bits/stdc++.h> NEW_LINE using namespace std ; void possibleOrNot ( long long a1 , long long a2 , long long b1 , long long b2 , long long c1 , long long c2 ) { long long dis1 = pow ( b1 - a1 , 2 ) + pow ( b2 - a2 , 2 ) ; long long dis2 = pow ( c1 - b1 , 2 ) + pow ( c2 - b2 , 2 ) ; if ( dis1 != dis2 ) cout << " No " ; else if ( b1 == ( ( a1 + c1 ) / 2.0 ) && b2 == ( ( a2 + c2 ) / 2.0 ) ) cout << " No " ; else cout << " Yes " ; } int main ( ) { ios_base :: sync_with_stdio ( false ) ; cin . tie ( NULL ) ; long long a1 = 1 , a2 = 0 , b1 = 2 , b2 = 0 , c1 = 3 , c2 = 0 ; possibleOrNot ( a1 , a2 , b1 , b2 , c1 , c2 ) ; return 0 ; }