Function to transform Cartesian coordinates to spherical coordinates.
tfg.math.math_helpers.cartesian_to_spherical_coordinates(
point_cartesian: TensorLike,
eps: Float = None,
name: str = 'cartesian_to_spherical_coordinates'
) -> tf.Tensor
This function assumes a right handed coordinate system with z
pointing up.
When x
and y
are both 0
, the function outputs 0
for phi
. Note that
the function is not smooth when x = y = 0
.
Note | |
---|---|
In the following, A1 to An are optional batch dimensions. |
Returns | |
---|---|
A tensor of shape [A1, ..., An, 3] . The last dimensions contains
(r ,theta ,phi ), where r is the sphere radius, theta is the polar
angle and phi is the azimuthal angle. Returns NaN gradient if x = y = 0.
|