Skip to content

Efficient pytorch transformation function between cartesian and spherical coordinates in n-dimensions.

Notifications You must be signed in to change notification settings

mwoedlinger/n-sphere-pytorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

N-dimensional spherical coordinate transformations in pytorch

Efficient pytorch transformation function between cartesian and spherical coordinates in n-dimensions.

Usage

Convert from cartesian coordinates to spherical coordinates:

    >>> x_cartesian = torch.tensor([1.0, 1.0, 1.0])
    >>> x_spherical = to_spherical(x_cartesian)
    >>>  print(x_spherical)
    tensor([1.7321, 0.9553, 0.7854])

Convert from spherical to cartesian coordinates:

    >>> x_cartesian = torch.tensor([1.7321, 0.9553, 0.7854])
    >>> x_cartesian = to_cartesian(x_spherical)
    >>>  print(x_spherical)
    tensor([1.0000, 1.0000, 1.0000])

The methods also support batched input. In general they expect a torch tensor of shape (..., n).

About

Efficient pytorch transformation function between cartesian and spherical coordinates in n-dimensions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages