def interpolate()

in common/spline.py [0:0]


    def interpolate(self, distance, track=None): 
        if hasattr(distance, '__len__'):
            # Multi-point interpolation (more efficient)
            multipoint = True
            if not isinstance(distance, np.ndarray):
                distance = np.array(distance)
        else:
            multipoint = False
            distance = np.array([ distance ])
            
        if self.closed:
            # Wrap-around distance
            distance = distance % self.distances[-1]
        
        indices = self._get_indices(distance)
        t = ((distance - self.distances[indices]) / self.segment_lengths[indices])
        if track is None:
            result = self._lerp(self.points[indices], self.points[(indices+1) % self.points.shape[0]], t.reshape(-1, 1))
        else:
            tr = self.tracks[track]
            if len(tr[0].shape) == 2:
                t = t.reshape(-1, 1)
            p0 = tr[0][indices]
            p1 = tr[0][(indices+1) % self.points.shape[0]]
            if tr[1] == 'linear':
                result = self._lerp(p0, p1, t)
            elif tr[1] == 'circular':
                result = self._slerp(p0, p1, t)
            else:
                raise
        if multipoint:
            return result
        else:
            return result[0]