Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 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
        )
Ejemplo n.º 4
0
def dbsplineu():
    curve = open_uniform_bspline(DEFPOINTS, order=3)
    return list(curve.derivatives(curve.params(40)))