示例#1
0
文件: grid.go 项目: mehlert/hexgrid
//  This methods should be replaced.
func (h *Grid) GetVertices(coords hexcoords.Hex) []*Vertex {
	if !h.WithinBounds(coords) {
		return nil
	}
	var vertices = make([]*Vertex, 6)
	for _, v := range coords.Vertices(hex.NilDirection) {
		vertices[v.K] = h.GetVertex(v)
	}
	return vertices
}
示例#2
0
文件: grid.go 项目: mehlert/hexgrid
func (h *Grid) GetEdges(coords hexcoords.Hex) []*Edge {
	if !h.WithinBounds(coords) {
		return nil
	}
	var edges = make([]*Edge, 6)
	for k, ec := range coords.Edges(hex.NilDirection) {
		edges[k] = h.GetEdge(ec)
	}
	return edges
}