forked from spatial-go/geoos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request spatial-go#24 from tianpf/main
code refactoring
- Loading branch information
Showing
65 changed files
with
1,549 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package algoerr | ||
package algorithm | ||
|
||
import ( | ||
"testing" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// Package simplify define Douglas Peucker and Topology Preserving simplify. | ||
package simplify | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package angle | ||
|
||
import ( | ||
"github.com/spatial-go/geoos/algorithm" | ||
"github.com/spatial-go/geoos/algorithm/matrix" | ||
) | ||
|
||
// Quadrant four const | ||
const ( | ||
NE = iota + 1 | ||
NW | ||
SW | ||
SE | ||
) | ||
|
||
// QuadrantFloat Returns the quadrant of a directed line segment (specified as x and y displacements, which cannot both be 0). | ||
func QuadrantFloat(dx, dy float64) (int, error) { | ||
if dx == 0.0 && dy == 0.0 { | ||
return 0, algorithm.ErrQuadrant | ||
} | ||
if dx >= 0.0 { | ||
if dy >= 0.0 { | ||
return NE, nil | ||
} | ||
|
||
return SE, nil | ||
} | ||
if dy >= 0.0 { | ||
return NW, nil | ||
} | ||
return SW, nil | ||
} | ||
|
||
// Quadrant Returns the quadrant of a directed line segment from p0 to p1. | ||
func Quadrant(p0, p1 matrix.Matrix) (int, error) { | ||
if p1[0] == p0[0] && p1[1] == p0[1] { | ||
return 0, algorithm.ErrQuadrant | ||
} | ||
if p1[0] >= p0[0] { | ||
if p1[1] >= p0[1] { | ||
return NE, nil | ||
} | ||
return SE, nil | ||
} | ||
if p1[1] >= p0[1] { | ||
return NW, nil | ||
} | ||
return SW, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// Package filter Define matrix data filter function. | ||
package filter | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.