Logo Search packages:      
Sourcecode: matplotlib version File versions  Download package

def mpl_toolkits::mplot3d::art3d::Poly3DCollection::do_3d_projection (   self,

Perform the 3D projection for this object.

Definition at line 319 of file art3d.py.

00319                                         :
        Perform the 3D projection for this object.

        if self._A is not None:
            self._facecolors3d = self._facecolors

        txs, tys, tzs = proj3d.proj_transform_vec(self._vec, renderer.M)
        xyzlist = [(txs[si:ei], tys[si:ei], tzs[si:ei]) \
                for si, ei in self._segis]

        # This extra fuss is to re-order face / edge colors
        cface = self._facecolors3d
        cedge = self._edgecolors3d
        if len(cface) != len(xyzlist):
            cface = cface.repeat(len(xyzlist), axis=0)
        if len(cedge) != len(xyzlist):
            if len(cedge) == 0:
                cedge = cface
            cedge = cedge.repeat(len(xyzlist), axis=0)

        # if required sort by depth (furthest drawn first)
        if self._zsort:
            z_segments_2d = [(np.average(zs), zip(xs, ys), fc, ec) for
                    (xs, ys, zs), fc, ec in zip(xyzlist, cface, cedge)]
            z_segments_2d.sort(cmp=lambda x, y: cmp(y[0], x[0]))
            raise ValueError, "whoops"

        segments_2d = [s for z, s, fc, ec in z_segments_2d]
        PolyCollection.set_verts(self, segments_2d)

        self._facecolors2d = [fc for z, s, fc, ec in z_segments_2d]
        if len(self._edgecolors3d) == len(cface):
            self._edgecolors2d = [ec for z, s, fc, ec in z_segments_2d]
            self._edgecolors2d = self._edgecolors3d

        # Return zorder value
        if self._sort_zpos is not None:
           zvec = np.array([[0], [0], [self._sort_zpos], [1]])
           ztrans = proj3d.proj_transform_vec(zvec, renderer.M)
           return ztrans[2][0]
            return np.min(tzs)

    def set_facecolor(self, colors):

Generated by  Doxygen 1.6.0   Back to index