Beispiel #1
0
 def draw(self):
     '''Draw the shapes.'''
     return Cube(name=self.name,
                 output_dim=self.output_dim,
                 position=self.position,
                 depth=self.depth,
                 facecolor=(207.0 / 255, 242.0 / 255, 212.0 / 255)).draw()
Beispiel #2
0
 def draw(self):
     '''Draw 3D cube for convolution layer.'''
     return Cube(name=self.name,
                 output_dim=self.output_dim,
                 position=self.position,
                 depth=self.depth,
                 facecolor=(255.0 / 255, 242.0 / 255, 204.0 / 255)).draw()
Beispiel #3
0
def generate_new_shapes_test(model):
    shapes = [Cone(), Cube(), Cylinder(), Sphere(), Torus()]
    p = []
    l = []
    for e, s in enumerate(shapes):
        for _ in tqdm(range(100)):
            p.append(s.build())
            l.append(e)
    p = np.stack(p)
    print(np.mean(l == np.argmax(model(p), axis=1)))
    model.summary()
    def load_scene(self):
        scene = []
        scene.append(Cube((-10, -10, 40), 10, 'red'))
        scene.append(Cube((10, -10, 40), 10, 'green'))
        scene.append(Cube((10, -10, 60), 10, 'orange'))
        scene.append(Cube((-10, -10, 60), 10, 'Turquoise'))

        scene.append(Cube((-10, 10, 40), 10, 'Magenta'))
        scene.append(Cube((10, 10, 40), 10, 'Lime'))
        scene.append(Cube((10, 10, 60), 10, 'white'))
        scene.append(Cube((-10, 10, 60), 10, 'yellow'))

        self.scene_data = scene
        self.render()
Beispiel #5
0
    def inizializate(self):
        pygame.init()
        pygame.display.set_mode(self.display, DOUBLEBUF | OPENGL)
        gluPerspective(45, (self.display[0] / self.display[1]), 0.1, 500.0)
        glTranslatef(0.0, 0.0, -300)
        glEnable(GL_DEPTH_TEST);

        for i in xrange(200):
            x = randrange(-100, 100, 1)
            y = randrange(-100, 100, 1)
            z = randrange(-100, 100, 1)
            print x, y, z
            self.objs_buffer.append(Cube(x, y, z))
Beispiel #6
0
def return_shape():
    return choice([Rectangle(), Square(), Cube()])