本文整理汇总了C++中PointType::normalize方法的典型用法代码示例。如果您正苦于以下问题:C++ PointType::normalize方法的具体用法?C++ PointType::normalize怎么用?C++ PointType::normalize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointType
的用法示例。
在下文中一共展示了PointType::normalize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: point
bool extract_symmetric_slice_3d::run(viennamesh::algorithm_handle &)
{
mesh_handle input_mesh = get_required_input<mesh_handle>("mesh");
int geometric_dimension = viennagrid::geometric_dimension( input_mesh() );
if (geometric_dimension != 3)
return false;
double tol = 1e-6;
if (get_input<double>("tolerance").valid())
tol = get_input<double>("tolerance")();
typedef viennagrid::mesh MeshType;
typedef viennagrid::result_of::point<MeshType>::type PointType;
PointType axis = get_required_input<point>("axis")();
axis.normalize();
int rotational_frequency = get_required_input<int>("rotational_frequency")();
double angle = 2*M_PI/rotational_frequency;
PointType N[2];
N[0] = viennagrid::make_point(0,1,0);
if ( std::abs(viennagrid::inner_prod(axis,N[0])) > 1.0-tol )
N[0] = viennagrid::make_point(-1,0,0);
N[0] -= axis * viennagrid::inner_prod(axis,N[0]);
N[0].normalize();
N[1] = -rotate(N[0], point(geometric_dimension), axis, angle);
info(1) << "Using rotational frequency " << rotational_frequency << std::endl;
info(1) << "Angle = " << angle << std::endl;
info(1) << "Axis = " << axis << std::endl;
info(1) << "Normal[0] = " << N[0] << std::endl;
info(1) << "Normal[1] = " << N[1] << std::endl;
mesh_handle tmp = cut( input_mesh(), N[0], tol );
mesh_handle output_mesh = cut( tmp(), N[1], tol );
set_output( "mesh", output_mesh );
return true;
}