首页 > 代码库 > 数学图形之超球

数学图形之超球

超球,自然界有很多果实属于超球的形状.之前曾经写过关于超圆的文章:数学图形(1.44)超圆, 这篇文章将对其扩展一下,由超圆的二维曲线转化为超球三维曲面.

超圆就是方程式:x^a+y^b= c          生成的图形.当a==b==2时,为一个圆.

超椭圆是方程式:m*x^a+n*y^b= c 生成的图形.当a==b==2时,为一个椭圆.

那么超球则是如下定义:

超球的方程式:x^a+y^b+z^c= d  

超椭球的方程式:m*x^a+n*y^b+k*z^c= d

我使用自己定义语法的脚本代码生成超球图形.相关软件参见:数学图形可视化工具,该软件免费开源.QQ交流群: 367752815

(1)将超圆沿X轴或Y轴旋转生成的图形也是超球的一种

vertices = D1:100 D2:100u = from (-PI/2) to (PI/2)  D1v = from 0 to (2*PI) D2a = rand2(0.1, 4)b = rand2(0.1, 4)r = 10.0x = r*pow_sign(sin(u), a)n = r*pow_sign(cos(u), b)y = n*cos(v)z = n*sin(v)
vertices = D1:100 D2:100u = from 0 to (PI) D1v = from 0 to (2*PI) D2a = rand2(0.1, 4)b = rand2(0.1, 4)r = 10.0n = r*pow_sign(sin(u), a)y = r*pow_sign(cos(u), b)x = n*cos(v)z = n*sin(v)

(2)超球面(瘦)

vertices = D1:100 D2:100u = from 0 to (2*PI) D1v = from (-PI*0.5) to (PI*0.5) D2a = 10m = rand2(1, 5)x = a*pow_sign(cos(u)*cos(v), m)y = a*pow_sign(sin(v), m)z = a*pow_sign(sin(u)*cos(v), m)

(3)超球面(胖)

vertices = D1:100 D2:100u = from 0 to (2*PI) D1v = from (-PI*0.5) to (PI*0.5) D2a = 10m = rand2(0.1, 1)x = a*pow_sign(cos(u)*cos(v), m)y = a*pow_sign(sin(v), m)z = a*pow_sign(sin(u)*cos(v), m)

(4)超球面(双参)

vertices = D1:100 D2:100u = from 0 to (2*PI) D1v = from (-PI*0.5) to (PI*0.5) D2a = 10m = rand2(0.2, 5)n = rand2(0.2, 5)x = a*pow_sign(cos(u)*cos(v), m)y = a*pow_sign(sin(v), n)z = a*pow_sign(sin(u)*cos(v), m)

(5)超球面(三参)

vertices = D1:100 D2:100u = from 0 to (2*PI) D1v = from (-PI*0.5) to (PI*0.5) D2r = 10a = rand2(0.2, 5)b = rand2(0.2, 5)c = rand2(0.2, 5)x = r*pow_sign(cos(u)*cos(v), a)y = r*pow_sign(sin(v), b)z = r*pow_sign(sin(u)*cos(v), c)

(6)超椭球面

vertices = D1:100 D2:100u = from (-PI*0.5) to (PI*0.5) D1v = from (-PI) to (PI) D2a = rand2(1, 5)b = rand2(1, 5)c = rand2(1, 5)m = 5n = 3x = a*(cos(u)^m)*(cos(v)^n)z = b*(cos(u)^m)*(sin(v)^n)y = c*(sin(u)^m)

vertices = D1:100 D2:100u = from (-PI*0.5) to (PI*0.5) D1v = from (-PI) to (PI) D2a = rand2(1, 5)b = rand2(1, 5)c = rand2(1, 5)m = 0.6n = 0.3x = a*(pow_sign(cos(u), m))*(pow_sign(cos(v),n))z = b*(pow_sign(cos(u),m))*(pow_sign(sin(v),n))y = c*(pow_sign(sin(u),m))