Exemplo n.º 1
0
def gen_sphere(pos=np.array([0, 0, 0]), radius=0.02, subdivisions=2):
    """
    :param pos: 1x3 nparray
    :param radius: 0.02 m by default
    :param subdivisions: levels of icosphere discretization
    :return:
    author: weiwei
    date: 20191228osaka
    """
    return tp.Sphere(sphere_radius=radius,
                     sphere_center=pos,
                     subdivisions=subdivisions)
Exemplo n.º 2
0
def gen_ellipsoid(pos=np.array([0, 0, 0]), axmat=np.eye(3), subdivisions=5):
    """
    :param pos:
    :param axmat: 3x3 mat, each column is an axis of the ellipse
    :param subdivisions: levels of icosphere discretization
    :return:
    author: weiwei
    date: 20191228osaka
    """
    sphere = tp.Sphere(sphere_radius=1,
                       sphere_center=np.zeros(3),
                       subdivisions=subdivisions)
    vertices = axmat.dot(sphere.vertices.T).T
    vertices = vertices + pos
    return trm.Trimesh(vertices=vertices, faces=sphere.faces)