Separate computing delta weights
This commit is contained in:
parent
07a5e2de62
commit
8c8522560a
@ -281,7 +281,6 @@ class VariationModel(object):
|
|||||||
|
|
||||||
def _computeMasterSupports(self, axisPoints):
|
def _computeMasterSupports(self, axisPoints):
|
||||||
supports = []
|
supports = []
|
||||||
deltaWeights = []
|
|
||||||
locations = self.locations
|
locations = self.locations
|
||||||
# Compute min/max across each axis, use it as total range.
|
# Compute min/max across each axis, use it as total range.
|
||||||
# TODO Take this as input from outside?
|
# TODO Take this as input from outside?
|
||||||
@ -291,6 +290,7 @@ class VariationModel(object):
|
|||||||
for k,v in l.items():
|
for k,v in l.items():
|
||||||
minV[k] = min(v, minV.get(k, v))
|
minV[k] = min(v, minV.get(k, v))
|
||||||
maxV[k] = max(v, maxV.get(k, v))
|
maxV[k] = max(v, maxV.get(k, v))
|
||||||
|
|
||||||
for i,loc in enumerate(locations):
|
for i,loc in enumerate(locations):
|
||||||
box = {}
|
box = {}
|
||||||
for axis,locV in loc.items():
|
for axis,locV in loc.items():
|
||||||
@ -346,16 +346,19 @@ class VariationModel(object):
|
|||||||
for axis,triple in bestAxes.items ():
|
for axis,triple in bestAxes.items ():
|
||||||
box[axis] = triple
|
box[axis] = triple
|
||||||
supports.append(box)
|
supports.append(box)
|
||||||
|
self.supports = supports
|
||||||
|
self._computeDeltaWeights()
|
||||||
|
|
||||||
|
def _computeDeltaWeights(self):
|
||||||
|
deltaWeights = []
|
||||||
|
for i,loc in enumerate(self.locations):
|
||||||
deltaWeight = {}
|
deltaWeight = {}
|
||||||
# Walk over previous masters now, populate deltaWeight
|
# Walk over previous masters now, populate deltaWeight
|
||||||
for j,m in enumerate(locations[:i]):
|
for j,m in enumerate(self.locations[:i]):
|
||||||
scalar = supportScalar(loc, supports[j])
|
scalar = supportScalar(loc, self.supports[j])
|
||||||
if scalar:
|
if scalar:
|
||||||
deltaWeight[j] = scalar
|
deltaWeight[j] = scalar
|
||||||
deltaWeights.append(deltaWeight)
|
deltaWeights.append(deltaWeight)
|
||||||
|
|
||||||
self.supports = supports
|
|
||||||
self.deltaWeights = deltaWeights
|
self.deltaWeights = deltaWeights
|
||||||
|
|
||||||
def getDeltas(self, masterValues):
|
def getDeltas(self, masterValues):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user