Beispiel #1
0
def test_tangents_2d():
    dbcurve = DBezier(DEFPOINTS2D)
    for index, epoint in enumerate(TANGENTS2D):
        etx, ety = epoint
        pnt, d1, d2 = dbcurve.point(index * .1)
        assert isclose(etx, d1[0])
        assert isclose(ety, d1[1])
Beispiel #2
0
def test_points_2d_2():
    dbcurve = DBezier(DEFPOINTS2D)
    for index, epoint in enumerate(POINTS2D):
        epx, epy = epoint
        pnt, d1, d2 = dbcurve.point(index * .1)
        assert isclose(epx, pnt[0])
        assert isclose(epy, pnt[1])
Beispiel #3
0
def dbezier():
    curve = DBezier(DEFPOINTS3D)
    return list(curve.approximate(40))
Beispiel #4
0
def test_point_and_tangent_2d():
    dbcurve = DBezier(DEFPOINTS2D)
    for index, (chk_pnt, chk_d1) in enumerate(zip(POINTS2D, TANGENTS2D)):
        pnt, d1, d2 = dbcurve.point(index * .1)
        assert pnt.isclose(chk_pnt)
        assert d1.isclose(chk_d1)