Skip to content

Commit d2e700a

Browse files
committed
removed automatic epsilon checks
1 parent bccd1cb commit d2e700a

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

content/geometry/Point.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
*/
1010
#pragma once
1111

12-
const double EPS=1e-8;
13-
template <typename T> int sgn(T x) { return x < -EPS ? -1 : x > EPS; }
12+
template <typename T> int sgn(T x) { return (x>0) - (x<0);}
1413
template<class T>
1514
struct Point {
1615
typedef Point P;

content/geometry/onSegment.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
#include "Point.h"
1212

1313
template <class P> bool onSegment(P s, P e, P p) {
14-
return sgn(s.cross(e, p)) == 0 &&
15-
sgn((s - p).dot(e - p)) <= 0;
14+
return s.cross(e, p) == 0 &&
15+
(s - p).dot(e - p) <= 0;
1616
}

0 commit comments

Comments
 (0)