summaryrefslogtreecommitdiffstats
path: root/vertex_deformation.slang
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2025-11-02 16:09:15 -0800
committeryum <yum.food.vr@gmail.com>2025-11-02 16:09:15 -0800
commit4d3648b160efbd59bd270b4e4813501c8453c44a (patch)
tree064d0fe6a2e32a0bedba4715c0e2f5b26f9e0e71 /vertex_deformation.slang
parent7fd93cd70100e0636ffae430a7ab1904788fb5f3 (diff)
balls
Diffstat (limited to 'vertex_deformation.slang')
-rw-r--r--vertex_deformation.slang8
1 files changed, 4 insertions, 4 deletions
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);
}