ldraw.py

Wed, 20 Dec 2017 17:25:09 +0200

author
Santeri Piippo
date
Wed, 20 Dec 2017 17:25:09 +0200
changeset 6
6da1e81c5652
parent 4
8eb83f200486
permissions
-rw-r--r--

Added code to compute areas of triangles and quadrilaterals

class Colour:
    def __init__(self, index):
        self.index = int(index, 0)
    def __str__(self):
        if self.is_direct_colour():
            # write direct colours with hex codes
            return '0x%07X' % self.index
        else:
            return str(self.index)
    def is_direct_colour(self):
        return self.index >= 0x2000000

mercurial