-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathenvelope.go
48 lines (39 loc) · 1.01 KB
/
envelope.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package geom
import "github.com/intdxdt/mbr"
// bounding box of linestring
func (self *LineString) BBox() *mbr.MBR[float64] {
return &self.bbox.MBR
}
// bounding box of linestring
func (self *LineString) Bounds() mbr.MBR[float64] {
return self.bbox.MBR
}
// bounding box of point
func (self Point) BBox() *mbr.MBR[float64] {
var box = self.Bounds()
return &box
}
// bounding box of point
func (self Point) Bounds() mbr.MBR[float64] {
var x, y = self[X], self[Y]
var box = mbr.CreateMBR(x, y, x, y)
return box
}
// bounding box of segment
func (self *Segment) BBox() *mbr.MBR[float64] {
var box = self.Bounds()
return &box
}
// bounding box of segment
func (self *Segment) Bounds() mbr.MBR[float64] {
var a, b = self.Coords.Pt(0), self.Coords.Pt(1)
return mbr.CreateMBR(a[X], a[Y], b[X], b[Y])
}
// bounding box of linestring
func (self *Polygon) BBox() *mbr.MBR[float64] {
return &self.Shell.bbox.MBR
}
// bounding box of linestring
func (self *Polygon) Bounds() mbr.MBR[float64] {
return self.Shell.bbox.MBR
}