forked from ManimCommunity/manim
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use math convention in polar coordinates (ManimCommunity#2095)
* switched phi and theta * added tests Co-authored-by: Darylgolden <darylgolden@gmail.com>
- Loading branch information
1 parent
eb09675
commit bb92fee
Showing
2 changed files
with
46 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import numpy as np | ||
|
||
from manim import cartesian_to_spherical, spherical_to_cartesian | ||
|
||
|
||
def test_polar_coords(): | ||
a = np.array([1, 1, 0]) | ||
b = (2, np.pi / 2, np.pi / 2) | ||
assert all( | ||
np.round(cartesian_to_spherical(a), 4) | ||
== np.round([2 ** 0.5, np.pi / 2, np.pi / 4], 4), | ||
) | ||
assert all(np.round(spherical_to_cartesian(b), 4) == np.array([0, 2, 0])) |