Remove bezier deprecation warning
This commit is contained in:
16
laser.py
16
laser.py
@@ -31,7 +31,7 @@ from inkex.paths import Path
|
||||
|
||||
import os
|
||||
import math
|
||||
import bezmisc
|
||||
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
@@ -57,6 +57,9 @@ if target_version < 1.0:
|
||||
# Inkex.Boolean
|
||||
inkex.Boolean = bool
|
||||
|
||||
import bezmisc as bezier
|
||||
|
||||
|
||||
else:
|
||||
# simplestyle
|
||||
|
||||
@@ -80,6 +83,9 @@ else:
|
||||
parsePath = CubicSuperPath
|
||||
|
||||
|
||||
from inkex import bezier
|
||||
|
||||
|
||||
# Check if inkex has error messages. (0.46 version does not have one) Could be removed later.
|
||||
if "errormsg" not in dir(inkex):
|
||||
inkex.errormsg = lambda msg: sys.stderr.write((str(msg) + "\n").encode("UTF-8"))
|
||||
@@ -87,7 +93,7 @@ if "errormsg" not in dir(inkex):
|
||||
|
||||
def bezierslopeatt(xxx_todo_changeme, t):
|
||||
((bx0, by0), (bx1, by1), (bx2, by2), (bx3, by3)) = xxx_todo_changeme
|
||||
ax, ay, bx, by, cx, cy, x0, y0 = bezmisc.bezierparameterize(((bx0, by0), (bx1, by1), (bx2, by2), (bx3, by3)))
|
||||
ax, ay, bx, by, cx, cy, x0, y0 = bezier.bezierparameterize(((bx0, by0), (bx1, by1), (bx2, by2), (bx3, by3)))
|
||||
dx = 3 * ax * (t ** 2) + 2 * bx * t + cx
|
||||
dy = 3 * ay * (t ** 2) + 2 * by * t + cy
|
||||
if dx == dy == 0:
|
||||
@@ -105,7 +111,7 @@ def bezierslopeatt(xxx_todo_changeme, t):
|
||||
return dx, dy
|
||||
|
||||
|
||||
bezmisc.bezierslopeatt = bezierslopeatt
|
||||
bezier.bezierslopeatt = bezierslopeatt
|
||||
|
||||
################################################################################
|
||||
#
|
||||
@@ -249,7 +255,7 @@ def csp_split(sp1, sp2, t=.5):
|
||||
|
||||
|
||||
def csp_curvature_at_t(sp1, sp2, t, depth=3):
|
||||
ax, ay, bx, by, cx, cy, dx, dy = bezmisc.bezierparameterize(csp_segment_to_bez(sp1, sp2))
|
||||
ax, ay, bx, by, cx, cy, dx, dy = bezier.bezierparameterize(csp_segment_to_bez(sp1, sp2))
|
||||
|
||||
# curvature = (x'y''-y'x'') / (x'^2+y'^2)^1.5
|
||||
|
||||
@@ -293,7 +299,7 @@ def csp_at_t(sp1, sp2, t):
|
||||
|
||||
def cspseglength(sp1, sp2, tolerance=0.001):
|
||||
bez = (sp1[1][:], sp1[2][:], sp2[0][:], sp2[1][:])
|
||||
return bezmisc.bezierlength(bez, tolerance)
|
||||
return bezier.bezierlength(bez, tolerance)
|
||||
|
||||
|
||||
# Distance calculation from point to arc
|
||||
|
||||
Reference in New Issue
Block a user