DeepSDFStruct.sampling#
Functions
|
|
|
|
|
|
|
random points in a unit sphere centered at (0, 0, 0) |
|
random points in a cube with size box_size centered at (0, 0, 0) |
|
|
|
Sample noisy points around a mesh surface and evaluate them with a signed distance function (SDF). |
Classes
|
|
|
|
- class DeepSDFStruct.sampling.SDFSampler(outdir, splitdir, dataset_name, unify_multipatches=True)#
Bases:
object
- add_class(geom_list, class_name)#
- Return type:
None
- Parameters:
geom_list (list)
class_name (str)
- get_sdf_from_geometry(geometry, n_faces, unify_multipatches=True, threshold=1e-05)#
- Return type:
- Parameters:
n_faces (int)
unify_multipatches (bool)
threshold (float)
- process_geometries(sampling_strategy='uniform', n_faces=100, n_samples=100000.0, unify_multipatches=True, compute_mechanical_properties=True, show=False)#
- Parameters:
n_samples (int)
- sample_sdf(sdf, show=False, n_samples=100000.0, sampling_strategy='uniform', box_size=None, stds=[0.0025, 0.00025])#
- Parameters:
n_samples (int)
- write_json(json_fname)#
- class DeepSDFStruct.sampling.SampledSDF(samples, distances)#
Bases:
object
- Parameters:
samples (torch._VariableFunctionsClass.tensor)
distances (torch._VariableFunctionsClass.tensor)
- create_gus_plottable()#
-
distances:
tensor
#
-
samples:
tensor
#
- split_pos_neg()#
- property stacked#
- class DeepSDFStruct.sampling.SphereParameters#
Bases:
TypedDict
-
cx:
float
#
-
cy:
float
#
-
cz:
float
#
-
r:
float
#
-
cx:
- DeepSDFStruct.sampling.move(t_mesh, new_center)#
- DeepSDFStruct.sampling.noisy_sample(t_mesh, std, count)#
- DeepSDFStruct.sampling.process_single_geometry(args)#
- DeepSDFStruct.sampling.random_points(count)#
random points in a unit sphere centered at (0, 0, 0)
- DeepSDFStruct.sampling.random_points_cube(count, box_size)#
random points in a cube with size box_size centered at (0, 0, 0)
- DeepSDFStruct.sampling.random_sample_sdf(sdf, bounds, n_samples, type='uniform', device='cpu', dtype=torch.float32)#
- DeepSDFStruct.sampling.sample_mesh_surface(sdf, mesh, n_samples, stds, device='cpu', dtype=torch.float32)#
Sample noisy points around a mesh surface and evaluate them with a signed distance function (SDF).
This function uses trimesh.sample to generate surface samples and perturbs them with Gaussian noise of varying standard deviations, and queries the SDF at those points.
- Parameters:
sdf (SDFBase) – A callable SDF object that takes 3D points and returns signed distances.
mesh (gus.Faces) – A mesh object containing the vertices.
n_samples (int) – Number of mesh vertices to sample
stds (list[float]) – Standard deviations for Gaussian noise added to sampled vertices. - Typical values: [0.05, 0.0015]. - Larger values spread samples farther from the surface; smaller values keep them closer.
device (str, optional) – Torch device to place tensors on (e.g., “cpu” or “cuda”).
dtype (torch.dtype, optional) – Data type for generated tensors (default: torch.float32).
- Returns:
- An object containing:
samples (torch.Tensor): The perturbed sample points of shape (n_samples * len(stds), 3).
distances (torch.Tensor): The corresponding SDF values at those sample points.
- Return type: