@@ 157-168 (lines=12) @@ | ||
154 | } |
|
155 | return pts; |
|
156 | } |
|
157 | function Cylinder(n,o,xr,yr,zr,magic) { |
|
158 | var phi, pts = [], off = 2/n, inc, i, j, k, l; |
|
159 | inc = Math.PI * (3 - sqrt(5) + (parseFloat(magic) ? parseFloat(magic) : 0)); |
|
160 | for(i = 0; i < n; ++i) { |
|
161 | j = i * off - 1 + (off / 2); |
|
162 | phi = i * inc; |
|
163 | k = cos(phi); |
|
164 | l = sin(phi); |
|
165 | pts.push(o ? [j * xr, k * yr, l * zr] : [k * xr, j * yr, l * zr]); |
|
166 | } |
|
167 | return pts; |
|
168 | } |
|
169 | function Ring(o, n, xr, yr, zr, j) { |
|
170 | var phi, pts = [], inc = Math.PI * 2 / n, i, k, l; |
|
171 | for(i = 0; i < n; ++i) { |
|
@@ 146-156 (lines=11) @@ | ||
143 | a.z = x * this[1][3] + y * this[2][3] + z * this[3][3]; |
|
144 | return a; |
|
145 | }; |
|
146 | function PointsOnSphere(n,xr,yr,zr,magic) { |
|
147 | var i, y, r, phi, pts = [], off = 2/n, inc; |
|
148 | inc = Math.PI * (3 - sqrt(5) + (parseFloat(magic) ? parseFloat(magic) : 0)); |
|
149 | for(i = 0; i < n; ++i) { |
|
150 | y = i * off - 1 + (off / 2); |
|
151 | r = sqrt(1 - y*y); |
|
152 | phi = i * inc; |
|
153 | pts.push([cos(phi) * r * xr, y * yr, sin(phi) * r * zr]); |
|
154 | } |
|
155 | return pts; |
|
156 | } |
|
157 | function Cylinder(n,o,xr,yr,zr,magic) { |
|
158 | var phi, pts = [], off = 2/n, inc, i, j, k, l; |
|
159 | inc = Math.PI * (3 - sqrt(5) + (parseFloat(magic) ? parseFloat(magic) : 0)); |