【精选】在球面上生成均匀分布点方法总结 您所在的位置:网站首页 python产生20个随机坐标 【精选】在球面上生成均匀分布点方法总结

【精选】在球面上生成均匀分布点方法总结

2023-10-26 08:52| 来源: 网络整理| 查看: 265

目录

数学只存在5种正多边形

实际工作中在球面上均匀分布点的方法(推荐第6种方法)

1. 生成两个随机分布的角度,并且按照球坐标的形式产生。

3. 直接抽样法产生球面上均匀分布的点

4.力学方法产生。

5.归结为非线性规划问题

6.数学公式法(简单高效)

数学只存在5种正多边形

实际工作中在球面上均匀分布点的方法(推荐第6种方法) 1. 生成两个随机分布的角度,并且按照球坐标的形式产生。

参考资料:

https://www.cnblogs.com/cofludy/p/5894270.html

缺点: 产生的点是按照角度均匀分布的, 但是注意这并不是球面上均匀分布的点,后面可以看到两极的地方角度明显密集。并且,由于在计算过程中有大量的三角函数的计算,程序的效率不高。 

 要求不高时可以采用这种方法。

思路是,采用10807 方法产生一组两个随机数,分别作为角度使用。将产生的随机数输出到plt 文件中,使用tecplot绘图。(tecplot是非常好用的CFD后处理可视化的软件,强烈推荐使用)。关于10807 方法产生随机数,有空就另外再开一篇帖子。

下面附上 C++  代码:

#include #include #include using namespace std; class cRandom { public: cRandom(int x,double y):seed(x),random(y){}; cRandom():seed(0),random(0){}; int seed; double random; }; cRandom my_random(int z) // 16807 way to create random numbers // z is the seed number, num is the total random number to create { //z(n+1)=(a*z(n)+b) mod m //describe m=a*q+r to avoid that the number is large than the computer can bear const int m=pow(2,31)-1; const int a=16807; const int q=127773; const int r=2836; int temp=a*(z%q)-r*(z/q); if(temp


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有