Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 02cca5e

Browse files
author
Tushar Roy
committed
Update docs on Jarvis March
1 parent b411099 commit 02cca5e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎src/com/interview/geometry/JarvisMarchConvexHull.java‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ public List<Point> findConvexHull(Point[] points) {
9191
}
9292

9393
/**
94-
* Returns < 0 if b is closer to a compared to c, == 0 if b and c are same distance from a
95-
* or > 0 if c is closer to a compared to b.
94+
* Returns < 0 if 'b' is closer to 'a' compared to 'c', == 0 if 'b' and 'c' are same distance from 'a'
95+
* or > 0 if 'c' is closer to 'a' compared to 'b'.
9696
*/
9797
private int distance(Point a, Point b, Point c) {
9898
int y1 = a.y - b.y;
@@ -104,6 +104,9 @@ private int distance(Point a, Point b, Point c) {
104104

105105
/**
106106
* Cross product to find where c belongs in reference to vector ab.
107+
* If result > 0 it means 'c' is on left of ab
108+
* result == 0 it means 'a','b' and 'c' are collinear
109+
* result < 0 it means 'c' is on right of ab
107110
*/
108111
private int crossProduct(Point a, Point b, Point c) {
109112
int y1 = a.y - b.y;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /