Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an attempt to render polygons instead of individual tiles for bou…
…ndaries
- Loading branch information
1 parent
d083756
commit f8930b1
Showing
9 changed files
with
245 additions
and
24 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
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,36 @@ | ||
package grid | ||
|
||
// Edge is a line | ||
type Edge struct { | ||
A Coordinate | ||
B Coordinate | ||
} | ||
|
||
// GetUniqueEdges returns all the unique edges in a slice | ||
func GetUniqueEdges(edges []Edge) []Edge { | ||
unique := []Edge{} | ||
|
||
for _, e := range edges { | ||
if !isEdgeInSlice(e, unique) { | ||
unique = append(unique, e) | ||
} | ||
} | ||
|
||
return unique | ||
} | ||
|
||
func isEdgeEqual(a Edge, b Edge) bool { | ||
if (Equals(a.A, b.A) && Equals(a.B, b.B)) || (Equals(a.A, b.B) && Equals(a.B, b.A)) { | ||
return true | ||
} | ||
return false | ||
} | ||
|
||
func isEdgeInSlice(edge Edge, edges []Edge) bool { | ||
for _, e := range edges { | ||
if isEdgeEqual(edge, e) { | ||
return true | ||
} | ||
} | ||
return false | ||
} |
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
Oops, something went wrong.