estimator.py

class gnp.estimator.GeometryEstimator(pcd: Tensor, orientation: Tensor, function_values: Tensor | None = None, model: str = 'clean_30k', device: device = 'cpu', **patch_kwargs: dict | None)[source]

Bases: object

Geometry estimator for a point cloud.

Parameters:
  • pcd (torch.Tensor) -- Point cloud data.

  • orientation (torch.Tensor) -- Orientation data.

  • function_values (Optional[torch.Tensor]) -- Function values for the point cloud.

  • model (nn.Module) -- Model name.

  • device (torch.device) -- Device to run the model on.

  • data (dict) -- Dictionary containing the input data.

  • model_path (Path) -- Path to the model state dictionary.

  • model -- Loaded model.

  • config_path (Path) -- Path to the configuration file.

  • cfg (dict) -- Configuration dictionary.

  • patch_loader (PatchLoader) -- Patch loader object.

estimate_quantities(scalar_names: list[str]) dict[source]

Estimate geometric quantities on the point cloud. This function returns a dictionary containing the estimated scalar and/or vector values.

Parameters:

scalar_names (list[str]) -- List of scalar names to estimate. This can be any of the following: 'xyz_coordinates', 'normals', 'tangents', 'mean_curvature', 'gaussian_curvature', 'pca_coordinates', 'normals_pca', 'tangents_pca', 'metric', 'shape', 'weingarten', 'inverse_metric', 'inverse_metric_derivatives', 'det_metric', 'laplace_beltrami_from_coefficients'

Returns:

Dictionary containing the estimated scalar values.

Return type:

dict

flow_step(delta_t: float, subsample_radius: float, smooth_radius: float, smooth_x: bool) dict[source]

Perform a single step of mean curvature flow on the point cloud.

Parameters:
  • delta_t (float) -- Time step for the flow.

  • subsample_radius (float) -- Radius used for subsampling points.

  • smooth_radius (float) -- Radius used for smoothing mean curvature.

  • smooth_x (bool) -- Whether to smooth the point cloud before flow.

Returns:

Dictionary containing the update point cloud data, normals, and mean curvature.

Return type:

dict

gmls_weights(batch: Batch, radius: float = 1.0, p: int = 4) list[Tensor][source]

Compute the weights for the generalized moving least squares (GMLS) method.

Parameters:
  • batch (Batch) -- Batch containing the input data.

  • radius (float, optional) -- Radius to truncate weight function. Defaults to 1..

  • p (int, optional) -- Degree p of the weight function. Defaults to 4.

Returns:

List of weight matrices for each batch.

Return type:

list[torch.Tensor]

laplace_beltrami_legendre_blocks(surface: SurfacePatch) list[Tensor][source]

Laplace-Beltrami operator of Legendre basis functions at each center point.

Parameters:

surface (SurfacePatch) -- Surface patch object.

Returns:

List of outputs at each center point.

Return type:

list[torch.Tensor]

legendre_blocks(surface: SurfacePatch) list[Tensor][source]

Legendre basis functions blocked by batch.

Parameters:

surface (SurfacePatch) -- Surface patch object.

Returns:

List of outputs per batch.

Return type:

list[torch.Tensor]

mean_flow(num_steps: int, save_data_per_step: int, delta_t: float, subsample_radius: float, smooth_radius: float, smooth_x: bool) list[dict][source]

Perform mean curvature flow on the point cloud.

Parameters:
  • num_steps (int) -- Number of steps to perform.

  • save_data_per_step (int) -- Save data every n steps.

  • delta_t (float) -- Time step for the flow.

  • subsample_radius (float) -- Radius used for subsampling points.

  • smooth_radius (float) -- Radius used for smoothing mean curvature.

  • smooth_x (bool) -- Whether to smooth the point cloud before flow.

Returns:

List of dictionaries containing the updated point cloud data and normals at each saved time step.

Return type:

list[dict]

stiffness_matrix_gmls(drop_ratio: float = 0.1, radius: float = 1.0, p: int = 4, remove_outliers: bool = False) coo_matrix[source]

Compute the stiffness matrix using the generalized moving least squares (GMLS) method.

Parameters:
  • drop_ratio (float, optional) -- Ratio of points to drop. Defaults to 0.1.

  • radius (float, optional) -- Radius to truncate weight function. Defaults to 1..

  • p (int, optional) -- Degree p of the weight function. Defaults to 4.

  • remove_outliers (bool, optional) -- Whether to remove outliers. Defaults to False.

Returns:

Stiffness matrix.

Return type:

sp.coo_matrix

stiffness_on_batch(batch: Batch, radius: float = 1.0, p: int = 4) tuple[Tensor, Tensor][source]

Compute the stiffness matrix on a batch of data.

Parameters:
  • batch (Batch) -- Batch containing the input data.

  • radius (float, optional) -- Radius to truncate weight function. Defaults to 1..

  • p (int, optional) -- Degree p of the weight function. Defaults to 4.

Returns:

Indices and values of the stiffness matrix.

Return type:

torch.Tensor

surface_patch(patch_data: Batch) SurfacePatch[source]

Create a SurfacePatch from the input patch data.

Parameters:

patch_data (Batch) -- Batch containing the input patch data.

Returns:

SurfacePatch object.

Return type:

SurfacePatch