c4dynamics.datasets.d3_model#
- c4dynamics.datasets.d3_model(d3_name: str) str [source]#
Fetches the path of a 3D model from the local cache.
d3_model downloads and manages 3D model files from c4dynamics datasets.
Model Name
Description
bunny
Point cloud file of Stanford bunny (bunny.pcd, 0.4MB)
bunny_mesh
Polygon file of Stanford bunny (bunny_mesh.ply, 3MB)
F16
A folder of 10 stl files, representing the jet parts as fuselage, ailerons, cockpit, rudder and stabilators (10 files, total 3MB).
The models can be found at C4dynamics/C4dynamics
- Parameters:
d3_name (str) – The name of the 3D model to download
- Returns:
out (str) – A path to the model in the local cache. For the f16 model, the function returns a path to the folder including 10 files.
Examples
Stanford bunny (point cloud)
Import required packages:
>>> import c4dynamics as c4d >>> import open3d as o3d >>> import os
>>> bunnypath = c4d.datasets.d3_model('bunny') Fetched successfully >>> pcd = o3d.io.read_point_cloud(bunnypath) >>> print(pcd) PointCloud with 35947 points. >>> o3d.visualization.draw_geometries([pcd])
Stanford bunny (triangle mesh)
>>> mbunnypath = c4d.datasets.d3_model('bunny_mesh') Fetched successfully >>> ply = o3d.io.read_triangle_mesh(mbunnypath) >>> ply.compute_vertex_normals() >>> print(ply) TriangleMesh with 35947 points and 69451 triangles. >>> o3d.visualization.draw_geometries([ply])
F16 (10 stl files)
>>> f16path = c4d.datasets.d3_model('f16') Fetched successfully >>> model = [] >>> for f in sorted(os.listdir(f16path)): ... model.append(o3d.io.read_triangle_mesh(os.path.join(f16path, f)).compute_vertex_normals()) >>> o3d.visualization.draw_geometries(model)