spherical_to_cartesian {spheresmooth}R Documentation

Convert spherical coordinates to Cartesian coordinates

Description

This function converts spherical coordinates (theta, phi) to Cartesian coordinates.

Usage

spherical_to_cartesian(theta_phi, byrow = TRUE)

Arguments

theta_phi

A matrix where each row contains the spherical coordinates (theta, phi) of a point.

byrow

logical. If TRUE (the default) the matrix is filled by rows, otherwise the matrix is filled by columns.

Value

A matrix where each row contains the Cartesian coordinates (x, y, z) of a point.

Examples

theta_phi <- matrix(c(pi/4, pi/3, pi/6, pi/4), ncol = 2, byrow = TRUE)
spherical_to_cartesian(theta_phi)

[Package spheresmooth version 0.1.3 Index]