diagnostic tool fixes
This commit is contained in:
@ -11,7 +11,7 @@ func GetTriangles(coords []types.Coords, w, h int) []types.Edge {
|
||||
edges := d.Init(100, 100).Insert(coords).GetEdges()
|
||||
output := make([]types.Edge, 0)
|
||||
for _, e := range edges{
|
||||
output = append(output, types.Edge{e.Nodes[0].Coords, e.Nodes[1].Coords})
|
||||
output = append(output, types.Edge{From: e.Nodes[0].Coords, To: e.Nodes[1].Coords})
|
||||
}
|
||||
return output
|
||||
}
|
||||
@ -46,16 +46,16 @@ func GetMst(coords []types.Coords, w, h, negativeWeight int) []types.Edge {
|
||||
graph = append(
|
||||
graph,
|
||||
kruskals.SimpleWeightedEdge{
|
||||
nodeMap[e.Nodes[0].Id],
|
||||
nodeMap[e.Nodes[1].Id],
|
||||
negativeWeight - int(e.Nodes[0].Coords.DistanceTo(e.Nodes[1].Coords))},
|
||||
F: nodeMap[e.Nodes[0].Id],
|
||||
T: nodeMap[e.Nodes[1].Id],
|
||||
W: negativeWeight - int(e.Nodes[0].Coords.DistanceTo(e.Nodes[1].Coords))},
|
||||
)
|
||||
}
|
||||
|
||||
result := kruskals.MinimumSpanningTree(graph)
|
||||
output := make([]types.Edge, 0)
|
||||
for _, we := range result{
|
||||
output = append(output, types.Edge{nodeList[we.From()].Coords, nodeList[we.To()].Coords})
|
||||
output = append(output, types.Edge{From: nodeList[we.From()].Coords, To: nodeList[we.To()].Coords})
|
||||
}
|
||||
return output
|
||||
}
|
||||
|
Reference in New Issue
Block a user