本文整理汇总了C++中Mat4x4::AtCoordinate方法的典型用法代码示例。如果您正苦于以下问题:C++ Mat4x4::AtCoordinate方法的具体用法?C++ Mat4x4::AtCoordinate怎么用?C++ Mat4x4::AtCoordinate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mat4x4
的用法示例。
在下文中一共展示了Mat4x4::AtCoordinate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetSubmatrix
/**
Gets a 3x3 matrix consisting of all cells besides those along the given row or column.
*/
Mat3x3 GetSubmatrix(const Mat4x4& m, int row, int col)
{
int nextRow = 0;
int nextColumn = 0;
Mat3x3 result = Mat3x3::Zero();
//we will loop through each element of our 4x4;
//if the current element is valid (neither on the same row as [row] or column as [col])
//then set Mat3x3(nextRow, nextColumn) and increment nextColumn
//then increment nextRow
//the last step might not be necessary
for (int i = 0; i < MAT4X4_NUM_CELLS; i++)
{
//if this row is valid...
if (i != row)
{
//reset nextColumn
nextColumn = 0;
for (int j = 0; j < MAT4X4_NUM_CELLS; j++)
{
if (j != col)
{
result(nextRow, nextColumn) = m.AtCoordinate(i, j);
nextColumn++;
}
}
//move nextRow down a row
nextRow++;
}
}
return result;
}
示例2:
Mat4x4 Mat4x4::GetTransposed(const Mat4x4& m)
{
Mat4x4 result = Mat4x4();
for (int i = 0; i < MAT4X4_NUM_CELLS; ++i)
{
int x = i % MAT4X4_WIDTH;
int y = i / MAT4X4_WIDTH;
result(y, x) = m.AtCoordinate(x, y);
}
return result;
}