Compare commits
3 Commits
4d57ba62bf
...
5dcf714cd1
Author | SHA1 | Date |
---|---|---|
Nils Dagsson Moskopp | 5dcf714cd1 | |
Nils Dagsson Moskopp | 0c6d9a4d85 | |
Nils Dagsson Moskopp | ef65de54c0 |
18
donut.lua
18
donut.lua
|
@ -6,7 +6,7 @@
|
|||
|
||||
-- cargo-culted by erle 2023-09-18
|
||||
|
||||
local theta_spacing = 0.1 -- 0.07
|
||||
local theta_spacing = 0.01 -- 0.07
|
||||
local phi_spacing = 0.002 -- 0.02
|
||||
|
||||
local R1 = 1
|
||||
|
@ -43,13 +43,25 @@ function render_frame(A, B)
|
|||
local sinB = math.sin(B)
|
||||
|
||||
-- theta goas around the cross-sectional circle of a torus
|
||||
for theta=0, 2*math.pi, theta_spacing do
|
||||
local theta = 0
|
||||
while theta <= 2*math.pi do
|
||||
if ( theta < 2*math.pi * 1/8 ) or ( theta > 2*math.pi * 7/8 ) then
|
||||
theta = theta + (theta_spacing * 16)
|
||||
else
|
||||
theta = theta + theta_spacing
|
||||
end
|
||||
-- precompute sines and cosines of theta
|
||||
local costheta = math.cos(theta)
|
||||
local sintheta = math.sin(theta)
|
||||
|
||||
-- phi goes around the center of revolution of a torus
|
||||
for phi=0, 2*math.pi, phi_spacing do
|
||||
local phi = 0
|
||||
while phi <= 2*math.pi do
|
||||
if ( phi > 2*math.pi * 3/8 ) and ( phi < 2*math.pi * 5/8 ) then
|
||||
phi = phi + (phi_spacing * 128)
|
||||
else
|
||||
phi = phi + phi_spacing
|
||||
end
|
||||
-- precompute sines and cosines of phi
|
||||
local cosphi = math.cos(phi)
|
||||
local sinphi = math.sin(phi)
|
||||
|
|
Loading…
Reference in New Issue