LoopFromCell constructs a loop corresponding to the given cell. Note that the loop and cell *do not* contain exactly the same set of points, because Loop and Cell have slightly different definitions of point containment. For example, a Cell vertex is contained by all four neighboring Cells, but it
(c Cell)
| 90 | // loop contains points on its boundary that actually belong to other cells |
| 91 | // (i.e., the covering will include a layer of neighboring cells). |
| 92 | func LoopFromCell(c Cell) *Loop { |
| 93 | l := &Loop{ |
| 94 | vertices: []Point{ |
| 95 | c.Vertex(0), |
| 96 | c.Vertex(1), |
| 97 | c.Vertex(2), |
| 98 | c.Vertex(3), |
| 99 | }, |
| 100 | index: NewShapeIndex(), |
| 101 | } |
| 102 | |
| 103 | l.initOriginAndBound() |
| 104 | return l |
| 105 | } |
| 106 | |
| 107 | // These two points are used for the special Empty and Full loops. |
| 108 | var ( |
searching dependent graphs…