Exemplo n.º 1
0
def test_calcCubicBounds():
    assert calcCubicBounds((0, 0), (25, 100), (75, 100),
                           (100, 0)) == ((0, 0, 100, 75.0))
    assert calcCubicBounds((0, 0), (50, 0), (100, 50),
                           (100, 100)) == (0.0, 0.0, 100, 100)
    assert calcCubicBounds((50, 0), (0, 100), (100, 100),
                           (50, 0)) == pytest.approx(
                               (35.566243, 0.000000, 64.433757, 75.000000))
Exemplo n.º 2
0
def test_calcCubicBounds():
    assert calcCubicBounds(
        (0, 0), (25, 100), (75, 100), (100, 0)) == ((0, 0, 100, 75.0))
    assert calcCubicBounds(
        (0, 0), (50, 0), (100, 50), (100, 100)) == (0.0, 0.0, 100, 100)
    assert calcCubicBounds(
        (50, 0), (0, 100), (100, 100), (50, 0)
    ) == pytest.approx((35.566243, 0.000000, 64.433757, 75.000000))
Exemplo n.º 3
0
	def _curveToOne(self, bcp1, bcp2, pt):
		bounds = self.bounds
		bounds = updateBounds(bounds, pt)
		if not pointInRect(bcp1, bounds) or not pointInRect(bcp2, bounds):
			bounds = unionRect(bounds, calcCubicBounds(
					self._getCurrentPoint(), bcp1, bcp2, pt))
		self.bounds = bounds
Exemplo n.º 4
0
	def _curveToOne(self, bcp1, bcp2, pt):
		bounds = self.bounds
		bounds = updateBounds(bounds, pt)
		if not pointInRect(bcp1, bounds) or not pointInRect(bcp2, bounds):
			bounds = unionRect(bounds, calcCubicBounds(
					self._getCurrentPoint(), bcp1, bcp2, pt))
		self.bounds = bounds
Exemplo n.º 5
0
for i in range(c):
    arrayTools.pointsInRect(
        [pt1, pt2, pt3, pt1, pt2, pt3, pt1, pt2, pt3, pt1, pt2, pt3, pt4],
        rect)
print time.time() - n

print "calcQuadraticBounds\t\t",
n = time.time()
for i in range(c):
    bezierTools.calcQuadraticBounds(pt1, pt2, pt3)
print time.time() - n

print "calcCubicBounds\t\t\t",
n = time.time()
for i in range(c):
    bezierTools.calcCubicBounds(pt1, pt2, pt3, pt4)
print time.time() - n

print
##############

print "no-numpy"
print "calcQuadraticParameters\t\t",
n = time.time()
for i in range(c):
    noNumpyBezierTools.calcQuadraticParameters(pt1, pt2, pt3)
print time.time() - n

print "calcBounds\t\t\t",
n = time.time()
for i in range(c):
Exemplo n.º 6
0
print "pointsInRect\t\t\t",
n = time.time()
for i in range(c):
    arrayTools.pointsInRect([pt1, pt2, pt3, pt1, pt2, pt3, pt1, pt2, pt3, pt1, pt2, pt3, pt4], rect)
print time.time() - n

print "calcQuadraticBounds\t\t",
n = time.time()
for i in range(c):
    bezierTools.calcQuadraticBounds(pt1, pt2, pt3)
print time.time() - n

print "calcCubicBounds\t\t\t",
n = time.time()
for i in range(c):
    bezierTools.calcCubicBounds(pt1, pt2, pt3, pt4)
print time.time() - n

print 
##############

print "no-numpy"
print "calcQuadraticParameters\t\t",
n = time.time()
for i in range(c):
    noNumpyBezierTools.calcQuadraticParameters(pt1, pt2, pt3)
print time.time() - n

print "calcBounds\t\t\t",
n = time.time()
for i in range(c):