def dot( arr3d, vec ):
    """ 
    arr3d is numpy array with shape (m,n,3) and
    vec is numpy array with shape (3,) or (m,n,3).
    
    Returns the dot product between vec and all elements on
    the last axis of arr3d

    Outputs array with shape (m,n)

    
    """
    
    d = arr3d*vec
    
    return d[:,:,0]+d[:,:,1]+d[:,:,2]