本文整理汇总了C++中TetrahedralMesh::Rotate方法的典型用法代码示例。如果您正苦于以下问题:C++ TetrahedralMesh::Rotate方法的具体用法?C++ TetrahedralMesh::Rotate怎么用?C++ TetrahedralMesh::Rotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TetrahedralMesh
的用法示例。
在下文中一共展示了TetrahedralMesh::Rotate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void Test2DMeshRotation()
{
TrianglesMeshReader<2,2> mesh_reader("mesh/test/data/2D_0_to_1mm_200_elements");
TetrahedralMesh<2,2> mesh;
mesh.ConstructFromMeshReader(mesh_reader);
double angle = M_PI;
mesh.Rotate(angle);
TetrahedralMesh<2,2> original_mesh;
original_mesh.ConstructFromMeshReader(mesh_reader);
for (unsigned i=0; i<mesh.GetNumNodes(); i++)
{
// Find new coordinates of the translated node
Node<2>* p_node = mesh.GetNode(i);
ChastePoint<2> new_coordinate = p_node->GetPoint();
// Get original node
Node<2>* p_original_node = original_mesh.GetNode(i);
ChastePoint<2> original_coordinate = p_original_node->GetPoint();
// Run a test to make sure the node has gone to the correct place
TS_ASSERT_DELTA(original_coordinate[0], -new_coordinate[0], 1e-5);
TS_ASSERT_DELTA(original_coordinate[1], -new_coordinate[1], 1e-5);
}
// Check volume conservation
double mesh_volume = mesh.GetVolume();
double original_mesh_volume = original_mesh.GetVolume();
TS_ASSERT_DELTA(mesh_volume, original_mesh_volume, 1e-5);
}
示例2: axis
void Test3DAngleAxisRotation()
{
TrianglesMeshReader<3,3> mesh_reader("mesh/test/data/cube_136_elements");
TetrahedralMesh<3,3> mesh;
mesh.ConstructFromMeshReader(mesh_reader);
c_vector<double,3> axis;
axis(0) = 1;
axis(1) = 0;
axis(2) = 0;
double angle = M_PI;
mesh.Rotate(axis, angle);
TetrahedralMesh<3,3> original_mesh;
original_mesh.ConstructFromMeshReader(mesh_reader);
for (unsigned i=0; i<mesh.GetNumNodes(); i++)
{
Node<3>* p_node = mesh.GetNode(i);
ChastePoint<3> new_coordinate = p_node->GetPoint();
// Get original node
Node<3>* p_original_node = original_mesh.GetNode(i);
ChastePoint<3> original_coordinate = p_original_node->GetPoint();
// Run a test to make sure the node has gone to the correct place
TS_ASSERT_DELTA(original_coordinate[0], new_coordinate[0], 1e-5);
TS_ASSERT_DELTA(original_coordinate[1], -new_coordinate[1], 1e-5);
TS_ASSERT_DELTA(original_coordinate[2], -new_coordinate[2], 1e-5);
}
// Check volume conservation
double mesh_volume = mesh.GetVolume();
double original_mesh_volume = original_mesh.GetVolume();
TS_ASSERT_DELTA(mesh_volume, original_mesh_volume, 1e-5);
}