Inline _splitCubicIntoN()
This commit is contained in:
parent
40bba687ab
commit
1cc3c5eae8
@ -29,7 +29,15 @@ def calcCubicPoints(a, b, c, d):
|
|||||||
_4 = a + d + c + b
|
_4 = a + d + c + b
|
||||||
return _1, _2, _3, _4
|
return _1, _2, _3, _4
|
||||||
|
|
||||||
def _splitCubicIntoN(a, b, c, d, n):
|
def calcCubicParameters(pt1, pt2, pt3, pt4):
|
||||||
|
c = (pt2 -pt1) * 3.0
|
||||||
|
b = (pt3 - pt2) * 3.0 - c
|
||||||
|
d = pt1
|
||||||
|
a = pt4 - d - c - b
|
||||||
|
return a, b, c, d
|
||||||
|
|
||||||
|
def splitCubicIntoN(pt1, pt2, pt3, pt4, n):
|
||||||
|
a, b, c, d = calcCubicParameters(pt1, pt2, pt3, pt4)
|
||||||
segments = []
|
segments = []
|
||||||
dt = 1./n
|
dt = 1./n
|
||||||
for i in range(n):
|
for i in range(n):
|
||||||
@ -49,17 +57,6 @@ def _splitCubicIntoN(a, b, c, d, n):
|
|||||||
segments.append((pt1, pt2, pt3, pt4))
|
segments.append((pt1, pt2, pt3, pt4))
|
||||||
return segments
|
return segments
|
||||||
|
|
||||||
def calcCubicParameters(pt1, pt2, pt3, pt4):
|
|
||||||
c = (pt2 -pt1) * 3.0
|
|
||||||
b = (pt3 - pt2) * 3.0 - c
|
|
||||||
d = pt1
|
|
||||||
a = pt4 - d - c - b
|
|
||||||
return a, b, c, d
|
|
||||||
|
|
||||||
def splitCubicIntoN(pt1, pt2, pt3, pt4, n):
|
|
||||||
a, b, c, d = calcCubicParameters(pt1, pt2, pt3, pt4)
|
|
||||||
return _splitCubicIntoN(a, b, c, d, n)
|
|
||||||
|
|
||||||
def splitCubicIntoTwo(pt1, pt2, pt3, pt4):
|
def splitCubicIntoTwo(pt1, pt2, pt3, pt4):
|
||||||
mid = (pt1+3*(pt2+pt3)+pt4)*.125
|
mid = (pt1+3*(pt2+pt3)+pt4)*.125
|
||||||
deriv3 = (pt4+pt3-pt2-pt1)*.125
|
deriv3 = (pt4+pt3-pt2-pt1)*.125
|
||||||
|
Loading…
x
Reference in New Issue
Block a user