MCPcopy
hub / github.com/golang/geo / initNested

Method initNested

s2/polygon.go:282–300  ·  view source on GitHub ↗

initNested takes the set of loops in this polygon and performs the nesting computations to set the proper nesting and parent/child relationships.

()

Source from the content-addressed store, hash-verified

280// initNested takes the set of loops in this polygon and performs the nesting
281// computations to set the proper nesting and parent/child relationships.
282func (p *Polygon) initNested() {
283 if len(p.loops) == 1 {
284 p.initOneLoop()
285 return
286 }
287
288 lm := make(loopMap)
289
290 for _, l := range p.loops {
291 lm.insertLoop(l, nil)
292 }
293 // The loops have all been added to the loopMap for ordering. Clear the
294 // loops slice because we add all the loops in-order in initLoops.
295 p.loops = nil
296
297 // Reorder the loops in depth-first traversal order.
298 p.initLoops(lm)
299 p.initLoopProperties()
300}
301
302// loopMap is a map of a loop to its immediate children with respect to nesting.
303// It is used to determine which loops are shells and which are holes.

Callers 1

PolygonFromLoopsFunction · 0.95

Calls 4

initOneLoopMethod · 0.95
initLoopsMethod · 0.95
initLoopPropertiesMethod · 0.95
insertLoopMethod · 0.80

Tested by

no test coverage detected