Example #1
0
    def display(self):
        for i in range(len(self.meshes)):
            mesh = self.meshes[i]

            polygons = []
            for fkey in mesh.faces():
                color_front = self.colors[i]
                color_back = (0.2, 0.2, 0.2, 1.0)
                polygons.append({
                    'points': mesh.face_coordinates(fkey),
                    'color.front': color_front,
                    'color.back': color_back
                })

            lines = []
            for u, v in mesh.wireframe():
                lines.append({
                    'start': mesh.vertex_coordinates(u),
                    'end': mesh.vertex_coordinates(v),
                    'color': (0.1, 0.1, 0.1),
                    'width': 1.
                })

            xdraw_polygons(polygons)
            xdraw_lines(lines)
Example #2
0
 def display(self):
     polygons = []
     for ckey in self.volmesh.cells():
         for fkey in self.volmesh.cell_halffaces(ckey):
             vkeys = self.volmesh.halfface_vertices(fkey, ordered=True)
             points = [
                 self.volmesh.vertex_coordinates(vkey) for vkey in vkeys
             ]
             color_front = (0.7, 0.7, 0.7, 1.0)
             color_back = (0.0, 0.0, 0.0, 1.0)
             polygons.append({
                 'points': points,
                 'color.front': color_front,
                 'color.back': color_back
             })
     lines = []
     for u, v in self.volmesh.edges():
         lines.append({
             'start': self.volmesh.vertex_coordinates(u),
             'end': self.volmesh.vertex_coordinates(v),
             'color': (0.1, 0.1, 0.1),
             'width': 3.
         })
     points = []
     for u in self.volmesh.vertices():
         points.append({
             'pos': self.volmesh.vertex_coordinates(u),
             'size': 10.,
             'color': (0.0, 1.0, 0.0),
         })
     xdraw_polygons(polygons)
     xdraw_lines(lines)
     xdraw_points(points)
Example #3
0
    def display(self):
        xyz = {
            key: self.mesh.vertex_coordinates(key)
            for key in self.mesh.vertices()
        }

        lines = []
        for u, v in self.mesh.wireframe():
            lines.append({
                'start': xyz[u],
                'end': xyz[v],
                'color': (0.1, 0.1, 0.1),
                'width': 1.
            })

        points = []
        for key in self.mesh.vertices():
            points.append({
                'pos': xyz[key],
                'color': (0.0, 1.0, 0.0),
                'size': 10.0
            })

        xdraw_lines(lines)
        xdraw_points(points)

        if self.subd:
            xyz = {
                key: self.subd.vertex_coordinates(key)
                for key in self.subd.vertices()
            }
            front = (0.7, 0.7, 0.7, 1.0)
            back = (0.2, 0.2, 0.2, 1.0)

            poly = []
            for fkey in self.subd.faces():
                poly.append({
                    'points': self.subd.face_coordinates(fkey),
                    'color.front': front,
                    'color.back': back
                })

            lines = []
            for u, v in self.subd.wireframe():
                lines.append({
                    'start': xyz[u],
                    'end': xyz[v],
                    'color': (0.1, 0.1, 0.1),
                    'width': 1.
                })

            xdraw_polygons(poly)
            xdraw_lines(lines)
Example #4
0
    def display(self):
        polygons = []
        for fkey in self.mesh.faces():
            points = self.mesh.face_coordinates(fkey)
            color_front = self.mesh.get_face_attribute(fkey, 'color',
                                                       (0.8, 0.8, 0.8, 1.0))
            color_back = (0.2, 0.2, 0.2, 1.0)
            polygons.append({
                'points': points,
                'color.front': color_front,
                'color.back': color_back
            })

        lines = []
        for u, v in self.mesh.edges():
            lines.append({
                'start': self.mesh.vertex_coordinates(u),
                'end': self.mesh.vertex_coordinates(v),
                'color': (0.1, 0.1, 0.1),
                'width': 1.
            })

        points = []
        for key in self.mesh.vertices():
            points.append({
                'pos': self.mesh.vertex_coordinates(key),
                'color': (0.4, 0.4, 0.4),
                'size': 5.0
            })

        # normals = []
        # for fkey in self.mesh.faces():
        #     n  = self.mesh.face_normal(fkey, unitized=True)
        #     sp = self.mesh.face_centroid(fkey)
        #     ep = [sp[axis] + n[axis] for axis in (0, 1, 2)]
        #     normals.append({
        #         'start' : sp,
        #         'end'   : ep,
        #         'color' : (0.0, 1.0, 0.0),
        #         'width' : 2.0
        #     })

        xdraw_polygons(polygons)
        xdraw_lines(lines)
        xdraw_points(points)