ChrisVilches / Algorithms

Solutions for competitive programming problems in various online judges such as Kattis, SPOJ, URI Online Judge, etc.
5 stars 0 forks source link

Strange code in asteroids.cpp #17

Closed ChrisVilches closed 2 years ago

ChrisVilches commented 2 years ago

kattis/asteroids.cpp

Should be bool type.

  pair<bool, Point> intersect_non_collinear(const Segment& s) const {
    const ld o1 = orientation(p, q, s.p) != orientation(p, q, s.q);
    const ld o2 = orientation(s.p, s.q, p) != orientation(s.p, s.q, q);
    return o1 && o2 ? make_pair(true, intersection_point(s)) : make_pair(false, Point{});
  }
ChrisVilches commented 2 years ago

And maybe in other files where I used the same algorithm...

ChrisVilches commented 2 years ago

Done kattis-asteroids and uva-polygons