Skip to content

SamplePoints

SamplePoints(
    num: int, remove_faces: bool = True, include_normals: bool = False
)

Bases: BaseTransform

Uniformly samples a fixed number of points on the faces of a mesh (pos and face), with probabilities proportional to the face areas (with mx.random).

Parameters:

Name Type Description Default
num int

The number of points to sample.

required
remove_faces bool

If True, removes the face attribute. Default: True

True
include_normals bool

If True, stores the normal of the face of each sampled point in normal. Default: False

False

Example:

from mlx_graphs.datasets import ModelNet
from mlx_graphs.transforms import SamplePoints

dataset = ModelNet("10", transform=SamplePoints(1024))
Source code in mlx_graphs/transforms/point_cloud.py
def __init__(
    self, num: int, remove_faces: bool = True, include_normals: bool = False
):
    self.num = num
    self.remove_faces = remove_faces
    self.include_normals = include_normals

from mlx_graphs.transforms import SamplePoints · mlx_graphs/transforms/point_cloud.py