Re: coordinate and vector transformations between cartesian and cylindrical coordinate system
Guillaume Gay <[email protected]> Mon, 12 Jul 2021 16:46:33 +0200
| Newsgroups | gmane.comp.python.scientific.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Andreas? What exactly do you have in mind? If your positions are stored as a (n, 3) array of points, Cartesian to cylindrical is (for example): |rho = np.linalg.norm(pos[:, :2], axis=1) theta = np.arctan2(pos[:, 1], pos[:, 0]) z = pos[:, 2] | Conversely if you have three cylindrical coordinates (rho, theta, z), you can get the Cartesian with: |x = pos[:, 0] * np.cos(pos[:, 1]) y = pos[:, 0] * np.sin(pos[:, 1]) z = pos[:, 2] | Hope this helps, Best regards, Guillaume On 12/07/2021 16:03, Schuldei, Andreas wrote: > Hi, > > > I am looking for ways to do coordinate and vector transformations > between cartesian and cylindrical coordinates. Scipy has > scipy.spatial.transform > <https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.transform.Rotation.__len__.html>, > but no ready (easy?) way to do the transformations I look for. Is > there a way to use spatial.transform for this that I don't see? > Transformations this common surely are done frequently, but I fail to > find examples that I can learn from or reuse. > > > Kind regards, > > > Andreas > > > _______________________________________________ > SciPy-User mailing list > [email protected] > https://mail.python.org/mailman/listinfo/scipy-user _______________________________________________ SciPy-User mailing list [email protected] https://mail.python.org/mailman/listinfo/scipy-user