We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bccd1cb commit d2e700aCopy full SHA for d2e700a
content/geometry/Point.h
@@ -9,8 +9,7 @@
9
*/
10
#pragma once
11
12
-const double EPS=1e-8;
13
-template <typename T> int sgn(T x) { return x < -EPS ? -1 : x > EPS; }
+template <typename T> int sgn(T x) { return (x>0) - (x<0);}
14
template<class T>
15
struct Point {
16
typedef Point P;
content/geometry/onSegment.h
@@ -11,6 +11,6 @@
#include "Point.h"
template <class P> bool onSegment(P s, P e, P p) {
- return sgn(s.cross(e, p)) == 0 &&
- sgn((s - p).dot(e - p)) <= 0;
+ return s.cross(e, p) == 0 &&
+ (s - p).dot(e - p) <= 0;
}
0 commit comments