Skip to content

Commit

Permalink
rename jarvis
Browse files Browse the repository at this point in the history
  • Loading branch information
mamantoha committed Dec 10, 2019
1 parent cafa10c commit 6601f88
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/lib/
/bin/
/.shards/
/.vscode/
*.dwarf

# Libraries don't need dependency lock
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

Crystal implementation of finding the convex hull of a finite set of points in the plane.

Supported method:
Supported algorithms:

- [Gift wrapping algorithm](https://en.wikipedia.org/wiki/Gift_wrapping_algorithm)
- [Jarvis march](https://en.wikipedia.org/wiki/Gift_wrapping_algorithm)
- [Graham scan](https://en.wikipedia.org/wiki/Graham_scan)

## Installation
Expand All @@ -31,8 +31,8 @@ points = [{0, 3}, {2, 2}, {1, 1}, {2, 1}, {3, 0}, {0, 0}, {3, 3}]
graham_scan = ConvexHull::GrahamScan.new(points)
graham_scan.convex_hull.should eq(expected)
jarvis = ConvexHull::Jarvis.new(points)
jarvis.convex_hull.should eq(expected)
jarvis_march = ConvexHull::JarvisMarch.new(points)
jarvis_march.convex_hull.should eq(expected)
```

## Contributing
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "../spec_helper"

describe ConvexHull::Jarvis do
describe ConvexHull::JarvisMarch do
it "integers" do
points = [
{0, 3},
Expand All @@ -16,7 +16,7 @@ describe ConvexHull::Jarvis do
{0, 3}, {0, 0}, {3, 0}, {3, 3},
].map { |point| ConvexHull::Point.new(point[0], point[1]) }

jarvis = ConvexHull::Jarvis.new(points)
jarvis = ConvexHull::JarvisMarch.new(points)
jarvis.convex_hull.should eq(expected)
end

Expand All @@ -35,7 +35,7 @@ describe ConvexHull::Jarvis do
{0.0, 3.0}, {0.0, 0.0}, {3.0, 0.0}, {3.0, 3.0},
].map { |point| ConvexHull::Point.new(point[0], point[1]) }

jarvis = ConvexHull::Jarvis.new(points)
jarvis = ConvexHull::JarvisMarch.new(points)
jarvis.convex_hull.should eq(expected)
end

Expand All @@ -46,7 +46,7 @@ describe ConvexHull::Jarvis do
{-1, 1}, {-1, -1}, {1, -1}, {1, 1},
].map { |point| ConvexHull::Point.new(point[0], point[1]) }

jarvis = ConvexHull::Jarvis.new(points)
jarvis = ConvexHull::JarvisMarch.new(points)
jarvis.convex_hull.should eq(expected)
end

Expand All @@ -55,7 +55,7 @@ describe ConvexHull::Jarvis do

expected = [] of ConvexHull::Point

jarvis = ConvexHull::Jarvis.new(points)
jarvis = ConvexHull::JarvisMarch.new(points)
jarvis.convex_hull.should eq(expected)
end
end
2 changes: 1 addition & 1 deletion src/convex_hull.cr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require "./convex_hull/point"
require "./convex_hull/jarvis"
require "./convex_hull/jarvis_march"
require "./convex_hull/graham_scan"

module ConvexHull
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module ConvexHull
class Jarvis
class JarvisMarch
getter points : Array(Point)

def initialize(points : Array(Tuple(Number, Number)))
Expand Down

0 comments on commit 6601f88

Please sign in to comment.