本文整理汇总了C++中DLIList::reverse方法的典型用法代码示例。如果您正苦于以下问题:C++ DLIList::reverse方法的具体用法?C++ DLIList::reverse怎么用?C++ DLIList::reverse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DLIList
的用法示例。
在下文中一共展示了DLIList::reverse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_curve_facets
CubitStatus Faceter::get_curve_facets( RefEdge* curve, DLIList<CubitPoint*>& segments ) const
{
//const double COS_ANGLE_TOL = 0.965925826289068312213715; // cos(15)
const double COS_ANGLE_TOL = 0.984807753012208020315654; // cos(10)
//const double COS_ANGLE_TOL = 0.996194698091745545198705; // cos(5)
GMem curve_graphics;
const double dist_tol = GEOMETRY_RESABS;
const double dist_tol_sqr = dist_tol*dist_tol;
Curve* curve_ptr = curve->get_curve_ptr();
curve_ptr->get_geometry_query_engine()->get_graphics( curve_ptr, &curve_graphics );
GPoint* gp = curve_graphics.point_list();
CubitPoint* last = (CubitPoint*) new FaceterPointData( gp->x, gp->y, gp->z );
((FaceterPointData*)last)->owner(dynamic_cast<RefEntity*>(curve));
CubitVector lastv = last->coordinates();
segments.append( last );
GPoint* end = gp + curve_graphics.pointListCount - 1;
for( gp++; gp < end; gp++ )
{
CubitVector pos( gp->x, gp->y, gp->z );
CubitVector step1 = (pos - lastv);
double len1 = step1.length();
if( len1 < dist_tol ) continue;
GPoint* np = gp + 1;
CubitVector next( np->x, np->y, np->z );
CubitVector step2 = next - pos;
double len2 = step2.length();
if( len2 < dist_tol ) continue;
double cosine = (step1 % step2) / (len1 * len2);
if( cosine > COS_ANGLE_TOL ) continue;
last = new FaceterPointData( pos );
((FaceterPointData*)last)->owner(dynamic_cast<RefEntity*>(curve));
segments.append( last );
lastv = last->coordinates();
}
CubitVector last_pos( gp->x, gp->y, gp->z );
segments.last();
while( (last_pos - (segments.get()->coordinates())).length_squared() < dist_tol_sqr )
{
delete segments.pop();
segments.last();
}
CubitPoint *tmp_point = (CubitPoint*) new FaceterPointData( last_pos );
segments.append( tmp_point );
((FaceterPointData*)tmp_point)->owner( dynamic_cast<RefEntity*>(curve) );
// Now check if the segment list is reversed wrt the curve direction.
segments.reset();
double u1, u2;
if( segments.size() > 2 )
{
u1 = curve->u_from_position( (segments.next(1)->coordinates()) );
u2 = curve->u_from_position( (segments.next(2)->coordinates()) );
}
else
{
u1 = curve->u_from_position( (segments.get()->coordinates() ) );
u2 = curve->u_from_position( (segments.next()->coordinates()) );
}
if( (u2 < u1) && (curve->start_param() <= curve->end_param()) )
segments.reverse();
//Make sure we don't have duplicate points.
int jj;
CubitVector curr, prev;
for ( jj = segments.size(); jj > 0; jj-- )
{
prev = segments.prev()->coordinates();
curr = segments.get_and_step()->coordinates();
if ( prev.about_equal(curr) )
{
PRINT_DEBUG_129("Points on curve %d within tolerance...\n", curve->id());
segments.back();
delete segments.remove();
}
}
return CUBIT_SUCCESS;
}