当前位置: 首页>>代码示例>>C++>>正文


C++ Mat4x4::AtCoordinate方法代码示例

本文整理汇总了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;
}
开发者ID:jTitor,项目名称:cmscParallelProcessing,代码行数:35,代码来源:Mat4x4.cpp

示例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;
}
开发者ID:jTitor,项目名称:cmscParallelProcessing,代码行数:12,代码来源:Mat4x4.cpp


注:本文中的Mat4x4::AtCoordinate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。