本文整理汇总了C++中mat3::length方法的典型用法代码示例。如果您正苦于以下问题:C++ mat3::length方法的具体用法?C++ mat3::length怎么用?C++ mat3::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mat3
的用法示例。
在下文中一共展示了mat3::length方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_transpose
int test_transpose()
{
int Error(0);
{
mat2 const m(0, 1, 2, 3);
mat2 const t = transpose(m);
mat2 const expected = mat2(0, 2, 1, 3);
for (length_t l = 0; l < expected.length(); ++l)
Error += all(epsilonEqual(t[l], expected[l], epsilon<float>())) ? 0 : 1;
}
{
mat2x3 m(0, 1, 2, 3, 4, 5);
mat3x2 t = transpose(m);
mat3x2 const expected = mat3x2(0, 3, 1, 4, 2, 5);
for (length_t l = 0; l < expected.length(); ++l)
Error += all(epsilonEqual(t[l], expected[l], epsilon<float>())) ? 0 : 1;
}
{
mat2x4 m(0, 1, 2, 3, 4, 5, 6, 7);
mat4x2 t = transpose(m);
mat4x2 const expected = mat4x2(0, 4, 1, 5, 2, 6, 3, 7);
for (length_t l = 0; l < expected.length(); ++l)
Error += all(epsilonEqual(t[l], expected[l], epsilon<float>())) ? 0 : 1;
}
{
mat3 m(0, 1, 2, 3, 4, 5, 6, 7, 8);
mat3 t = transpose(m);
mat3 const expected = mat3(0, 3, 6, 1, 4, 7, 2, 5, 8);
for (length_t l = 0; l < expected.length(); ++l)
Error += all(epsilonEqual(t[l], expected[l], epsilon<float>())) ? 0 : 1;
}
{
mat3x2 m(0, 1, 2, 3, 4, 5);
mat2x3 t = transpose(m);
mat2x3 const expected = mat2x3(0, 2, 4, 1, 3, 5);
for (length_t l = 0; l < expected.length(); ++l)
Error += all(epsilonEqual(t[l], expected[l], epsilon<float>())) ? 0 : 1;
}
{
mat3x4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
mat4x3 t = transpose(m);
mat4x3 const expected = mat4x3(0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11);
for (length_t l = 0; l < expected.length(); ++l)
Error += all(epsilonEqual(t[l], expected[l], epsilon<float>())) ? 0 : 1;
}
{
mat4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
mat4 t = transpose(m);
mat4 const expected = mat4(0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15);
for (length_t l = 0; l < expected.length(); ++l)
Error += all(epsilonEqual(t[l], expected[l], epsilon<float>())) ? 0 : 1;
}
{
mat4x2 m(0, 1, 2, 3, 4, 5, 6, 7);
mat2x4 t = transpose(m);
mat2x4 const expected = mat2x4(0, 2, 4, 6, 1, 3, 5, 7);
for (length_t l = 0; l < expected.length(); ++l)
Error += all(epsilonEqual(t[l], expected[l], epsilon<float>())) ? 0 : 1;
}
{
mat4x3 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
mat3x4 t = transpose(m);
mat3x4 const expected = mat3x4(0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11);
for (length_t l = 0; l < expected.length(); ++l)
Error += all(epsilonEqual(t[l], expected[l], epsilon<float>())) ? 0 : 1;
}
return Error;
}