This commit is contained in:
Star Brilliant 2017-07-04 00:58:45 +08:00
parent 73ce323271
commit ac1b0cfd31
2 changed files with 106 additions and 100 deletions

View File

@ -708,6 +708,7 @@ def FilterBadChars(f):
class safe_list(list): class safe_list(list):
def get(self, index, default=None): def get(self, index, default=None):
try: try:
return self[index] return self[index]

View File

@ -13,6 +13,7 @@ except (AttributeError, ImportError):
extcode = 0 extcode = 0
def main(): def main():
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
for Y in (120, 360): for Y in (120, 360):
@ -23,6 +24,7 @@ def main():
logging.info('(%3d, %3d), %4d, %4d => %4d, %4d, %4d, %4d%%' % (X, Y, rotY, rotZ, outX, outY, outZ, scaleX)) logging.info('(%3d, %3d), %4d, %4d => %4d, %4d, %4d, %4d%%' % (X, Y, rotY, rotZ, outX, outY, outZ, scaleX))
CompareMatrix(rotY, rotZ, outX, outY, outZ) CompareMatrix(rotY, rotZ, outX, outY, outZ)
def CompareMatrix(rotY, rotZ, outX, outY, outZ): def CompareMatrix(rotY, rotZ, outX, outY, outZ):
def ApproxEqual(a, b, e=0.015): def ApproxEqual(a, b, e=0.015):
assert e >= 0 assert e >= 0
@ -31,13 +33,16 @@ def CompareMatrix(rotY, rotZ, outX, outY, outZ):
return 0 return 0
else: else:
return a_b return a_b
def FormatError(i, j, l, r): def FormatError(i, j, l, r):
global extcode global extcode
if ApproxEqual(l, r) != 0: if ApproxEqual(l, r) != 0:
extcode = 1 extcode = 1
logging.error('l[%s][%s]=%9.6f r[%s][%s]=%9.6f' % (i, j, l, i, j, r)) logging.error('l[%s][%s]=%9.6f r[%s][%s]=%9.6f' % (i, j, l, i, j, r))
def sind(x): def sind(x):
return math.sin(x * math.pi / 180.0) return math.sin(x * math.pi / 180.0)
def cosd(x): def cosd(x):
return math.cos(x * math.pi / 180.0) return math.cos(x * math.pi / 180.0)