Skip to content

Commit

Permalink
test vec4::rotate(vec2, vec)
Browse files Browse the repository at this point in the history
  • Loading branch information
no-lex committed Nov 17, 2024
1 parent b0827ac commit 78ee3ed
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/testmatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,34 @@ namespace
assert(m.c.sub(vec4<float>(0,0,1,0)).magnitude() < tolerance);
assert(m.d.sub(vec4<float>(0,0,0,1)).magnitude() < tolerance);
}
//rotate(vec2, vec)
{
matrix4 m;
m.identity();
m.rotate(vec2(-1, 0), vec(1,0,0));
assert(m.a.sub(vec4<float>(1,0,0,0)).magnitude() < tolerance);
assert(m.b.sub(vec4<float>(0,-1,0,0)).magnitude() < tolerance);
assert(m.c.sub(vec4<float>(0,0,-1,0)).magnitude() < tolerance);
assert(m.d.sub(vec4<float>(0,0,0,1)).magnitude() < tolerance);
}
{
matrix4 m;
m.identity();
m.rotate(vec2(-1, 0), vec(0,1,0));
assert(m.a.sub(vec4<float>(-1,0,0,0)).magnitude() < tolerance);
assert(m.b.sub(vec4<float>(0,1,0,0)).magnitude() < tolerance);
assert(m.c.sub(vec4<float>(0,0,-1,0)).magnitude() < tolerance);
assert(m.d.sub(vec4<float>(0,0,0,1)).magnitude() < tolerance);
}
{
matrix4 m;
m.identity();
m.rotate(vec2(-1, 0), vec(0,0,1));
assert(m.a.sub(vec4<float>(-1,0,0,0)).magnitude() < tolerance);
assert(m.b.sub(vec4<float>(0,-1,0,0)).magnitude() < tolerance);
assert(m.c.sub(vec4<float>(0,0,1,0)).magnitude() < tolerance);
assert(m.d.sub(vec4<float>(0,0,0,1)).magnitude() < tolerance);
}
}

void test_matrix4_rotate_around_x()
Expand Down

0 comments on commit 78ee3ed

Please sign in to comment.