From 4d3648b160efbd59bd270b4e4813501c8453c44a Mon Sep 17 00:00:00 2001 From: yum Date: Sun, 2 Nov 2025 16:09:15 -0800 Subject: balls --- vertex_deformation.slang | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'vertex_deformation.slang') diff --git a/vertex_deformation.slang b/vertex_deformation.slang index 1af5ec9..36d09fb 100644 --- a/vertex_deformation.slang +++ b/vertex_deformation.slang @@ -93,11 +93,11 @@ public float3 plane_to_tube(float3 xyz, no_diff float t) { float z0 = xyz.z; float theta = x0 * PI; - float radius = ((1.0f - z0) / (dabs(t) + 1e-4f)) * sign(t); + float phi = z0 * PI; + float radius = 1.0f / (dabs(t) + 1e-4f) * sign(t); - float x = sin(theta / radius) * radius * PI_RCP; - // The z0 term here is required to make the jacobian invertible. - float z = z0 + (1.0f - cos(theta / radius)) * radius * PI_RCP; + float x = sin(theta / radius) * (radius * PI_RCP - z0); + float z = (1.0f - cos(theta / radius)) * (radius * PI_RCP) + cos(theta / radius) * z0; return float3(x, y0, z); } -- cgit v1.2.3