本文整理汇总了C++中HeightMap::columnDirection方法的典型用法代码示例。如果您正苦于以下问题:C++ HeightMap::columnDirection方法的具体用法?C++ HeightMap::columnDirection怎么用?C++ HeightMap::columnDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HeightMap
的用法示例。
在下文中一共展示了HeightMap::columnDirection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: matrixImgToGrid
void VoxelGrid::
paintHeightMap(const GridDescription & gridDesc,
const HeightMap & instruction)
{
Rect3i yeeRect = instruction.yeeRect();
Vector3i u1 = instruction.rowDirection();
Vector3i u2 = -instruction.columnDirection();
Vector3i u3 = instruction.upDirection();
int nUp = abs(dot(u3, yeeRect.p2-yeeRect.p1)) + 1;
Mat3i matrixImgToGrid(Mat3i::withColumns(u1,u2,u3));
// this will select the correct corner of the fill rect regardless of the
// direction of the image unit vectors. This point corresponds to the
// origin of the image (top-left pixel of the .bmp or .*).
Vector3i fillOrigin = clip(yeeRect,
Vector3i(-100000*u1 + -100000*u2 + -100000*u3) );
// now the image!
Magick::Image heightMap;
try {
heightMap.read(instruction.imageFileName());
FillStyle style = instruction.fillStyle();
Paint* paint = Paint::paint(instruction.material());
// iterate over rows and columns of the image; extrude into grid
for (unsigned int row = 0; row < heightMap.rows(); row++)
for (unsigned int col = 0; col < heightMap.columns(); col++)
{
Magick::ColorGray color = heightMap.pixelColor(col, row);
int height = int(double(nUp)*color.shade());
Vector3i p = fillOrigin + matrixImgToGrid*Vector3i(col, row, 0);
for (int up = 0; up < height; up++)
{
Vector3i pGrid = p + u3*up;
if (style == kPECStyle)
paintPEC(paint, pGrid[0], pGrid[1], pGrid[2]);
else if (style == kPMCStyle)
paintPMC(paint, pGrid[0], pGrid[1], pGrid[2]);
else
paintYeeCell(paint, pGrid[0], pGrid[1], pGrid[2]);
}
}
} catch (Magick::Exception & magExc) {
cerr << "Error reading HeightMap. Maybe a file type issue?\n";
cerr << "Caught ImageMagick exception " << magExc.what() << endl;
LOG << "Exception logged. Exiting.\n";
exit(1);
}
}