kaolin.conversions.sdfconversions¶
-
sdf_to_pointcloud
(sdf: <module 'kaolin.rep.SDF' from '/home/docs/checkouts/readthedocs.org/user_builds/kaolin-jfl/envs/latest/lib/python3.6/site-packages/kaolin-0.2.0+756dba9-py3.6-linux-x86_64.egg/kaolin/rep/SDF.py'>, bbox_center: float = 0.0, bbox_dim: float = 1.0, resolution: int = 32, upsampling_steps: int = 2, num_points: int = 5000)[source]¶ Converts an SDF fucntion to a point cloud.
- Parameters
sdf (kaolin.rep.SDF) – an object with a .eval_occ function that indicates which of a set of passed points is inside the surface.
bbox_center (float) – center of the surface’s bounding box.
bbox_dim (float) – largest dimension of the surface’s bounding box.
resolution (int) – the initial resolution of the voxel, should be large enough to properly define the surface.
upsampling_steps (int) – Number of times the initial resolution will be doubled. The returned resolution will be resolution * (2 ^ upsampling_steps)
num_points (int) – number of points in computed point cloud.
- Returns
computed point cloud
- Return type
(torch.FloatTensor)
Example
>>> sdf = kal.rep.SDF.sphere() >>> points = kal.conversion.sdf_to_pointcloud(sdf, bbox_dim=2)
-
sdf_to_trianglemesh
(sdf: <module 'kaolin.rep.SDF' from '/home/docs/checkouts/readthedocs.org/user_builds/kaolin-jfl/envs/latest/lib/python3.6/site-packages/kaolin-0.2.0+756dba9-py3.6-linux-x86_64.egg/kaolin/rep/SDF.py'>, bbox_center: float = 0.0, bbox_dim: float = 1.0, resolution: int = 32, upsampling_steps: int = 2)[source]¶ Converts an SDF function to a mesh
- Parameters
sdf (kaolin.rep.SDF) – an object with a .eval_occ function that indicates which of a set of passed points is inside the surface.
bbox_center (float) – center of the surface’s bounding box.
bbox_dim (float) – largest dimension of the surface’s bounding box.
resolution (int) – the initial resolution of the voxel, should be large enough to properly define the surface.
upsampling_steps (int) – Number of times the initial resolution will be doubled. The returned resolution will be resolution * (2 ^ upsampling_steps)
- Returns
computed mesh preperties
- Return type
Example
>>> sdf = kal.rep.SDF.sphere() >>> verts, faces = kal.conversion.sdf_to_trianglemesh(sdf, bbox_dim=2) >>> mesh = kal.rep.TriangleMesh.from_tensors(verts, faces)
-
sdf_to_voxelgrid
(sdf: <module 'kaolin.rep.SDF' from '/home/docs/checkouts/readthedocs.org/user_builds/kaolin-jfl/envs/latest/lib/python3.6/site-packages/kaolin-0.2.0+756dba9-py3.6-linux-x86_64.egg/kaolin/rep/SDF.py'>, bbox_center: float = 0.0, bbox_dim: float = 1.0, resolution: int = 32, upsampling_steps: int = 2)[source]¶ Converts an SDF to a voxel grid.
- Parameters
sdf (kaolin.rep.SDF) – an object with a .eval_occ function that indicates which of a set of passed points is inside the surface.
bbox_center (float) – center of the surface’s bounding box.
bbox_dim (float) – largest dimension of the surface’s bounding box.
resolution (int) – the initial resolution of the voxel, should be large enough to properly define the surface.
upsampling_steps (int) – Number of times the initial resolution will be doubled. The returned resolution will be resolution * (2 ^ upsampling_steps)
- Returns
a voxel grid
- Return type
Example
>>> sdf = kal.rep.SDF.sphere() >>> voxel = kal.conversions.sdf_to_voxelgrid(sdf, bbox_dim = 2)