Exemple #1
0
    def move(self, measure, direction):
        [dx, dy, dz, _] = normalize(direction) @ rotate(self.angle)

        self.origin = (self.x + measure * dx, self.y + measure * dy,
                       self.z + measure * dz)

        __log__(landscape=str(self))
        __project__("landscape")
Exemple #2
0
def transform(object, transformation):
	object.coordinates = [
		(x, y, z) for [x, y, z, _] in [
			normalize(coordinate) @ transformation
			for coordinate in object.coordinates
		]
	]
	__project__("transformation")
Exemple #3
0
def register(shape):
    global ID_COUNTER
    ID_COUNTER += 1
    shape.id = ID_COUNTER

    global DISPLAY_FILE
    DISPLAY_FILE.append(shape)

    __log__(new_object=shape)
    __project__("display_file")
Exemple #4
0
def delete(id):
    global DISPLAY_FILE

    i = 0
    while i < len(DISPLAY_FILE):
        if DISPLAY_FILE[i].id == id:
            DISPLAY_FILE.pop(i)
            break
        i += 1

    __log__(object_deleted=id)
    __project__("display_file")
Exemple #5
0
    def __init__(self):
        super().__init__()

        self.object_list = ObjectListComponent(self.builder)
        self.drawing_area = DrawingAreaComponent(self.builder)
        self.transformation = TransformationComponent(self.builder)
        self.logger = LogComponent(self.builder)

        __project__("log",
                    welcome="""
            Interactive graphic system project
            
            Arthur Henrique Della Fraga
            Federal University of Santa Catarina""")
Exemple #6
0
 def selection_changed(self, widget):
     __project__("object_selection", id=self.selected_object_id)
Exemple #7
0
    def zoom(self, measure, direction):
        self.scale *= 1 + measure / 100 * direction[2]

        __log__(landscape=str(self))
        __project__("landscape")
Exemple #8
0
    def turn(self, measure, direction):
        self.angle += math.radians(measure * direction[0])
        self.angle %= math.radians(360)

        __log__(landscape=str(self))
        __project__("landscape")
Exemple #9
0
def load(path):
    Loader().load(path)
    __log__(file_loaded=path)
    __project__("display_file")