1. <legend id='gukbE'><style id='gukbE'><dir id='gukbE'><q id='gukbE'></q></dir></style></legend>

      <small id='gukbE'></small><noframes id='gukbE'>

    2. <i id='gukbE'><tr id='gukbE'><dt id='gukbE'><q id='gukbE'><span id='gukbE'><b id='gukbE'><form id='gukbE'><ins id='gukbE'></ins><ul id='gukbE'></ul><sub id='gukbE'></sub></form><legend id='gukbE'></legend><bdo id='gukbE'><pre id='gukbE'><center id='gukbE'></center></pre></bdo></b><th id='gukbE'></th></span></q></dt></tr></i><div id='gukbE'><tfoot id='gukbE'></tfoot><dl id='gukbE'><fieldset id='gukbE'></fieldset></dl></div>
      <tfoot id='gukbE'></tfoot>
          <bdo id='gukbE'></bdo><ul id='gukbE'></ul>

        python中圆形中均匀间隔点的生成器

        时间:2023-09-12
          <i id='c52Pc'><tr id='c52Pc'><dt id='c52Pc'><q id='c52Pc'><span id='c52Pc'><b id='c52Pc'><form id='c52Pc'><ins id='c52Pc'></ins><ul id='c52Pc'></ul><sub id='c52Pc'></sub></form><legend id='c52Pc'></legend><bdo id='c52Pc'><pre id='c52Pc'><center id='c52Pc'></center></pre></bdo></b><th id='c52Pc'></th></span></q></dt></tr></i><div id='c52Pc'><tfoot id='c52Pc'></tfoot><dl id='c52Pc'><fieldset id='c52Pc'></fieldset></dl></div>
          <legend id='c52Pc'><style id='c52Pc'><dir id='c52Pc'><q id='c52Pc'></q></dir></style></legend>
        1. <tfoot id='c52Pc'></tfoot>
              <bdo id='c52Pc'></bdo><ul id='c52Pc'></ul>

                  <tbody id='c52Pc'></tbody>

                <small id='c52Pc'></small><noframes id='c52Pc'>

                1. 本文介绍了python中圆形中均匀间隔点的生成器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我的任务是在不可见圆的同心环上生成均匀(或多或少)间隔的点.该函数应采用半径列表和为给定半径绘制的点数作为参数.例如,半径为 0 它应该在 (0,0) 处绘制 1 个点.对于半径为 1 的圆,它应该沿着圆的圆周绘制 10 个点,以 2pi/10 的角度间隔开.对于半径为 2 的圆,沿圆周有 20 个点,以 2pi/20 的角度间隔开.

                  I am tasked with generating evenly (more or less) spaced points on concentric rings of an invisible circle. The function should take a list of radii, and number of points to plot for a given radius as arguments. For example for a radius of 0 it should plot 1 point at (0,0). For a circle of radius of 1, it should plot 10 points along the circumference of the circle, spaced out by an angle of 2pi/10. For a circle of radius 2, 20 points along the circumference, spaced out by an angle of 2pi/20.

                  生成器应采用以下参数:

                  The generator should take the following parameters:

                  n, r_max, m

                  n, r_max, m

                  并且应该在半径处生成坐标对环

                  and should generate rings of coordinate pairs at radii

                  r_i = i*r_max/n 对于 i = 0,1,..,n.

                  r_i = i*r_max/n for i = 0,1,..,n.

                  每个环应该有 n*i 个点均匀分布在 θ 中,其中n_i=1 代表 i=0;n_i = mi for i>0

                  Each ring should have n*i points uniformly distributed in θ where n_i=1 for i=0; n_i = mi for i>0

                  当函数被这样调用时:

                  for r, t in genpolar.rtuniform(n=10, rmax=0.1, m=6):
                        plot(r * cos(t), r * sin(t), 'bo')
                  

                  它应该返回如下图:

                  这是我目前的想法:

                  def rtpairs(R, N):
                          R=[0.0,0.1,0.2]
                          N=[1,10,20]
                          r=[]
                          t=[]
                          for i in N:
                                  theta=2*np.pi/i
                              t.append(theta)
                  
                          for j in R:
                              j=j
                              r.append(j)
                  
                      plt.plot(r*np.cos(t),r*np.sin(t), 'bo')
                      plt.show()
                  

                  但我很确定使用两个 for 循环有一种更有效的方法.

                  but I'm pretty sure there is a more efficient method using two for loops.

                  非常感谢

                  推荐答案

                  我想通了.代码如下:

                  import numpy as np
                  import matplotlib.pyplot as plt
                  
                  T = [1, 10, 20, 30, 40, 50, 60]
                  R = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6]
                  
                  
                  
                  def rtpairs(r, n):
                  
                      for i in range(len(r)):
                         for j in range(n[i]):    
                          yield r[i], j*(2 * np.pi / n[i])
                  
                  for r, t in rtpairs(R, T):
                      plt.plot(r * np.cos(t), r * np.sin(t), 'bo')
                  plt.show()
                  

                  这篇关于python中圆形中均匀间隔点的生成器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何找到平面上点投影的坐标 下一篇:如何检查一个点是否低于一条线?

                  相关文章

                  最新文章

                  1. <i id='HzOJX'><tr id='HzOJX'><dt id='HzOJX'><q id='HzOJX'><span id='HzOJX'><b id='HzOJX'><form id='HzOJX'><ins id='HzOJX'></ins><ul id='HzOJX'></ul><sub id='HzOJX'></sub></form><legend id='HzOJX'></legend><bdo id='HzOJX'><pre id='HzOJX'><center id='HzOJX'></center></pre></bdo></b><th id='HzOJX'></th></span></q></dt></tr></i><div id='HzOJX'><tfoot id='HzOJX'></tfoot><dl id='HzOJX'><fieldset id='HzOJX'></fieldset></dl></div>
                  2. <small id='HzOJX'></small><noframes id='HzOJX'>

                      • <bdo id='HzOJX'></bdo><ul id='HzOJX'></ul>
                      <legend id='HzOJX'><style id='HzOJX'><dir id='HzOJX'><q id='HzOJX'></q></dir></style></legend>

                      <tfoot id='HzOJX'></tfoot>