func (p *laxPolygon) numVertices() int {
	if p.numLoops <= 1 {
		return p.numVerts
	}
	return p.cumulativeVertices[p.numLoops]
}
numVertices reports the total number of vertices in all loops.
package s2
var _ Shape = (*laxPolygon)(nil)
type laxPolygon struct {
	numLoops int
	vertices []Point
	numVerts           int
	cumulativeVertices []int
}
func laxPolygonFromPolygon(p *Polygon) *laxPolygon {
	spans := make([][]Point, len(p.loops))
	for i, loop := range p.loops {
		if loop.IsFull() {
			spans[i] = []Point{}  
		} else {
			spans[i] = make([]Point, len(loop.vertices))
			copy(spans[i], loop.vertices)
		}
	}
	return laxPolygonFromPoints(spans)
}
func laxPolygonFromPoints(loops [][]Point) *laxPolygon {
	p := &laxPolygon{}
	p.numLoops = len(loops)
	if p.numLoops == 0 {
		p.numVerts = 0
		p.vertices = nil
	} else if p.numLoops == 1 {
		p.numVerts = len(loops[0])
		p.vertices = make([]Point, p.numVerts)
		copy(p.vertices, loops[0])
	} else {
		p.cumulativeVertices = make([]int, p.numLoops+1)
		numVertices := 0
		for i, loop := range loops {
			p.cumulativeVertices[i] = numVertices
			numVertices += len(loop)
		}
		p.cumulativeVertices[p.numLoops] = numVertices
		for _, points := range loops {
			p.vertices = append(p.vertices, points...)
		}
	}
	return p
}