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


C++ Grid3D::getBoundingBox方法代码示例

本文整理汇总了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)));
        }
      }
    }
  }
}
开发者ID:KirillLykov,项目名称:levelset-light,代码行数:50,代码来源:test_VTK.cpp


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