cart_to_spherical_batch

Function cart_to_spherical_batch 

Source
pub fn cart_to_spherical_batch(
    cart: &ArrayView2<'_, f64>,
) -> SpatialResult<Array2<f64>>
Expand description

Converts multiple Cartesian coordinates to spherical coordinates

§Arguments

  • cart - A 2D array of Cartesian coordinates, each row is a 3D point [x, y, z]

§Returns

A 2D array of spherical coordinates, each row is [r, theta, phi]

§Example

use scirs2_core::ndarray::array;
use scirs2_spatial::transform::spherical::cart_to_spherical_batch;

let cart = array![
    [1.0, 0.0, 0.0],  // Point on x-axis
    [0.0, 1.0, 0.0],  // Point on y-axis
    [0.0, 0.0, 1.0],  // Point on z-axis
];
let spherical = cart_to_spherical_batch(&cart.view()).expect("Operation failed");

§Errors

Returns an error if any row of the input array doesn’t have exactly 3 elements