本文整理汇总了C++中Grid3D::getBoundingBox方法的典型用法代码示例。如果您正苦于以下问题:C++ Grid3D::getBoundingBox方法的具体用法?C++ Grid3D::getBoundingBox怎么用?C++ Grid3D::getBoundingBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Grid3D
的用法示例。
在下文中一共展示了Grid3D::getBoundingBox方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: close_at_tol
/*
typedef GridSerializerVTK< ls::Grid3D<double>, StructuredPointsTraits > BasicSerializerVTK_SPoint;
// The list of types we want to test.
typedef testing::Types<BasicSerializerVTK, BasicSerializerVTK_SPoint> Implementations;
TYPED_TEST_CASE(VTKTest, BasicSerializerVTK);
*/
TEST(VTKTest, writeAndRead3)
{
Close_relative close_at_tol(10e-8); // for whatever reason vtk writes with error
size_t n = 12, m = 11, w = 14;
Grid3D<double> grid(n, m, w);
double top[] = {4.0, 5.0, 9.0};
double low[] = {-3.0, -4.0, -5.0};
Box3D box(low, top);
double h[] = {box.getSizeX() / (n - 1.0), box.getSizeY() / (m - 1.0), box.getSizeZ() / (w - 1.0)};
for (size_t i = 0; i < n; ++i) {
for (size_t j = 0; j < m; ++j) {
for (size_t k = 0; k < w; ++k) {
MathVector3D p(i * h[0], j * h[1], k * h[2]);
p += box.getLow();
assert(box.inside(p));
grid(i, j, k) = testFunction2(p);
}
}
}
grid.setBoundingBox(box);
BasicSerializerVTK writer(grid, "test-aux/writeAndRead3");
writer.run();
Grid3D<double> readGrid; // at this point I don't know the size
BasicDeserializerVTK reader(readGrid, "test-aux/writeAndRead3");
reader.run();
EXPECT_EQ(grid.getBoundingBox(), readGrid.getBoundingBox());
for (size_t i = 0; i < n; ++i) {
for (size_t j = 0; j < m; ++j) {
for (size_t k = 0; k < w; ++k) {
if (grid(i, j, k) != readGrid(i, j, k)) {
EXPECT_TRUE(close_at_tol(grid(i, j, k), readGrid(i, j, k)));
}
}
}
}
}