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


C++ ON_SimpleArray::Last方法代码示例

本文整理汇总了C++中ON_SimpleArray::Last方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_SimpleArray::Last方法的具体用法?C++ ON_SimpleArray::Last怎么用?C++ ON_SimpleArray::Last使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ON_SimpleArray的用法示例。


在下文中一共展示了ON_SimpleArray::Last方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ON_BrepExtrudeHelper_MakeSides

static
ON_BOOL32 ON_BrepExtrudeHelper_MakeSides(
          ON_Brep& brep,
          int loop_index,
          const ON_Curve& path_curve,
          ON_BOOL32 bCap,
          ON_SimpleArray<int>& side_face_index
          )
{
  int lti, ti, i, vid[4], eid[4], bRev3d[4];

  // indices of new faces appended to the side_face_index[] array 
  // (1 face index for each trim, -1 is used for singular trims)

  // count number of new objects so we can grow arrays
  // efficiently and use refs to dynamic array elements.
  const int loop_trim_count = brep.m_L[loop_index].m_ti.Count();
  if ( loop_trim_count == 0 )
    return false;

  // save input trim and edge counts for use below
  const int trim_count0 = brep.m_T.Count();
  const int edge_count0 = brep.m_E.Count();

  ON_BrepExtrudeHelper_ReserveSpace( brep, loop_trim_count, bCap?1:0 );

  side_face_index.Reserve( side_face_index.Count() + loop_trim_count); // index of new face above brep.m_L[loop_index].m_ti[lti]
  int prev_face_index = -1;
  int first_face_east_trim_index = -1;

  for ( lti = 0; lti < loop_trim_count; lti++ )
  {
    ON_SumSurface* sum_srf = 0;
    side_face_index.Append(-1);
    ti = brep.m_L[loop_index].m_ti[lti];
    if ( ti < 0 || ti >= trim_count0 )
      continue;

    for ( i = 0; i < 4; i++ )
    {
      vid[i] = -1;
      eid[i] = -1;
    }
    bRev3d[0] = false;
    bRev3d[1] = false;
    bRev3d[2] = false;
    bRev3d[3] = false;

    // get side surface for new face
    {
      ON_BrepTrim& trim = brep.m_T[ti];
      if ( trim.m_ei >= 0 &&  trim.m_ei < edge_count0 )
      {
        const ON_BrepEdge& base_edge = brep.m_E[trim.m_ei];

        // 5 September, 2003 Dale Lear
        //   do not extrude seams - fixes rectangle slabe bug
        if ( trim.m_type == ON_BrepTrim::seam )
        {
          prev_face_index = -1;
          continue;
        }

        // connect new face to existing topology on trim
        vid[0] = trim.m_vi[1];
        vid[1] = trim.m_vi[0];
        eid[0] = base_edge.m_edge_index;
        bRev3d[0] = (trim.m_bRev3d?false:true);
        sum_srf = ON_BrepExtrudeHelper_MakeSumSrf( path_curve, base_edge, trim.m_bRev3d );
      }
    }
    if ( !sum_srf )
      continue;

    if ( prev_face_index >= 0 )
    {
      const ON_BrepTrim& prev_west_trim = brep.m_T[ brep.m_L[ brep.m_F[prev_face_index].m_li[0]].m_ti[3] ];
      vid[2] = prev_west_trim.m_vi[0];
      eid[1] = prev_west_trim.m_ei;
      bRev3d[1] = (prev_west_trim.m_bRev3d?false:true);
    }
    if ( first_face_east_trim_index >= 0 && brep.m_T[first_face_east_trim_index].m_vi[0] == vid[0] )
    {
      const ON_BrepTrim& first_face_east_trim = brep.m_T[first_face_east_trim_index];
      vid[3] = first_face_east_trim.m_vi[1];
      eid[3] = first_face_east_trim.m_ei;
      bRev3d[3] = (first_face_east_trim.m_bRev3d?false:true);
    }
    const ON_BrepFace* side_face = brep.NewFace(sum_srf,vid,eid,bRev3d);
    if ( side_face )
    {
      *side_face_index.Last() = side_face->m_face_index;
      prev_face_index = side_face->m_face_index;
      if ( first_face_east_trim_index < 0 )
        first_face_east_trim_index = brep.m_L[ side_face->m_li[0] ].m_ti[1];
    }
  }

  return true;
}
开发者ID:ToMadoRe,项目名称:v4r,代码行数:100,代码来源:opennurbs_brep_extrude.cpp


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