Example #1
0
def mesh_generator():
    """Yields meshes
    Yields:
        open3d.geometry.TriangleMesh: yielded mesh 
    """
    yield meshes.armadillo()
    yield meshes.bunny()
Example #2
0
def mesh_generator():
    mesh = o3d.geometry.TriangleMesh.create_box()
    mesh.rotate((0.3, 0.5, 0.1))
    yield "rotated box mesh", mesh
    yield "rotated box pcd", mesh.sample_points_uniformly(500)

    mesh = meshes.armadillo()
    yield "armadillo mesh", mesh
    yield "armadillo pcd", mesh.sample_points_uniformly(500)
def problem2():
    mesh = meshes.armadillo()
    vertices = np.asarray(mesh.vertices)
    static_ids = [idx for idx in np.where(vertices[:, 1] < -30)[0]]
    static_positions = []
    for id in static_ids:
        static_positions.append(vertices[id])
    handle_ids = [2490]
    handle_positions = [vertices[2490] + np.array((-40, -40, -40))]

    return mesh, static_ids + handle_ids, static_positions + handle_positions
Example #4
0
def problem_generator():
    o3d.utility.set_verbosity_level(o3d.utility.Debug)

    points = []
    normals = []
    for _ in range(4):
        for _ in range(4):
            pt = (np.random.uniform(-2, 2), np.random.uniform(-2, 2), 0)
            points.append(pt)
            normals.append((0, 0, 1))
    points = np.array(points, dtype=np.float64)
    normals = np.array(normals, dtype=np.float64)
    pcd = o3d.geometry.PointCloud()
    pcd.points = o3d.utility.Vector3dVector(points)
    pcd.normals = o3d.utility.Vector3dVector(normals)
    radii = [1, 2]
    yield pcd, radii

    o3d.utility.set_verbosity_level(o3d.utility.Info)

    gt_mesh = o3d.geometry.TriangleMesh.create_sphere()
    gt_mesh.compute_vertex_normals()
    pcd = gt_mesh.sample_points_poisson_disk(100)
    radii = [0.5, 1, 2]
    yield pcd, radii

    gt_mesh = meshes.bunny()
    gt_mesh.compute_vertex_normals()
    pcd = gt_mesh.sample_points_poisson_disk(2000)
    radii = [0.005, 0.01, 0.02, 0.04]
    yield pcd, radii

    gt_mesh = meshes.armadillo()
    gt_mesh.compute_vertex_normals()
    pcd = gt_mesh.sample_points_poisson_disk(2000)
    radii = [5, 10]
    yield pcd, radii
Example #5
0
def mesh_generator():
    yield o3d.geometry.TriangleMesh.create_sphere()
    yield meshes.knot()
    yield meshes.bunny()
    yield meshes.armadillo()
Example #6
0
    yield "armadillo mesh", mesh
    yield "armadillo pcd", mesh.sample_points_uniformly(500)


if __name__ == "__main__":
    for name, geom in mesh_generator():
        aabox = geom.get_axis_aligned_bounding_box()
        print("%s has an axis aligned box volume of %f" %
              (name, aabox.volume()))
        obox = geom.get_oriented_bounding_box()
        print("%s has an oriented box volume of %f" % (name, obox.volume()))
        aabox.color = [1, 0, 0]
        obox.color = [0, 1, 0]
        o3d.visualization.draw_geometries([geom, aabox, obox])

    mesh = meshes.armadillo()

    bbox = o3d.geometry.AxisAlignedBoundingBox()
    bbox.min_bound = (-30, 0, -10)
    bbox.max_bound = (10, 20, 10)
    o3d.visualization.draw_geometries([mesh, bbox])
    o3d.visualization.draw_geometries([mesh.crop(bbox), bbox])

    bbox = o3d.geometry.OrientedBoundingBox()
    bbox.center = (-10, 10, 0)
    bbox.R = bbox.get_rotation_matrix_from_xyz((2, 1, 0))
    bbox.extent = (40, 20, 20)
    o3d.visualization.draw_geometries([mesh, bbox])
    o3d.visualization.draw_geometries([mesh.crop(bbox), bbox])

    pcd = mesh.sample_points_uniformly(500000)
Example #7
0
def mesh_generator():
    yield o3d.geometry.create_mesh_box()
    yield o3d.geometry.create_mesh_sphere()
    yield meshes.knot()
    yield meshes.bunny()
    yield meshes.armadillo()