简体   繁体   English

笛卡尔到极坐标的转换

[英]Cartesian to Polar coordinate transformation in manim

How can I write a code that would show me this transformation, in the same format as the equation not like carrying it to the complex plain etc. because I want to play with it for other functions as well.我如何编写一个代码来向我展示这种转换,其格式与方程式相同,而不是将其带到复杂的平原等,因为我也想将它用于其他功能。

点击打开公式

I tried myself a little bit and came up with this code that might be useful howeever I couldn't work it out to give me polar coordinates.我尝试了一下自己并想出了这段代码,它可能很有用,但是我无法给出极坐标。

class Transformation(LinearTransformationScene):
    def construct(self):
        
        line = Line(start=np.array([0,0,0]),
    end=np.array([2,1,0]))
        
        function = lambda pos: np.dot(np.array(pos[0]*np.cos(pos[1]), pos[0]*np.sin(pos[1])), pos)

        self.add_transformable_mobject(line)

        self.apply_nonlinear_transformation(function, run_time=5)

        self.wait(3)

To transform cartesian coordinates to polar ones, you need this formula:要将笛卡尔坐标转换为极坐标,您需要以下公式:

fi = numpy.arctan2(y, x)
r = numpy.hypot(y, x)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 笛卡尔图像到极坐标 - Cartesian image to polar coordinate 将笛卡尔坐标系转换为具有多点的极坐标系 - Convert Cartesian coordinate system to polar coordinate system with multi-points Python-matplotlib中具有极坐标散点图的坐标变换 - Python - Coordinate transformation with polar scatter plot in matplotlib xarray:具有低开销轴坐标变换的极坐标 pcolormesh - xarray: polar pcolormesh with low-overhead axis coordinate transformation 在 Python 中快速笛卡尔到极坐标到笛卡尔 - fast Cartesian to Polar to Cartesian in Python 绘制受简单圆形轨道影响的流场 - 双曲吸引子,以极坐标给出,在笛卡尔坐标系中 - Python - Plotting flow field influenced by a simple circular orbit - hyperbolic attractor, given in polar coordinates, in Cartesian coordinate system - Python 如何使用 `cv2.warpPolar` 在笛卡尔坐标系和极坐标系之间正确转换图像? - How to properly convert image between Cartesian and polar coordinate systems using `cv2.warpPolar`? 根据从极坐标到笛卡尔坐标的变换重新排列二维数组中的数据 - Rearrange data in two-dimensional array according to transformation from polar to Cartesian coordinates 将极坐标重新投影到笛卡尔网格 - Reprojecting polar to cartesian grid pyqtgraph中的极坐标系 - Polar coordinate system in pyqtgraph
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM