From 55a9113a1b7bc23a810606c2ed03d56c55aca060 Mon Sep 17 00:00:00 2001 From: yum Date: Wed, 17 Dec 2025 18:55:15 -0800 Subject: implement t blending in axis/point alignment operators --- vertex_deformation.slang | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vertex_deformation.slang b/vertex_deformation.slang index 542281b..d3f46bc 100644 --- a/vertex_deformation.slang +++ b/vertex_deformation.slang @@ -158,6 +158,8 @@ public void plane_to_tube_undeform_normal(float3 xyz, inout float3 normal, [Differentiable] public float3 axis_align(float3 xyz, no_diff float3 po, no_diff float3 pp, no_diff float3 r, no_diff float t) { + const float3 xyz0 = xyz; + // We assume that `s` is orthogonal to `r`, and that `r` is normalized. float3 s = normalize(pp - po); float3 sxr = cross(s, r); @@ -191,7 +193,7 @@ public float3 axis_align(float3 xyz, no_diff float3 po, no_diff float3 pp, no_di // Move back into cartesian space. xyz = mul(to_cart, xyz_rsrxs) + po; - return xyz; + return dlerp(xyz0, xyz, t); } public void axis_align_normal(inout float3 xyz, inout float3 normal, @@ -277,6 +279,8 @@ public void tube_to_plane_undeform_normal( [Differentiable] public float3 point_align(float3 xyz, no_diff float3 po, no_diff float3 pp, no_diff float3 r, no_diff float t) { + const float3 xyz0 = xyz; + // We assume that `s` is orthogonal to `r`, and that `r` is normalized. float3 s = normalize(pp - po); float3 sxr = cross(s, r); @@ -304,7 +308,7 @@ public float3 point_align(float3 xyz, no_diff float3 po, no_diff float3 pp, no_d // Move back into cartesian space. xyz = mul(to_cart, xyz_rsrxs) + po; - return xyz; + return dlerp(xyz0, xyz, t); } public void point_align_normal(inout float3 xyz, inout float3 normal, inout float3 tangent, float3 po, float3 pp, float3 r, float t) { -- cgit v1.2.3