Skip to content

Commit

Permalink
fix: update type
Browse files Browse the repository at this point in the history
  • Loading branch information
lvisei committed Dec 9, 2020
1 parent 2c9dfc2 commit 4e049c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ordinary/math.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func maxFloat64(t []float64) float64 {
return max
}

func pipFloat64(t [][2]float64, x, y float64) bool {
func pipFloat64(t []Point, x, y float64) bool {
c := false
for i, j := 0, len(t)-1; i < len(t); j, i = i, i+1 {
if ((t[i][1] > y) != (t[j][1] > y)) && (x < (t[j][0]-t[i][0])*(y-t[i][1])/(t[j][1]-t[i][1])+t[i][0]) {
Expand Down
10 changes: 7 additions & 3 deletions ordinary/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,15 @@ type ContourRectangle struct {
YResolution float64 `json:"yResolution"`
}

type PolygonCoordinates [][][2]float64
type Point [2]float64 // [103.614373, 27.00541]

type Ring []Point // [[103.614373, 27.00541],[104.174357, 26.635252],[104.356163, 28.018448],[103.614373, 27.00541]]

type PolygonCoordinates []Ring // [[[103.614373, 27.00541],[104.174357, 26.635252],[104.356163, 28.018448],[103.614373, 27.00541]]]

type PolygonGeometry struct {
Type string `json:"type" example:"Polygon"` // Polygon
Coordinates PolygonCoordinates `json:"coordinates" example:"[[[103.614373, 27.00541],[104.174357, 26.635252],[104.356163, 28.018448],[103.614373, 27.00541]]]"` // coordinates
Type string `json:"type" example:"Polygon"` // Polygon
Coordinates []Ring `json:"coordinates,omitempty"` // coordinates
}

type RGBA [4]uint8
Expand Down

0 comments on commit 4e049c4

Please sign in to comment.