How to use the pyntcloud.geometry.coord_systems.cartesian_to_spherical 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_spherical():
    expected = np.array([[1, 45, 45], [1, -45, 135]], dtype=np.float32)

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

    result = np.zeros_like(expected)
    radial, azimuthal, polar = cartesian_to_spherical(data)
    result[:, 0] = radial
    result[:, 1] = azimuthal
    result[:, 2] = polar

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

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

    radial, azimuthal, polar = cartesian_to_spherical(data, degrees=False)
    result[:, 0] = radial
    result[:, 1] = azimuthal
    result[:, 2] = polar

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

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

    result = np.zeros_like(expected)
    radial, azimuthal, polar = cartesian_to_spherical(data)
    result[:, 0] = radial
    result[:, 1] = azimuthal
    result[:, 2] = polar

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

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

    radial, azimuthal, polar = cartesian_to_spherical(data, degrees=False)
    result[:, 0] = radial
    result[:, 1] = azimuthal
    result[:, 2] = polar

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

        self.to_be_added["radial"] = radial
        self.to_be_added["polar"] = theta
        self.to_be_added["azimuthal"] = phi