Exemple #1
0
 def __init__(self):
     super(SnowFigure, self).__init__()
     self.child_nodes = [Sphere(), Sphere(), Sphere()]
     self.child_nodes[0].translate(0, -0.6, 0)
     self.child_nodes[1].translate(0, 0.1, 0)
     self.child_nodes[1].scaling_matrix = numpy.dot(self.scaling_matrix, scaling([0.8, 0.8, 0.8]))
     self.child_nodes[2].translate(0, 0.75, 0)
     self.child_nodes[2].scaling_matrix = numpy.dot(self.scaling_matrix, scaling([0.7, 0.7, 0.7]))
     for child_node in self.child_nodes:
         child_node.color_index = color.MIN_COLOR
     self.aabb = AABB([0.0, 0.0, 0.0], [0.5, 1.1, 0.5])
Exemple #2
0
 def __init__(self):
     super(SnowFigure, self).__init__()
     self.child_nodes = [Sphere(), Sphere(), Sphere()]
     self.child_nodes[0].translate(0, -0.6, 0)
     self.child_nodes[1].translate(0, 0.1, 0)
     self.child_nodes[1].scaling_matrix = numpy.dot(
         self.scaling_matrix, scaling([0.8, 0.8, 0.8]))
     self.child_nodes[2].translate(0, 0.75, 0)
     self.child_nodes[2].scaling_matrix = numpy.dot(
         self.scaling_matrix, scaling([0.7, 0.7, 0.7]))
     for child_node in self.child_nodes:
         child_node.color_index = color.MIN_COLOR
     self.aabb = AABB([0.0, 0.0, 0.0], [0.5, 1.1, 0.5])
Exemple #3
0
    def scale(self, up, set_scale_z=False, scale_z=1):

        s = 1.1 if up else 0.9

        self.scaling_matrix = numpy.dot(self.scaling_matrix, scaling([s, s,
                                                                      s]))

        self.aabb.scale(s)
Exemple #4
0
 def scale(self, s):
     self.scaling_matrix = numpy.dot(self.scaling_matrix, scaling([s, s,
                                                                   s]))
Exemple #5
0
 def scale(self, up):
     s = self.scale_mult * 1.1 if up else 0.9
     self.scalemat = numpy.dot(self.scalemat, scaling([s, s, s]))
     self.aabb.scale(s)
Exemple #6
0
 def scale(self, up):
     s =  1.1 if up else 0.9
     self.scaling_matrix = numpy.dot(self.scaling_matrix, scaling([s, s, s]))
     self.aabb.scale(s)
Exemple #7
0
 def scale(self, up):
     s = 1.1 if up else 0.9
     self.scaling_matrix = numpy.dot(self.scaling_matrix, scaling([s, s,
                                                                   s]))
Exemple #8
0
 def scale(self, up):
     s = self.scale_mult * 1.1 if up else 0.9
     self.scalemat = numpy.dot(self.scalemat, scaling([s, s, s]))
     self.aabb.scale(s)
Exemple #9
0
    def scale_init(self, x, y, z):

        self.scaling_matrix = numpy.dot(self.scaling_matrix, scaling([x, y,
                                                                      z]))
Exemple #10
0
from transformation import transformation, rotation, scaling, translation, shear

lines = [[[50, 50], [-50, 50]], [[-50, 50], [-50, -50]], [[-50, -50],
                                                          [50, -50]],
         [[50, -50], [50, 50]]]

transformation('square.svg', lines, 0)

transformation('rotation45.svg', lines, 1, rotation(45))

transformation('rotation17x10.svg', lines, 17, rotation(10))

# uloha 2

transformation('ukazka-2.svg', lines, 15, rotation(10), scaling(1.1, 0.8))

# uloha 3

transformation('ukazka-3.svg', lines, 25, shear(1.3), rotation(10),
               scaling(0.9, 0.9), translation(50, 50))

# uloha 1
lines = [[[-25, 0], [25, 0]], [[25, 0], [25, 50]], [[25, 50], [-25, 50]],
         [[-25, 50], [-25, 0]]]

transformation('ukazka-1.svg', lines, 10, rotation(20), scaling(1.1, 1.1),
               translation(5, 10))

transformation('ukazka-1-uprava.svg', lines, 10, rotation(20),
               scaling(1.1, 1.1), translation(5, 0))