How to use the pyntcloud.geometry.coord_systems.cartesian_to_cylindrical function in pyntcloud

To help you get started, we’ve selected a few pyntcloud examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github daavoo / pyntcloud / tests / unit / test_geometry.py View on Github external
def test_cartesian_to_cylindrical():
    expected = np.array(
        [[0.7071, 45, 0.7071], [0.7071, -45, -0.7071]], dtype=np.float32)

    data = np.array([[0.5, 0.5, 0.7071], [0.5, -0.5, -0.7071]])

    result = np.zeros_like(expected)
    radial, angular, height = cartesian_to_cylindrical(data)
    result[:, 0] = radial
    result[:, 1] = angular
    result[:, 2] = height

    assert np.all(np.isclose(result, expected))

    expected[:, 1] = np.deg2rad(expected[:, 1])

    radial, angular, height = cartesian_to_cylindrical(data, degrees=False)
    result[:, 0] = radial
    result[:, 1] = angular
    result[:, 2] = height

    assert np.all(np.isclose(result, expected))
github daavoo / pyntcloud / tests / unit / test_geometry.py View on Github external
expected = np.array(
        [[0.7071, 45, 0.7071], [0.7071, -45, -0.7071]], dtype=np.float32)

    data = np.array([[0.5, 0.5, 0.7071], [0.5, -0.5, -0.7071]])

    result = np.zeros_like(expected)
    radial, angular, height = cartesian_to_cylindrical(data)
    result[:, 0] = radial
    result[:, 1] = angular
    result[:, 2] = height

    assert np.all(np.isclose(result, expected))

    expected[:, 1] = np.deg2rad(expected[:, 1])

    radial, angular, height = cartesian_to_cylindrical(data, degrees=False)
    result[:, 0] = radial
    result[:, 1] = angular
    result[:, 2] = height

    assert np.all(np.isclose(result, expected))
github daavoo / pyntcloud / pyntcloud / scalar_fields / sf_xyz.py View on Github external
def compute(self):
        ro, phi, z = cartesian_to_cylindrical(
            self.points, degrees=self.degrees)

        self.to_be_added["ro"] = ro
        self.to_be_added["phi"] = phi