def get_formatted(self): tx, ty, tz = self.get_translation() angle, direction, point = self.get_orientation() point = tuple(point[:3]) if angle == 0.0: o = 'None' else: all_true = lambda x, y: fequals_sequence(x, y) == (True, True, True) if all_true(direction, (1, 0, 0)): d = 'X' elif all_true(direction, (0, 1, 0)): d = 'Y' elif all_true(direction, (0, 0, 1)): d = 'Z' else: d = '%.3f, %.3f, %.3f' % direction if all_true(point, (0, 0, 0)): p = '' else: p = ' %.3f, %.3f, %.3f' % point o = '%.3f, %s' % (angle, d + p) return 'T=(%.3f, %.3f, %.3f), O=%s' % (tx, ty, tz, o)
def __eq__(self, color): ''' Check if this color is the same as I{color}. >>> c1 = Color((0.5, 0.6, 0.7)) >>> c2 = Color((0.5, 0.6000000001, 0.700000002)) >>> c3 = Color((0.5, 0.6001, 0.7002)) >>> c1 == c2 True >>> c1 == c3 False ''' equality = fequals_sequence(color.get_rgb(), self.get_rgb()) return False not in equality