Rotation remake

This commit is contained in:
Шишов Максим Денисович
2020-09-03 15:23:54 +03:00
parent 4d03ba1210
commit 9544d5ef0d
3 changed files with 36 additions and 30 deletions

View File

@@ -674,24 +674,6 @@ TEST(PIMathMatrixT_Test, transposed)
ASSERT_TRUE(b);
}
TEST(PIMathMatrixT_Test, rotation)
{
double angle = 1.0;
bool b;
PIMathMatrixT<2u, 2u, double> matrix = PIMathMatrixT<2u, 2u, double>::rotation(angle);
double c = cos(angle);
double s = sin(angle);
if((c == matrix.at(1u,1u)) && (c == matrix.at(0u,0u)) && (-s == matrix.at(0u,1u)) && (s == matrix.at(1u,0u)))
{
b = true;
}
else
{
b = false;
}
ASSERT_TRUE(b);
}
TEST(PIMathMatrixT_Test, scaleX_two)
{
double factor = 5.64;
@@ -726,6 +708,31 @@ TEST(PIMathMatrixT_Test, scaleY_two)
ASSERT_TRUE(b);
}
TEST(PIMathMatrixT_Test, rotation_2x2)
{
double angle = 1.0;
bool b;
PIMathMatrixT<2u, 2u, double> matrix = PIMathMatrixT<2u, 2u, double>::rotation(angle);
double c = cos(angle);
double s = sin(angle);
if((c == matrix.at(1u,1u)) && (c == matrix.at(0u,0u)) && (-s == matrix.at(0u,1u)) && (s == matrix.at(1u,0u)))
{
b = true;
}
else
{
b = false;
}
ASSERT_TRUE(b);
}
TEST(PIMathMatrixT_Test, rotation_3x3)
{
double angle = 1.0;
PIMathMatrixT<3u, 3u, double> matrix = PIMathMatrixT<3u, 3u, double>::rotation(angle);
ASSERT_TRUE(cmpMatrixWithValue(matrix, 0.0));
}
TEST(PIMathMatrixT_Test, rotationX)
{
double angle = 1.0;
@@ -831,3 +838,4 @@ TEST(PIMathMatrixT_Test, scaleZ_three)
ASSERT_TRUE(b);
}