DeepSDFStruct.SDF#
Functions
|
Generates an equidistant 3D grid of points within the given bounding box. |
|
Calculates the minimum distance from one or more query points to one or more line segments defined by endpoints P1 and P2. |
|
D: np.array of shape (num_points, num_geometries) k: smoothness parameter |
Classes
|
|
A dictionary type describing boundary conditions ("caps") for each axis direction (x, y, z). |
|
|
|
|
Abstract base class for Signed Distance Functions with optional deformation and parametrization. |
|
|
|
|
|
|
|
|
|
Generic SDF wrapper that applies a transformation to the input queries. |
- class DeepSDFStruct.SDF.BoxSDF(box_size=1, center=tensor([0, 0, 0]))#
Bases:
DeepSDFStruct.SDF.SDFBase
- Parameters:
box_size (float)
center (torch._VariableFunctionsClass.tensor)
- class DeepSDFStruct.SDF.CapBorderDict#
Bases:
TypedDict
A dictionary type describing boundary conditions (“caps”) for each axis direction (x, y, z).
Each key (x0, x1, y0, y1, z0, z1) corresponds to one boundary face of a 3D domain, and maps to a dictionary with two fields:
cap (int): Type of cap applied (e.g., -1 = none, 1 = active).
measure (float): Numerical measure associated with the cap (e.g., thickness, scaling factor, tolerance).
Example
>>> caps: CapBorderDict = { ... "x0": {"cap": 1, "measure": 0.02}, ... "x1": {"cap": 1, "measure": 0.02}, ... "y0": {"cap": 1, "measure": 0.02}, ... "y1": {"cap": 1, "measure": 0.02}, ... "z0": {"cap": 1, "measure": 0.02}, ... "z1": {"cap": 1, "measure": 0.02}, ... }
- class DeepSDFStruct.SDF.NegatedCallable(obj)#
Bases:
DeepSDFStruct.SDF.SDFBase
- class DeepSDFStruct.SDF.SDFBase(deformation_spline=None, parametrization=None, cap_border_dict=None, cap_outside_of_unitcube=False)#
Bases:
abc.ABC
Abstract base class for Signed Distance Functions with optional deformation and parametrization.
- Parameters:
deformation_spline (DeepSDFStruct.torch_spline.TorchSpline | None)
parametrization (torch.nn.modules.module.Module | None)
cap_border_dict (DeepSDFStruct.SDF.CapBorderDict)
- property cap_border_dict#
- property deformation_spline#
- property parametrization#
- plot_slice(*args, **kwargs)#
- class DeepSDFStruct.SDF.SDFfromDeepSDF(model, max_batch=32768)#
Bases:
DeepSDFStruct.SDF.SDFBase
- Parameters:
- set_latent_vec(latent_vec)#
Set conditioning parameters for the model (e.g., latent code).
- Parameters:
latent_vec (torch.Tensor)
- class DeepSDFStruct.SDF.SDFfromLineMesh(line_mesh, thickness, smoothness=0)#
Bases:
DeepSDFStruct.SDF.SDFBase
- Parameters:
line_mesh (gustaf.edges.Edges)
-
line_mesh:
Edges
#
- class DeepSDFStruct.SDF.SDFfromMesh(mesh, dtype=<class 'numpy.float32'>, flip_sign=False, scale=True, threshold=1e-05)#
Bases:
DeepSDFStruct.SDF.SDFBase
- class DeepSDFStruct.SDF.SummedSDF(obj1, obj2)#
Bases:
DeepSDFStruct.SDF.SDFBase
- Parameters:
obj1 (DeepSDFStruct.SDF.SDFBase)
obj2 (DeepSDFStruct.SDF.SDFBase)
- class DeepSDFStruct.SDF.TransformedSDF(sdf, rotation=None, translation=None, scale=None)#
Bases:
DeepSDFStruct.SDF.SDFBase
Generic SDF wrapper that applies a transformation to the input queries. Transformation can be rotation, translation, or scaling.
- Parameters:
- DeepSDFStruct.SDF.get_equidistant_grid_sample(bounds, grid_spacing, dtype=torch.float32, device='cpu')#
Generates an equidistant 3D grid of points within the given bounding box.
- Parameters:
bounds (torch.Tensor) – Tensor of shape (2,3), [[xmin, ymin, zmin], [xmax, ymax, zmax]]
grid_spacing (float) – Approximate spacing between points along each axis.
- Returns:
points – Tensor of shape (N,3) containing all grid points.
- Return type:
torch.Tensor
- DeepSDFStruct.SDF.point_segment_distance(P1, P2, query_points)#
Calculates the minimum distance from one or more query points to one or more line segments defined by endpoints P1 and P2.
- Parameters:
P1 (np.ndarray) – Array of shape (M, 2) or (2,) representing first endpoints of segments.
P2 (np.ndarray) – Array of shape (M, 2) or (2,) representing second endpoints of segments.
query_points (np.ndarray) – Array of shape (N, 2) or (2,) representing query point(s).
- Returns:
- Array of shape (N,) with the minimum distance from each query point
to the closest segment.
- Return type:
np.ndarray
- DeepSDFStruct.SDF.union(D, k=0)#
D: np.array of shape (num_points, num_geometries) k: smoothness parameter