volmdlr_tools.shapes.signatures package#
Shape signatures for comparing and classifying 3D shapes.
Submodules#
volmdlr_tools.shapes.signatures.distributions module#
Shape distribution based signatures (A3, D1-D4).
Reference: Osada et al. “Shape Distributions” http://graphics.stanford.edu/courses/cs468-08-fall/pdf/osada.pdf
These signatures use histogram-based similarity and are kept separate from the feature-based CompositeSignature system.
- class volmdlr_tools.shapes.signatures.distributions.A3Signature(shape_distribution: list[float], name: str = '')#
Bases:
ShapeDistributionSignatureAngle signature ‘A3’ - measures angles between three random points.
Reference: Osada et al. “Shape Distributions”
- static get_shape_distribution_from_points(points: ndarray) list[float]#
Compute the A3 shape distribution.
- class volmdlr_tools.shapes.signatures.distributions.D1Signature(shape_distribution: list[float], name: str = '')#
Bases:
ShapeDistributionSignatureDistance signature ‘D1’ - distance from centroid to random points.
Reference: Osada et al. “Shape Distributions”
- static get_shape_distribution_from_points(points: ndarray) list[float]#
Compute the D1 shape distribution.
- class volmdlr_tools.shapes.signatures.distributions.D2Signature(shape_distribution: list[float], name: str = '')#
Bases:
ShapeDistributionSignatureDistance signature ‘D2’ - distance between two random points.
Reference: Osada et al. “Shape Distributions”
- static get_shape_distribution_from_points(points: ndarray) list[float]#
Compute the D2 shape distribution.
- class volmdlr_tools.shapes.signatures.distributions.D3Signature(shape_distribution: list[float], name: str = '')#
Bases:
ShapeDistributionSignatureArea signature ‘D3’ - sqrt of triangle area from three random points.
Reference: Osada et al. “Shape Distributions”
- static get_shape_distribution_from_points(points: ndarray) list[float]#
Compute the D3 shape distribution.
- class volmdlr_tools.shapes.signatures.distributions.D4Signature(shape_distribution: list[float], name: str = '')#
Bases:
ShapeDistributionSignatureVolume signature ‘D4’ - cube root of tetrahedron volume from four random points.
Reference: Osada et al. “Shape Distributions”
- static get_shape_distribution_from_points(points: ndarray) list[float]#
Compute the D4 shape distribution.
- class volmdlr_tools.shapes.signatures.distributions.ShapeDistributionSignature(shape_distribution: list[float], name: str = '')#
Bases:
DessiaObjectAbstract class for shape distribution based signatures (A3, D1-D4).
Reference: Osada et al. “Shape Distributions”
- classmethod from_doc_model(doc_model: DocModel, prototype: Prototype | None = None, n_points: int = 1048576) ShapeDistributionSignature#
Create signature from the stored meshes of a DocModel prototype, the root one by default, reading no B-Rep.
- Parameters:
doc_model – The DocModel to read, without converting it to a VolumeModel.
prototype – The prototype whose meshes are sampled, in its own frame.
n_points – Number of points to sample from the mesh.
- classmethod from_mesh(mesh: Mesh3D, n_points: int = 1048576) ShapeDistributionSignature#
Get the shape distribution from a mesh.
- classmethod from_points(points: ndarray) ShapeDistributionSignature#
Get the shape distribution from a 3D point cloud array.
- classmethod from_volume_model(volume_model: VolumeModel, meshing_tolerance: float = 0.001, meshing_angular_tolerance: float = 0.5, n_points: int = 1048576) ShapeDistributionSignature#
Create signature from a volume model.
- get_bins(n_bins: int = 64, bin_range: tuple[float, float] = (0.0, 3.0)) ndarray#
Compute the bins of the shape distribution with fixed range.
- Parameters:
n_bins – Number of bins for the histogram.
bin_range – Fixed range for the histogram bins (after MEAN normalization).
- static get_sample_points_from_mesh(mesh: Mesh3D, n_points: int) ndarray#
Get uniformly sampled points from a mesh.
- static get_shape_distribution_from_points(points: ndarray) list[float]#
Compute the shape distribution from points.
- graph(n_bins: int = 64, bin_range: tuple[float, float] = (0.0, 3.0)) Graph2D#
Specific display tag for PlotData. Add a picture argument.
- similarity(other: ShapeDistributionSignature, n_bins: int = 64, bin_range: tuple[float, float] = (0.0, 3.0)) float#
Compute similarity between two shape distributions using PDF L1 distance.
- Parameters:
other – The other signature to compare with.
n_bins – Number of bins for the histogram.
bin_range – Fixed range for the histogram bins.