本文整理汇总了C++中CubitVector::distance_between_squared方法的典型用法代码示例。如果您正苦于以下问题:C++ CubitVector::distance_between_squared方法的具体用法?C++ CubitVector::distance_between_squared怎么用?C++ CubitVector::distance_between_squared使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CubitVector
的用法示例。
在下文中一共展示了CubitVector::distance_between_squared方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: closest_point_along_vector
CubitStatus FacetSurface::closest_point_along_vector(CubitVector& from_point,
CubitVector& along_vector,
CubitVector& point_on_surface)
{
CubitVector other_point = from_point+along_vector;
DLIList<CubitVector*> intersection_list;
facetEvalTool->get_intersections( from_point, other_point, intersection_list );
if( intersection_list.size() == 0 )
return CUBIT_FAILURE;
if( intersection_list.size() == 1 )
{
point_on_surface = *intersection_list.get();
delete intersection_list.get();
return CUBIT_SUCCESS;
}
//get the closest intersection
double closest_dist_sq = CUBIT_DBL_MAX;
for( int k=intersection_list.size(); k--; )
{
CubitVector *int_pt = intersection_list.get_and_step();
double tmp_dist_sq = from_point.distance_between_squared( *int_pt );
if( tmp_dist_sq < closest_dist_sq )
{
point_on_surface = *int_pt;
closest_dist_sq = tmp_dist_sq;
}
delete int_pt;
}
return CUBIT_SUCCESS;
}