(points [][]int)
| 5 | } |
| 6 | |
| 7 | func isReflected(points [][]int) bool { |
| 8 | if len(points) < 2 { |
| 9 | return true |
| 10 | } |
| 11 | var min, max int |
| 12 | var mid float32 |
| 13 | var m map[[2]int]bool |
| 14 | m = make(map[[2]int]bool) |
| 15 | min = points[0][0] |
| 16 | max = min |
| 17 | for i := 0; i < len(points); i++ { |
| 18 | if points[i][0] < min { |
| 19 | min = points[i][0] |
| 20 | } else if points[i][0] > max { |
| 21 | max = points[i][0] |
| 22 | } |
| 23 | m[[2]int{points[i][0], points[i][1]}] = true |
| 24 | } |
| 25 | mid = float32(min+max) / 2.0 |
| 26 | for el := 0; el < len(points); el++ { |
| 27 | refX := int(2*mid) - points[el][0] |
| 28 | if _, ok := m[[2]int{refX, points[el][1]}]; !ok { |
| 29 | return false |
| 30 | } |
| 31 | } |
| 32 | return true |
| 33 | } |
nothing calls this directly
no outgoing calls
no test coverage detected