Exemplo n.º 1
0
class BezierSpline(SplineBase):
    def initialize(self, x, xp, yp):
        """
        params:
        ----------
        x: array
            array with new x-distribution
        xp: array
            array with original x-distribution
        yp: array
            array with original y-distribution

        returns
        ---------
        ynew: array
            resampled points
        """
        self.B = BezierCurve()
        self.B.CPs = np.array([xp, yp]).T
        return self.__call__(x, xp, yp)

    def __call__(self, x, Cx, C):
        """
        params:
        ----------
        x: array
            array with new x-distribution
        xp: array
            array with x-coordinates of spline control points
        yp: array
            array with y-coordinates of spline control points

        returns
        ---------
        ynew: array
            resampled points
        """
        self.B.CPs = np.array([Cx, C]).T
        self.B.update()
        spl = NaturalCubicSpline(self.B.points[:, 0], self.B.points[:, 1])
        return spl(x)
Exemplo n.º 2
0
    def initialize(self, x, xp, yp):
        """
        params:
        ----------
        x: array
            array with new x-distribution
        xp: array
            array with original x-distribution
        yp: array
            array with original y-distribution

        returns
        ---------
        ynew: array
            resampled points
        """
        self.B = BezierCurve()
        self.B.CPs = np.array([xp, yp]).T
        return self.__call__(x, xp, yp)