grid.py
def projection(shp, node, griddim, proj = 'persp'):
    """
    Orthographic projection followed by a scaling of the point 'node' onto
    the x-y plane. Camera position (xc, yc) is taken to be the center of mass
    of the shape.

    Used in draw_shapes method.
    """
    x, y, z = np.array(shp.nodes[node]["pos"])
    if proj == 'persp':
        xc, yc, zc = center_of_mass(shp, dims = shp.dims)
        xp = (max(griddim)/(max(griddim)+2*abs(zc))) * (x-xc) + xc
        yp = (max(griddim)/(max(griddim)+2*abs(zc))) * (y-yc) + yc
        return (xp, yp)
    elif proj == 'ortho':
        return (x, y)

    Orthographic projection followed by a scaling of the point 'node' onto
    the x-y plane. Camera position (xc, yc) is taken to be the center of mass
    of the shape.

    Used in draw_shapes method.
    
Orthographic projection followed by a scaling of the point 'node' onto
the x-y plane. Camera position (xc, yc) is taken to be the center of mass
of the shape.

Used in draw_shapes method.
Orthographic projection followed by a scaling of the point ' node ' onto the x - y plane . Camera position ( xc yc ) is taken to be the center of mass of the shape . Used in draw_shapes method .
def projection(shp, node, griddim, proj = 'persp'):
    x, y, z = np.array(shp.nodes[node]["pos"])
    if proj == 'persp':
        xc, yc, zc = center_of_mass(shp, dims = shp.dims)
        xp = (max(griddim)/(max(griddim)+2*abs(zc))) * (x-xc) + xc
        yp = (max(griddim)/(max(griddim)+2*abs(zc))) * (y-yc) + yc
        return (xp, yp)
    elif proj == 'ortho':
        return (x, y)
def projection ( shp , node , griddim , proj = 'persp' ) : x , y , z = np . array ( shp . nodes [ node ] [ "pos" ] ) if proj == 'persp' : xc , yc , zc = center_of_mass ( shp , dims = shp . dims ) xp = ( max ( griddim ) / ( max ( griddim ) + 2 * abs ( zc ) ) ) * ( x - xc ) + xc yp = ( max ( griddim ) / ( max ( griddim ) + 2 * abs ( zc ) ) ) * ( y - yc ) + yc return ( xp , yp ) elif proj == 'ortho' : return ( x , y )
Orthographic projection followed by a scaling of the point 'node' onto
the x-y plane.
Orthographic projection followed by a scaling of the point ' node ' onto the x - y plane .
"""
    Orthographic projection followed by a scaling of the point 'node' onto
    the x-y plane. Camera position (xc, yc) is taken to be the center of mass
    of the shape.

    Used in draw_shapes method.
    """
shp
node
griddim
proj