Skip to content

Commit f03f41c

Browse files
zachelnetDeepSeek V4
andcommitted
docs(renderer): fix misleading inverse-rotation comment
The comment claimed to show the inverse matrix but actually showed the forward R(θ) matrix. Correct it to show both forward and inverse forms, matching the code below. Co-authored-by: DeepSeek V4 <deepseek@v4.ai>
1 parent d9b8a21 commit f03f41c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

crates/koharu-app/src/renderer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,9 +1079,9 @@ fn rotate_sprite_expand_top_left(src: &RgbaImage, angle_rad: f32) -> (RgbaImage,
10791079
for x in 0..dst_w {
10801080
let world_x = x as f32 + min_x;
10811081
let world_y = y as f32 + min_y;
1082-
// Inverse of CSS-like rotate(theta):
1083-
// x' = cos*x - sin*y
1084-
// y' = sin*x + cos*y
1082+
// Inverse rotation R(-θ): map destination pixel back to source.
1083+
// Forward R(θ): x' = cos·x - sin·y, y' = sin·x + cos·y
1084+
// Inverse R(-θ): x = cos·x' + sin·y', y = -sin·x' + cos·y'
10851085
let src_x = cos * world_x + sin * world_y;
10861086
let src_y = -sin * world_x + cos * world_y;
10871087
dst.put_pixel(x, y, sample_bilinear_rgba(src, src_x, src_y));

0 commit comments

Comments
 (0)