Skip to content

Commit

Permalink
Only allocate once in fixVertex
Browse files Browse the repository at this point in the history
  • Loading branch information
peterstace committed Nov 10, 2022
1 parent dcb1794 commit 695f0e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions geom/dcel_overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (d *doublyConnectedEdgeList) fixVertices() {

func (d *doublyConnectedEdgeList) fixVertex(v *vertexRecord) {
// Sort the edges radially.
var incidents []*halfEdgeRecord
incidents := make([]*halfEdgeRecord, 0, len(v.incidents))
for e := range v.incidents {
incidents = append(incidents, e)
}
Expand All @@ -63,7 +63,7 @@ func (d *doublyConnectedEdgeList) fixVertex(v *vertexRecord) {
// Fix pointers.
for i := range incidents {
ei := incidents[i]
ej := incidents[(i+1)%len(v.incidents)]
ej := incidents[(i+1)%len(incidents)]
ei.prev = ej.twin
ej.twin.next = ei
}
Expand Down

0 comments on commit 695f0e2

Please sign in to comment.