Skip to content

Commit 888dd17

Browse files
committed
merged
2 parents 63425c3 + c849ad6 commit 888dd17

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

content/geometry/lineIntersection.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Source:
66
* Description:\\
77
\begin{minipage}{75mm}
8-
If a unique intersection point of the lines going through s1,e1 and s2,e2 exists r is set to this point and 1 is returned. If no intersection point exists 0 is returned and if infinitely many exists -1 is returned. If s1==e1 or s2==e2 -1 is returned. The wrong position will be returned if P is Point<int> and the intersection point does not have integer coordinates. Products of three coordinates are used in intermediate steps so watch out for overflow if using int or long long.
8+
If a unique intersection point of the lines going through s1,e1 and s2,e2 exists r is set to this point and 1 is returned. If no intersection point exists 0 is returned and if infinitely many exists -1 is returned. If s1==e1 or s2==e2 -1 is returned. The wrong position will be returned if P is Point<ll> and the intersection point does not have integer coordinates. Products of three coordinates are used in intermediate steps so watch out for overflow if using int or long long.
99
\end{minipage}
1010
\begin{minipage}{15mm}
1111
\includegraphics[width=\textwidth]{content/geometry/lineIntersection}
@@ -21,7 +21,7 @@ If a unique intersection point of the lines going through s1,e1 and s2,e2 exists
2121
#include "Point.h"
2222

2323
template<class P>
24-
pair<int, P> lineIntersection(P s1, P e1, P s2, P e2) {
24+
pair<int, P> lineInter(P s1, P e1, P s2, P e2) {
2525
auto d = (e1-s1).cross(e2-s2);
2626
if (d == 0) //if parallel
2727
return {-((e1-s1).cross(s2-s1)==0 || s2==e2), P(0,0)};

content/geometry/onSegment.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
* Date: 2019-04-26
44
* License: CC0
55
* Source: https://vlecomte.github.io/cp-geo.pdf
6-
* Description: Returns true iff p lies on the line segment from s to e. Intended for use with e.g. Point<long long> where overflow is an issue. Use (segDist(s,e,p)<=epsilon) instead when using Point<double>.
6+
* Description: Returns true iff p lies on the line segment from s to e. Intended for use with e.g. Point<ll> where overflow is an issue. Use \texttt{(segDist(s,e,p)<=epsilon)} instead when using Point<double>.
77
* Status:
88
*/
99
#pragma once
1010

1111
#include "Point.h"
1212

13-
template <class P> bool onSegment(P s, P e, P p) {
13+
template<class P> bool onSegment(P s, P e, P p) {
1414
return p.cross(s, e) == 0 && (s - p).dot(e - p) <= 0;
1515
}

0 commit comments

Comments
 (0)