本文整理汇总了C++中Voxel::Copy方法的典型用法代码示例。如果您正苦于以下问题:C++ Voxel::Copy方法的具体用法?C++ Voxel::Copy怎么用?C++ Voxel::Copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Voxel
的用法示例。
在下文中一共展示了Voxel::Copy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RotateXCCW
void Piece::RotateXCCW() {
isMoved = true;
unsigned int n = size;
unsigned int colLimit = floor((float) n / 2.0);
unsigned int rowLimit = ceil((float) n / 2.0);
for (unsigned int c = 0; c < n; c++) {
for (unsigned int d = 0; d < colLimit; d++) {
for (unsigned int r = 0; r < rowLimit; r++) {
Voxel* temp = container[c][r][d];
if (temp != 0) {
temp = temp->Copy();
}
//SwapVoxels(c, r, d, container[n - 1 - r][c][d]);
SwapVoxels(c, r, d, container[c][d][n - 1 - r]);
//SwapVoxels(n - 1 - r, c, d, container[n - 1 - c][n - 1 - r][d]);
SwapVoxels(c, d, n - 1 - r, container[c][n - 1 - r][n - 1 - d]);
//SwapVoxels(n - 1 - c, n - 1 - r, d, container[r][n - 1 - c][d]);
SwapVoxels(c, n - 1 - r, n - 1 - d, container[c][n - 1 - d][r]);
//SwapVoxels(r, n - 1 - c, d, temp);
SwapVoxels(c, n - 1 - d, r, temp);
}
}
}
}
示例2: RotateZCCW
void Piece::RotateZCCW() {
isMoved = true;
unsigned int n = size;
unsigned int colLimit = floor((float) n / 2.0);
unsigned int rowLimit = ceil((float) n / 2.0);
// unsigned int topRow = GetTopRow();
// unsigned int leftCol = GetLeftCol();
// unsigned int topDep = GetTopDep();
for (unsigned int d = 0; d < size; d++) {
for (unsigned int c = 0; c < colLimit; c++) {
for (unsigned int r = 0; r < rowLimit; r++) {
Voxel* temp = container[c][r][d];
if (temp != 0) {
temp = temp->Copy();
}
SwapVoxels(c, r, d, container[n - 1 - r][c][d]); // container[c][r][d] = container[n - 1 - r][c][d];
SwapVoxels(n - 1 - r, c, d, container[n - 1 - c][n - 1 - r][d]); //container[n - 1 - r][c][d] = container[n - 1 - c][n - 1 - r][d];
SwapVoxels(n - 1 - c, n - 1 - r, d, container[r][n - 1 - c][d]); // container[n - 1 - c][n - 1 - r][d] = container[r][n - 1 - c][d];
SwapVoxels(r, n - 1 - c, d, temp); //container[r][n - 1 - c][d] = temp;
}
}
}
}