Fix the coordinate system

This commit is contained in:
numzero 2024-04-20 18:46:49 +03:00
parent 78689ba8c2
commit e3c99349a5

View File

@ -98,13 +98,13 @@ fn main() -> io::Result<()> {
-roll.sin(), roll.cos(), 0.0,
0.0, 0.0, 1.0);
let m_yaw = mat3(
yaw.cos(), 0.0, yaw.sin(),
-yaw.cos(), 0.0, yaw.sin(),
0.0, 1.0, 0.0,
-yaw.sin(), 0.0, yaw.cos());
-yaw.sin(), 0.0, -yaw.cos());
let m_pitch = mat3(
1.0, 0.0, 0.0,
0.0, pitch.cos(), -pitch.sin(),
0.0, pitch.sin(), pitch.cos());
0.0, pitch.cos(), pitch.sin(),
0.0, -pitch.sin(), pitch.cos());
let m_view = m_roll * m_pitch * m_yaw;
let m_camera = transpose(&m_view);
let img_size = vec2(W as f32, H as f32);
@ -144,4 +144,5 @@ fn main() -> io::Result<()> {
fn edge_dist(a: Vec3, b: Vec3, base: Vec3, dir: Vec3) -> f32 {
Mat3 { c0: b - a, c1: base - a, c2: dir }.determinant()
Mat3 { c0: b - a, c1: base - a, c2: -dir }.determinant()
}