Advertisement
Guest User

Untitled

a guest
Jul 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. int isInInterval(point_t *P1, point_t *P2, point_t *a){
  2.     int ans1 = (((DoubleRound(P1->x) < DoubleRound(a->x)) && (DoubleRound(a->x) <= DoubleRound(P2->x)))
  3.         ||((DoubleRound(P1->y) < DoubleRound(a->y)) && (DoubleRound(a->y) <= DoubleRound(P2->y))));
  4.     int ans2 = (((DoubleRound(P2->x) <= DoubleRound(a->x)) && (DoubleRound(a->x) < DoubleRound(P1->x)))
  5.         || ((DoubleRound(P2->y) <= DoubleRound(a->y)) && (DoubleRound(a->y) < DoubleRound(P1->y))));
  6.     return (ans1 || ans2);
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement