func (m *MaxDistanceToShapeIndexTarget) capBound() Cap {
	panic("not implemented yet")
}
capBound returns a Cap that bounds the antipode of the target. This
is the set of points whose maxDistance to the target is maxDistance.zero()
package s2
import (
	"math"
	"github.com/golang/geo/s1"
)
type maxDistance s1.ChordAngle
func (m maxDistance) chordAngle() s1.ChordAngle { return s1.ChordAngle(m) }
func (m maxDistance) zero() distance            { return maxDistance(s1.StraightChordAngle) }
func (m maxDistance) negative() distance        { return maxDistance(s1.InfChordAngle()) }
func (m maxDistance) infinity() distance        { return maxDistance(s1.NegativeChordAngle) }
func (m maxDistance) less(other distance) bool  { return m.chordAngle() > other.chordAngle() }
func (m maxDistance) sub(other distance) distance {
	return maxDistance(m.chordAngle() + other.chordAngle())
}
func (m maxDistance) chordAngleBound() s1.ChordAngle {
	return s1.StraightChordAngle - m.chordAngle()
}
func (m maxDistance) updateDistance(dist distance) (distance, bool) {
	if dist.less(m) {
		m = maxDistance(dist.chordAngle())
		return m, true
	}
	return m, false
}
func (m maxDistance) fromChordAngle(o s1.ChordAngle) distance {
	return maxDistance(o)
}
type MaxDistanceToPointTarget struct {
	point Point
	dist  distance
}
func NewMaxDistanceToPointTarget(point Point) *MaxDistanceToPointTarget {
	m := maxDistance(0)
	return &MaxDistanceToPointTarget{point: point, dist: &m}
}
func (m *MaxDistanceToPointTarget) capBound() Cap {
	return CapFromCenterChordAngle(Point{m.point.Mul(-1)}, (s1.ChordAngle(0)))
}
func (m *MaxDistanceToPointTarget) updateDistanceToPoint(p Point, dist distance) (distance, bool) {
	return dist.updateDistance(maxDistance(ChordAngleBetweenPoints(p, m.point)))
}
func (m *MaxDistanceToPointTarget) updateDistanceToEdge(edge Edge, dist distance) (distance, bool) {
	if d, ok := UpdateMaxDistance(m.point, edge.V0, edge.V1, dist.chordAngle()); ok {
		dist, _ = dist.updateDistance(maxDistance(d))
		return dist, true
	}
	return dist, false
}
func (m *MaxDistanceToPointTarget) updateDistanceToCell(cell Cell, dist distance) (distance, bool) {
	return dist.updateDistance(maxDistance(cell.MaxDistance(m.point)))
}
func (m *MaxDistanceToPointTarget) visitContainingShapes(index *ShapeIndex, v shapePointVisitorFunc) bool {
	q := NewContainsPointQuery(index, VertexModelSemiOpen)
	return q.visitContainingShapes(Point{m.point.Mul(-1)}, func(shape Shape) bool {
		return v(shape, m.point)
	})
}
func (m *MaxDistanceToPointTarget) setMaxError(maxErr s1.ChordAngle) bool { return false }
func (m *MaxDistanceToPointTarget) maxBruteForceIndexSize() int           { return 30 }
func (m *MaxDistanceToPointTarget) distance() distance                    { return m.dist }
type MaxDistanceToEdgeTarget struct {
	e    Edge
	dist distance
}
func NewMaxDistanceToEdgeTarget(e Edge) *MaxDistanceToEdgeTarget {
	m := maxDistance(0)
	return &MaxDistanceToEdgeTarget{e: e, dist: m}
}
func (m *MaxDistanceToEdgeTarget) capBound() Cap {
	d2 := float64(ChordAngleBetweenPoints(m.e.V0, m.e.V1))
	r2 := (0.5 * d2) / (1 + math.Sqrt(1-0.25*d2))
	return CapFromCenterChordAngle(Point{m.e.V0.Add(m.e.V1.Vector).Mul(-1).Normalize()}, s1.ChordAngleFromSquaredLength(r2))
}
func (m *MaxDistanceToEdgeTarget) updateDistanceToPoint(p Point, dist distance) (distance, bool) {
	if d, ok := UpdateMaxDistance(p, m.e.V0, m.e.V1, dist.chordAngle()); ok {
		dist, _ = dist.updateDistance(maxDistance(d))
		return dist, true
	}
	return dist, false
}
func (m *MaxDistanceToEdgeTarget) updateDistanceToEdge(edge Edge, dist distance) (distance, bool) {
	if d, ok := updateEdgePairMaxDistance(m.e.V0, m.e.V1, edge.V0, edge.V1, dist.chordAngle()); ok {
		dist, _ = dist.updateDistance(maxDistance(d))
		return dist, true
	}
	return dist, false
}
func (m *MaxDistanceToEdgeTarget) updateDistanceToCell(cell Cell, dist distance) (distance, bool) {
	return dist.updateDistance(maxDistance(cell.MaxDistanceToEdge(m.e.V0, m.e.V1)))
}
func (m *MaxDistanceToEdgeTarget) visitContainingShapes(index *ShapeIndex, v shapePointVisitorFunc) bool {
	target := NewMaxDistanceToPointTarget(Point{m.e.V0.Add(m.e.V1.Vector).Normalize()})
	return target.visitContainingShapes(index, v)
}
func (m *MaxDistanceToEdgeTarget) setMaxError(maxErr s1.ChordAngle) bool { return false }
func (m *MaxDistanceToEdgeTarget) maxBruteForceIndexSize() int           { return 30 }
func (m *MaxDistanceToEdgeTarget) distance() distance                    { return m.dist }
type MaxDistanceToCellTarget struct {
	cell Cell
	dist distance
}
func NewMaxDistanceToCellTarget(cell Cell) *MaxDistanceToCellTarget {
	m := maxDistance(0)
	return &MaxDistanceToCellTarget{cell: cell, dist: m}
}
func (m *MaxDistanceToCellTarget) capBound() Cap {
	c := m.cell.CapBound()
	return CapFromCenterAngle(Point{c.Center().Mul(-1)}, c.Radius())
}
func (m *MaxDistanceToCellTarget) updateDistanceToPoint(p Point, dist distance) (distance, bool) {
	return dist.updateDistance(maxDistance(m.cell.MaxDistance(p)))
}
func (m *MaxDistanceToCellTarget) updateDistanceToEdge(edge Edge, dist distance) (distance, bool) {
	return dist.updateDistance(maxDistance(m.cell.MaxDistanceToEdge(edge.V0, edge.V1)))
}
func (m *MaxDistanceToCellTarget) updateDistanceToCell(cell Cell, dist distance) (distance, bool) {
	return dist.updateDistance(maxDistance(m.cell.MaxDistanceToCell(cell)))
}
func (m *MaxDistanceToCellTarget) visitContainingShapes(index *ShapeIndex, v shapePointVisitorFunc) bool {
	target := NewMaxDistanceToPointTarget(m.cell.Center())
	return target.visitContainingShapes(index, v)
}
func (m *MaxDistanceToCellTarget) setMaxError(maxErr s1.ChordAngle) bool { return false }
func (m *MaxDistanceToCellTarget) maxBruteForceIndexSize() int           { return 30 }
func (m *MaxDistanceToCellTarget) distance() distance                    { return m.dist }
type MaxDistanceToShapeIndexTarget struct {
	index *ShapeIndex
	query *EdgeQuery
	dist  distance
}
func NewMaxDistanceToShapeIndexTarget(index *ShapeIndex) *MaxDistanceToShapeIndexTarget {
	m := maxDistance(0)
	return &MaxDistanceToShapeIndexTarget{
		index: index,
		dist:  m,
		query: NewFurthestEdgeQuery(index, NewFurthestEdgeQueryOptions()),
	}
}