linear algebra refresher

This commit is contained in:
Chad Brokaw 2023-02-22 23:18:51 -05:00
parent 3c15bff867
commit 1f938e5f49
2 changed files with 2 additions and 2 deletions

View file

@ -155,7 +155,7 @@ fn main(
inv_det * (matrx.z * translate.y - matrx.w * translate.x), inv_det * (matrx.z * translate.y - matrx.w * translate.x),
inv_det * (matrx.y * translate.x - matrx.x * translate.y), inv_det * (matrx.y * translate.x - matrx.x * translate.y),
); );
inv_tr += p0; inv_tr -= p0;
let center1 = p1 - p0; let center1 = p1 - p0;
let rr = r1 / (r1 - r0); let rr = r1 / (r1 - r0);
let ra_inv = rr / (r1 * r1 - dot(center1, center1)); let ra_inv = rr / (r1 * r1 - dot(center1, center1));

View file

@ -251,7 +251,7 @@ fn main(
for (var i = 0u; i < PIXELS_PER_THREAD; i += 1u) { for (var i = 0u; i < PIXELS_PER_THREAD; i += 1u) {
let my_xy = vec2(xy.x + f32(i), xy.y); let my_xy = vec2(xy.x + f32(i), xy.y);
// TODO: can hoist y, but for now stick to the GLSL version // 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 ba = dot(xy_xformed, rad.c1);
let ca = rad.ra * dot(xy_xformed, xy_xformed); let ca = rad.ra * dot(xy_xformed, xy_xformed);
let t = sqrt(ba * ba + ca) - ba - rad.roff; let t = sqrt(ba * ba + ca) - ba - rad.roff;