Sphere of mathematical graphics, elliptical sphere, capsule body, and spam.

Source: Internet
Author: User

The ball is closely related to the circle. One is three-dimensional and the other is two-dimensional. For details, see circle and elliptical.

 

(1) method 1 of Sphere

vertices = D1:100 D2:100t = from 0 to (PI*2) D1r = from 0 to 1 D2x = 2*r*sin(t)*sqrt(1-r^2)y = 2*r*cos(t)*sqrt(1-r^2)z = 1-2*(r^2)

 

Gridlines of the ball:


(2) Two other ways of writing sphere

vertices = dimension1:36 dimension2:72u = from 0 to (2*PI) dimension1v = from (-PI*0.5) to (PI*0.5) dimension2r = 10.0x = r*cos(v)*sin(u)y = r*sin(v)z = r*cos(v)*cos(u)
vertices = dimension1:36 dimension2:72u = from 0 to (2*PI) dimension1v = from 0 to (PI) dimension2r = 10.0x = r*sin(v)*sin(u)y = r*cos(v)z = r*sin(v)*cos(u)

The two statements generate the same image.

 


(3) colored balls

You can set the vertex color by setting values for the RGB variable in the script.

vertices = dimension1:72 dimension2:72u = from 0 to (2*PI) dimension1v = from (-PI*0.5) to (PI*0.5) dimension2x = cos(v)*sin(u)y = sin(v)z = cos(v)*cos(u)a = 10.0r = (x+1.0)/2g = (y+1.0)/2b = (z+1.0)/2x = a*xy = a*yz = a*z


(4) Arc Surface

Reduce the range of the second dimension of the ball to obtain the Arc Surface.

vertices = dimension1:36 dimension2:72u = from 0 to (2*PI) dimension1v = from (PI*0.1) to (PI*0.5) dimension2r = 10.0x = r*cos(v)*sin(u)y = r*sin(v)z = r*cos(v)*cos(u)

 

(5) elliptical sphere

#http://www.mathcurve.com/surfaces/ellipsoid/ellipsoid.shtmlvertices = D1:100 D2:100u = from 0 to (2*PI) D1v = from (-PI*0.5) to (PI*0.5) D2a = rand2(1, 10)b = rand2(1, 10)c = rand2(1, 10)x = a*cos(v)*sin(u)y = b*sin(v)z = c*cos(v)*cos(u)

 

(6) Capsules

Stretch the sphere up and down to get the capsule body.

 

(7) spam

The distance from the vertices on the sphere to the ball center can be changed regularly to get a changeable ball, such as a prickly ball.

vertices = dimension1:129 dimension2:65u = from 0 to (2*PI) dimension1v = from (-PI*0.5) to (PI*0.5) dimension2n =4a = from 0 to 128 D1b = from 0 to 64 D2t = (mod(a, n) + mod(b, n))/n*4r = 10.0 + tx = r*cos(v)*sin(u)y = r*sin(v)z = r*cos(v)*cos(u)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.