Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char trojkat(int x1, int y1, int x2, int y2, int x3, int y3)
- {
- using std::sqrt;
- using std::pow;
- using std::min;
- using std::max;
- double bok12 = sqrt( pow(x2-x1, 2) + pow(y2-y1, 2) );
- double bok23 = sqrt( pow(x3-x2, 2) + pow(y3-y2, 2) );
- double bok13 = sqrt( pow(x3-x1, 2) + pow(y3-y1, 2) );
- double a = min({bok12, bok23, bok13});
- double b = max({
- min(bok12, bok23),
- min(bok12, bok13),
- min(bok23, bok13) });
- double c = max({bok12, bok23, bok13});
- double diff = c*c - (a*a + b*b);
- if (diff < 0.000001) {
- return 'P';
- } else if (diff > 0) {
- return 'R';
- } else {
- return 'O';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement