INNER CODE UNIT · Python
printCoef
lessthanoptimal/BoofCV · main/boofcv-geo/src/generate/python/nister5_detB.py:26
def printCoef( equation , power ):
# Make sure negative symbols are not stripped and split into multiplicative blocks
s = str(equation).replace('- ','-').split(' ')
# Only print coeffients of the appropriate power and strip of z
if power > 1:
tail = '^'+str(power)
s = [w[:-len(tail)-2] for w in s if w.endswith(tail)]
elif power == 1:
s = [w[:-2] for w in s if w.endswith('z') ]
else:
s = [w for w in s if len(w) > 1 and w.find('z') == -1]
ret = s[0]
for w in s[1:]:
if w[0] == '-':
ret += ' - '+w[1:]
else: