Skip to content

Normal

Classes for point normal

NormalizeNormal

Normalize normal vectors to unit length for a point cloud.

This transform expects a dictionary containing:

  • "coord": NumPy array of shape (N, 3) with point coordinates.
Source code in src\augmentation_class.py
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
@TRANSFORMS.register()
class NormalizeNormal:
    """Normalize normal vectors to unit length for a point cloud.

    This transform expects a dictionary containing:

    * `"coord"`: NumPy array of shape (N, 3) with point coordinates.
    """
    def __call__(self, data_dict: dict) -> dict:
        """Normalizes normal vectors to unit length.
        Args:
            data_dict (dict): Input dictionary that must contain a "norm" key
                        with a NumPy array of shape (N, 3) representing normal vectors.

        Returns:
            dict: The same dictionary with "norm" normalized to unit length.
        """
        if "norm" in data_dict.keys():
            # preprocess.normalize handles zero divisor
            data_dict["norm"] = preprocessing.normalize(data_dict["norm"], norm='l2')

        return data_dict

__call__(data_dict)

Normalizes normal vectors to unit length. Args: data_dict (dict): Input dictionary that must contain a "norm" key with a NumPy array of shape (N, 3) representing normal vectors.

Returns:

Name Type Description
dict dict

The same dictionary with "norm" normalized to unit length.

Source code in src\augmentation_class.py
46
47
48
49
50
51
52
53
54
55
56
57
58
59
def __call__(self, data_dict: dict) -> dict:
    """Normalizes normal vectors to unit length.
    Args:
        data_dict (dict): Input dictionary that must contain a "norm" key
                    with a NumPy array of shape (N, 3) representing normal vectors.

    Returns:
        dict: The same dictionary with "norm" normalized to unit length.
    """
    if "norm" in data_dict.keys():
        # preprocess.normalize handles zero divisor
        data_dict["norm"] = preprocessing.normalize(data_dict["norm"], norm='l2')

    return data_dict