From 5dcf714cd187f21c2e32e709cbe5507ea4fd10c4 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Mon, 16 Oct 2023 19:20:30 +0200 Subject: [PATCH] Partially slice 3D rendered donut along its polodial direction --- donut.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/donut.lua b/donut.lua index 96afe0b2c..8567f8aed 100644 --- a/donut.lua +++ b/donut.lua @@ -55,7 +55,13 @@ function render_frame(A, B) 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)