Esempio n. 1
0
    def load_meshes_1(self):
        cube = PhysicsMesh(shapes.cube(10000), (10000, -2000, 40000),
                           color=(0.0, 0.4, 0.8))
        cube_2 = PhysicsMesh(shapes.cube(1), (1, -0.2, 4),
                             color=(0.0, 1.0, 0.0))
        cuboid = PhysicsMesh(shapes.cuboid(0.8, 1.8, 0.2), (-2, 0.3, 5),
                             color=(0.0, 0.0, 0.0))
        pyramid = PhysicsMesh(shapes.square_based_pyramid(2, 2), (-0.5, -1, 6),
                              color=(1.0, 0.0, 0.0))
        triangle = PhysicsMesh.from_raw([(1, 1, 6), (2, 1, 6), (1, 2, 6)],
                                        [(0, 1, 2)])

        cube.velocity = (-100, 0, 0)
        cube_2.velocity = (0.03, 0, 0)
        pyramid.velocity = (0, 0, 0.1)
        triangle.acceleration = (0, -0.01, 0)

        self.meshes.update({
            cube,
            cube_2,
            cuboid,
            pyramid,
            triangle,
        })

        self.meshes.add(
            PhysicsMesh(shapes.cube(0.3), (0, 0, 5), color=(0.9, 0.8, 0.8)))
Esempio n. 2
0
#!/opt/local/bin/python3.3
#kverdey1:ex_5_3.py:excercise 5, problem 3:python
#ex.5.3.a
import shapes
circle = shapes.circle(5)
print("area: ", circle[1])
cube = shapes.cuboid(8, 8, 8)
print("the volume is: ", cube)
Esempio n. 3
0
#!/opt/local/bin/python3.3
#kverdey1:ex_5_4.py:excercise 5, problem 4:python
import shapes
import sys
circle=shapes.circle(sys.argv[1])
print("area: ",circle[1])
cube=shapes.cuboid(sys.argv[2],sys.argv[3],sys.argv[4])
print("the volume is: ",cube)
Esempio n. 4
0
from renderer import renderer
import shapes

r = renderer(resolutionX=800, resolutionY=800)

my_transform = shapes.transform(z=-10,
                                x_scale=1,
                                y_scale=5,
                                z_scale=1,
                                y_angle=0)
my_shape = shapes.cuboid(my_transform)
r.objects.append(my_shape)  # Cuboid

my_transform = shapes.transform(x=-10,
                                z=-20,
                                x_scale=1,
                                y_scale=1,
                                z_scale=1,
                                y_angle=0)
my_shape = shapes.cuboid(my_transform,
                         x_rotate_rate=0,
                         y_rotate_rate=0,
                         z_rotate_rate=1)
r.objects.append(my_shape)  # Cube

r.show()
Esempio n. 5
0
#!/opt/local/bin/python3.3
#kverdey1:ex_5_3.py:excercise 5, problem 3:python
#ex.5.3.a
import shapes
circle=shapes.circle(5)
print("area: ",circle[1])
cube=shapes.cuboid(8,8,8)
print("the volume is: ",cube)
Esempio n. 6
0
 def load_meshes_5(self):
     cuboid = PhysicsMesh(shapes.cuboid(2, 2, 1), (0, 0, 5))
     cuboid.velocity = (0, 0, -0.2)
     self.meshes.add(cuboid)