From 1f938e5f498f538c493d8fa6e42ee7d81f5d2eb5 Mon Sep 17 00:00:00 2001 From: Chad Brokaw Date: Wed, 22 Feb 2023 23:18:51 -0500 Subject: [PATCH] linear algebra refresher --- shader/draw_leaf.wgsl | 2 +- shader/fine.wgsl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shader/draw_leaf.wgsl b/shader/draw_leaf.wgsl index 1d3e626..be036ab 100644 --- a/shader/draw_leaf.wgsl +++ b/shader/draw_leaf.wgsl @@ -155,7 +155,7 @@ fn main( inv_det * (matrx.z * translate.y - matrx.w * translate.x), inv_det * (matrx.y * translate.x - matrx.x * translate.y), ); - inv_tr += p0; + inv_tr -= p0; let center1 = p1 - p0; let rr = r1 / (r1 - r0); let ra_inv = rr / (r1 * r1 - dot(center1, center1)); diff --git a/shader/fine.wgsl b/shader/fine.wgsl index 5e7a772..e0d885b 100644 --- a/shader/fine.wgsl +++ b/shader/fine.wgsl @@ -251,7 +251,7 @@ fn main( for (var i = 0u; i < PIXELS_PER_THREAD; i += 1u) { let my_xy = vec2(xy.x + f32(i), xy.y); // TODO: can hoist y, but for now stick to the GLSL version - let xy_xformed = rad.matrx.xy * my_xy.x + rad.matrx.zw * my_xy.y - rad.xlat; + let xy_xformed = rad.matrx.xy * my_xy.x + rad.matrx.zw * my_xy.y + rad.xlat; let ba = dot(xy_xformed, rad.c1); let ca = rad.ra * dot(xy_xformed, xy_xformed); let t = sqrt(ba * ba + ca) - ba - rad.roff;