(self, u)
return d[0]
Calculates a point of the B-Spline using de Boors Algorithm
Calculates a point of the B-Spline using de Boors Algorithm
Calculates a point of the B - Spline using de Boors Algorithm
def __call__(self, u):
        """Calculates a point of the B-Spline using de Boors Algorithm"""
        dom = self.GetDomain()
        if u < dom[0] or u > dom[1]:
            raise ValueError("Function value not in domain")
        if u == dom[0]:
            return self.points[0]
        if u == dom[1]:
            return self.points[-1]
        I = self.GetIndex(u)
        d = [self.points[I - self.degree + 1 + ii]
             for ii in range(self.degree + 1)]
        U = self.knots
        for ik in range(1, self.degree + 1):
            for ii in range(I - self.degree + ik + 1, I + 2):
                ua = U[ii + self.degree - ik]
                ub = U[ii - 1]
                co1 = (ua - u) / (ua - ub)
                co2 = (u - ub) / (ua - ub)
                index = ii - I + self.degree - ik - 1
                d[index] = d[index].linear_combination(d[index + 1], co1, co2)
        return d[0]
def __call__ ( self , u ) : dom = self . GetDomain ( ) if u < dom [ 0 ] or u > dom [ 1 ] : raise ValueError ( "Function value not in domain" ) if u == dom [ 0 ] : return self . points [ 0 ] if u == dom [ 1 ] : return self . points [ - 1 ] I = self . GetIndex ( u ) d = [ self . points [ I - self . degree + 1 + ii ] for ii in range ( self . degree + 1 ) ] U = self . knots for ik in range ( 1 , self . degree + 1 ) : for ii in range ( I - self . degree + ik + 1 , I + 2 ) : ua = U [ ii + self . degree - ik ] ub = U [ ii - 1 ] co1 = ( ua - u ) / ( ua - ub ) co2 = ( u - ub ) / ( ua - ub ) index = ii - I + self . degree - ik - 1 d [ index ] = d [ index ] . linear_combination ( d [ index + 1 ] , co1 , co2 ) return d [ 0 ]