peng3d/model.py
def transformTexCoords(self,data,texcoords,dims=2):
        """
        Transforms the given texture coordinates using the internal texture coordinates.
        
        Currently, the dimensionality of the input texture coordinates must always be 2 and the output is 3-dimensional with the last coordinate always being zero.
        
        The given texture coordinates are fitted to the internal texture coordinates. Note that values higher than 1 or lower than 0 may result in unexpected visual glitches.
        
        The length of the given texture coordinates should be divisible by the dimensionality.
        """
        assert dims==2 # TODO
        
        out = []
        
        origcoords = self.tex_coords
        min_u,min_v = origcoords[0],origcoords[1]
        max_u,max_v = origcoords[6],origcoords[7]
        
        diff_u,diff_v = max_u-min_u, max_v-min_v

        itexcoords = iter(texcoords)
        for u,v in zip(itexcoords,itexcoords): # Based on http://stackoverflow.com/a/5389547/3490549
            out_u = min_u+(diff_u*u)
            out_v = min_v+(diff_v*v)
            out.extend((out_u,out_v,0))
        
        return out
def transformTexCoords(self,data,texcoords,dims=2):
        """
        Transforms the given texture coordinates using the internal texture coordinates.
        
        Currently, the dimensionality of the input texture coordinates must always be 2 and the output is 3-dimensional with the last coordinate always being zero.
        
        The given texture coordinates are fitted to the internal texture coordinates. Note that values higher than 1 or lower than 0 may result in unexpected visual glitches.
        
        The length of the given texture coordinates should be divisible by the dimensionality.
        """
        assert dims==2 # TODO
        
        out = []
        
        origcoords = self.tex_coords
        min_u,min_v = origcoords[0],origcoords[1]
        max_u,max_v = origcoords[6],origcoords[7]
        
        diff_u,diff_v = max_u-min_u, max_v-min_v

        itexcoords = iter(texcoords)
        for u,v in zip(itexcoords,itexcoords): # Based on http://stackoverflow.com/a/5389547/3490549
            out_u = min_u+(diff_u*u)
            out_v = min_v+(diff_v*v)
            out.extend((out_u,out_v,0))
        
        return out
Transforms the given texture coordinates using the internal texture coordinates.
        
        Currently, the dimensionality of the input texture coordinates must always be 2 and the output is 3-dimensional with the last coordinate always being zero.
        
        The given texture coordinates are fitted to the internal texture coordinates. Note that values higher than 1 or lower than 0 may result in unexpected visual glitches.
        
        The length of the given texture coordinates should be divisible by the dimensionality.