code: func (p *Path) resampleEdgeCases(totalPoints int) bool {
  	// degenerate case
  	if len(p.PointSet) <= 1 {
  		return true
  	}
  
  	// if all the points are the same, treat as special case.
  	equal := true
  	for _, point := range p.PointSet {
  		if !p.PointSet[0].Equals(&point) {
  			equal = false
  			break
  		}
  	}
  
  	if equal {
  		if totalPoints > p.Length() {
  			// extend to be requested length
  			for p.Length() != totalPoints {
  				p.PointSet = append(p.PointSet, p.PointSet[0])
  			}
  
  			return true
  		}
  
  		// contract to be requested length
  		p.PointSet = p.PointSet[:totalPoints]
  		return true
  	}
  
  	return false
  }
docs: // resampleEdgeCases is used to handle edge case for
  // resampling like not enough points and the path is all the same point.
  // will return nil if there are no edge cases. If return true if
  // one of these edge cases was found and handled.