[interpolatable] Another approach
This commit is contained in:
parent
41ed903d45
commit
875d17c3f0
@ -798,9 +798,11 @@ def test_gen(
|
||||
# The sign difference can happen if it's a werido
|
||||
# self-intersecting contour; ignore it.
|
||||
contour = midRecording[ix]
|
||||
from .interpolatablePlot import LerpGlyphSet
|
||||
if contour and (m0Vectors[ix][0] < 0) == (m1Vectors[ix][0] < 0):
|
||||
|
||||
midStats = StatisticsPen(glyphset=glyphset)
|
||||
midGlyphset = LerpGlyphSet(glyphsets[m0idx], glyphsets[m1idx])
|
||||
midStats = StatisticsPen(glyphset=midGlyphset)
|
||||
contour.replay(midStats)
|
||||
midVector = _contour_vector_from_stats(midStats)
|
||||
|
||||
@ -810,17 +812,21 @@ def test_gen(
|
||||
|
||||
bounds0Pen = ControlBoundsPen(glyphsets[m0idx])
|
||||
bounds1Pen = ControlBoundsPen(glyphsets[m1idx])
|
||||
boundsMidPen = ControlBoundsPen(midGlyphset)
|
||||
recording0[ix].replay(bounds0Pen)
|
||||
recording1[ix].replay(bounds1Pen)
|
||||
contour.replay(boundsMidPen)
|
||||
bounds0 = bounds0Pen.bounds or (0, 0, 0, 0)
|
||||
bounds1 = bounds1Pen.bounds or (0, 0, 0, 0)
|
||||
boundsMid = boundsMidPen.bounds or (0, 0, 0, 0)
|
||||
width0, height0 = bounds0[2] - bounds0[0], bounds0[3] - bounds0[1]
|
||||
width1, height1 = bounds1[2] - bounds1[0], bounds1[3] - bounds1[1]
|
||||
widthMid, heightMid = boundsMid[2] - boundsMid[0], boundsMid[3] - boundsMid[1]
|
||||
|
||||
try:
|
||||
size0 /= width0 * height0
|
||||
size1 /= width1 * height1
|
||||
midSize /= (width0 + width1) * .5 * (height0 + height1) * .5
|
||||
midSize /= widthMid * heightMid
|
||||
except ZeroDivisionError:
|
||||
continue
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user