def test_bspine_points(): curve = BSpline(DEFPOINTS, order=3) points = list(curve.approximate(40)) for rpoint, epoint in zip(points, iter_points(DBSPLINE, 0)): epx, epy, epz = epoint rpx, rpy, rpz = rpoint assert isclose(epx, rpx) assert isclose(epy, rpy) assert isclose(epz, rpz)
def test_rbspline(): curve = BSpline(DEFPOINTS, order=3, weights=DEFWEIGHTS) expected = RBSPLINE 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)
def render_open_bspline(self, layout: 'BaseLayout', degree: int = 3, dxfattribs: dict = None) -> None: """ Render an open uniform BSpline 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 = BSpline(self.points, order=degree + 1) layout.add_polyline3d(list(spline.approximate(self.segments)), dxfattribs=dxfattribs)
def render_open_bspline(self, layout: 'GenericLayoutType', degree: int = 3, dxfattribs: dict = None) -> None: """ Render an open uniform BSpline as 3d polyline. Definition points are control points. Args: layout: ezdxf layout degree: B-spline degree (order = degree + 1) dxfattribs: DXF attributes for POLYLINE """ spline = BSpline(self.points, order=degree + 1) layout.add_polyline3d(list(spline.approximate(self.segments)), dxfattribs=dxfattribs)
def render_open_rbspline(self, layout: 'GenericLayoutType', weights: Iterable[float], degree: int = 3, dxfattribs: dict = None) -> None: """ Render a rational open uniform BSpline as 3d polyline. Args: layout: ezdxf layout weights: list of weights, requires a weight value for each defpoint. degree: B-spline degree (order = degree + 1) dxfattribs: DXF attributes for POLYLINE """ spline = BSpline(self.points, order=degree + 1, weights=weights) layout.add_polyline3d(list(spline.approximate(self.segments)), dxfattribs=dxfattribs)
def render_open_rbspline(self, layout: 'BaseLayout', weights: Iterable[float], degree: int = 3, dxfattribs: dict = None) -> None: """ Render a rational open uniform BSpline as 3D :class:`~ezdxf.entities.Polyline`. Definition points are control points. Args: layout: :class:`~ezdxf.layouts.BaseLayout` object weights: list of weights, requires a weight value (float) for each definition point. degree: degree of B-spline (order = `degree` + 1) dxfattribs: DXF attributes for :class:`~ezdxf.entities.Polyline` """ spline = BSpline(self.points, order=degree + 1, weights=weights) layout.add_polyline3d(list(spline.approximate(self.segments)), dxfattribs=dxfattribs)