def test_bsplineu_points():
    curve = open_uniform_bspline(DEFPOINTS, order=3)
    points = list(curve.approximate(40))

    for rpoint, epoint in zip(points, iter_points(DBSPLINEU, 0)):
        epx, epy, epz = epoint
        rpx, rpy, rpz = rpoint
        assert isclose(epx, rpx)
        assert isclose(epy, rpy)
        assert isclose(epz, rpz)
def test_rbsplineu():
    curve = open_uniform_bspline(DEFPOINTS, order=3, weights=DEFWEIGHTS)
    expected = RBSPLINEU
    points = list(curve.approximate(40))

    for rpoint, epoint in zip(points, expected):
        epx, epy, epz = epoint
        rpx, rpy, rpz = rpoint
        assert isclose(epx, rpx)
        assert isclose(epy, rpy)
        assert isclose(epz, rpz)
Exemple #3
0
    def render_uniform_bspline(
        self, layout: "BaseLayout", degree: int = 3, dxfattribs: dict = None
    ) -> None:
        """Render a uniform B-spline as 3D :class:`~ezdxf.entities.Polyline`.
        Definition points are control points.

        Args:
            layout: :class:`~ezdxf.layouts.BaseLayout` object
            degree: degree of B-spline (order = `degree` + 1)
            dxfattribs: DXF attributes for :class:`~ezdxf.entities.Polyline`

        """
        spline = open_uniform_bspline(self.points, order=degree + 1)
        layout.add_polyline3d(
            list(spline.approximate(self.segments)), dxfattribs=dxfattribs
        )
def dbsplineu():
    curve = open_uniform_bspline(DEFPOINTS, order=3)
    return list(curve.derivatives(curve.params(40)))