數學圖形之球面,橢球面,膠囊體,刺球.

來源:互聯網
上載者:User

標籤:blog   http   os   io   2014   div   html   log   

球與圓很相關,一個是三維,一個是二維,可以參考下:圓,橢圓

 

(1)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)

 

球的網格線:


(2)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)

兩種寫法產生的圖形是一樣的

 


(3)彩色球

在指令碼中給rgb變數設值,就能設定頂點色.

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)圓弧面

將球的第二維度範圍減小,即得到圓弧面

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)橢球面

#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)膠囊體

將球面向上下兩頭展開,即得到膠囊體

 

(7)刺球

將球面上頂點到球心的距離,有規律地變化,可以得到多變的球,如刺球

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)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.