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


C++ ON_Brep::AddTrimCurve方法代码示例

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


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

示例1: ON_BrepExtrude


//.........这里部分代码省略.........
  {
    // build top faces
    for (fi = 0; fi < fcount0; fi++ )
    {
      const ON_BrepFace& bottomf = brep.m_F[fi];
      ON_Surface* srf = bottomf.DuplicateSurface();
      if ( !srf )
      {
        bOK = false;
        break;
      }
      srf->Transform(tr);
      int si = brep.AddSurface(srf);
      ON_BrepFace& topf = brep.NewFace(si);
      topf.m_bRev = !bottomf.m_bRev;
      const int loop_count = bottomf.m_li.Count();
      topf.m_li.Reserve(loop_count);
      for ( int fli = 0; fli < loop_count; fli++ )
      {
        const ON_BrepLoop& bottoml = brep.m_L[bottomf.m_li[fli]];
        ON_BrepLoop& topl = brep.NewLoop(bottoml.m_type,topf);
        const int loop_trim_count = bottoml.m_ti.Count();
        topl.m_ti.Reserve(loop_trim_count);
        for ( int lti = 0; lti < loop_trim_count; lti++ )
        {
          const ON_BrepTrim& bottomt = brep.m_T[bottoml.m_ti[lti]];
          ON_NurbsCurve* c2 = ON_NurbsCurve::New();
          if ( !bottomt.GetNurbForm(*c2) )
          {
            delete c2;
            bOK = false;
            break;
          }
          int c2i = brep.AddTrimCurve(c2);
          ON_BrepTrim* topt = 0;
          if ( bottomt.m_ei >= 0 )
          {
            ON_BrepEdge& tope = brep.m_E[topeimap[bottomt.m_ei]];
            topt = &brep.NewTrim(tope,bottomt.m_bRev3d,topl,c2i);
          }
          else
          {
            // singular trim
            ON_BrepVertex& topv = brep.m_V[topvimap[bottomt.m_vi[0]]];
            topt = &brep.NewSingularTrim(topv,topl,bottomt.m_iso,c2i);
          }
          topt->m_tolerance[0] = bottomt.m_tolerance[0];
          topt->m_tolerance[1] = bottomt.m_tolerance[1];
          topt->m_pbox = bottomt.m_pbox;
          topt->m_type = bottomt.m_type;
          topt->m_iso = bottomt.m_iso;
        }
        topl.m_pbox = bottoml.m_pbox;
      }
    }
  }

  // build sides
  int bRev3d[4] = {0,0,1,1};
  int vid[4], eid[4];
  if( bOK ) for ( ei = 0; ei < ecount0; ei++ )
  {
    if ( bSideEdge[ei] && topeimap[ei] )
    {
      ON_BrepEdge& bottome = brep.m_E[ei];
      ON_BrepEdge& tope = brep.m_E[topeimap[ei]];
开发者ID:ToMadoRe,项目名称:v4r,代码行数:67,代码来源:opennurbs_brep_extrude.cpp

示例2: ON_BrepExtrudeHelper_MakeTopLoop


//.........这里部分代码省略.........

    // duplicate bottom edge curve
    const ON_BrepEdge& bottom_edge = brep.m_E[bottom_trim.m_ei];
    ON_Curve* top_c3 = bottom_edge.DuplicateCurve();
    if ( 0 == top_c3 )
      continue;
    // move new edge curve to top location
    top_c3->Translate(path_vector);
    ON_3dPoint P0 = top_c3->PointAtStart();
    ON_3dPoint P1 = top_c3->PointAtEnd();
    int top_c3i = brep.AddEdgeCurve(top_c3);
    top_c3 = 0;
    // get vertices at start/end of the new edge
    int e_vi0 = top_vertex_index[lti];
    int e_vi1 = top_vertex_index[(lti+1)%loop_trim_count];
    if ( bottom_trim.m_bRev3d )
    {
      // put points in trim order
      ON_3dPoint tmp_P = P0; P0 = P1; P1 = tmp_P;
    }
    if ( e_vi0 < 0 )
    {
      e_vi0 = brep.NewVertex(P0).m_vertex_index;
      top_vertex_index[lti] = e_vi0;
    }
    if ( e_vi1 < 0 )
    {
      e_vi1 = brep.NewVertex(P1).m_vertex_index;
      top_vertex_index[(lti+1)%loop_trim_count] = e_vi1;
    }
    if ( bottom_trim.m_bRev3d )
    {
      // put edge vertex indices in edge order
      int tmp_i = e_vi0; e_vi0 = e_vi1; e_vi1 = tmp_i;
    }
    ON_BrepEdge& top_edge = brep.NewEdge(brep.m_V[e_vi0],brep.m_V[e_vi1],top_c3i);
    top_edge.m_tolerance = bottom_edge.m_tolerance;
    top_edge_index[lti] = top_edge.m_edge_index;
    top_trim_bRev3d[lti] = bottom_trim.m_bRev3d?true:false;

    // find seam mate and set it's 
    // top_edge_index[] to top_edge.m_edge_index.
    int mate_lti;
    for( mate_lti = lti+1; mate_lti < loop_trim_count; mate_lti++ )
    {
      if ( top_edge_index[mate_lti] != -1  )
        continue;
      int bottom_mate_ti = bottom_loop.m_ti[mate_lti];
      if ( bottom_mate_ti < 0 || bottom_mate_ti >= brep.m_T.Count() )
        continue;
      const ON_BrepTrim& bottom_mate_trim = brep.m_T[bottom_mate_ti];
      if ( bottom_mate_trim.m_type != ON_BrepTrim::seam )
        continue;
      if ( bottom_mate_trim.m_ei != bottom_trim.m_ei )
        continue;
      top_edge_index[mate_lti] = top_edge.m_edge_index;
      top_trim_bRev3d[mate_lti] = bottom_mate_trim.m_bRev3d?true:false;
      break;
    }
  }


  for ( lti = 0; lti < loop_trim_count; lti++ )
  {
    const ON_BrepTrim& bottom_trim = brep.m_T[ bottom_loop.m_ti[lti] ];
    ON_Curve* top_c2 = bottom_trim.DuplicateCurve();
    int top_c2i = (0!=top_c2) ? brep.AddTrimCurve(top_c2) : bottom_trim.m_c2i;
    top_trim_index = -1;
    if ( bottom_trim.m_type == ON_BrepTrim::singular && top_vertex_index[lti] >= 0 )
    {
      top_trim_index = brep.NewSingularTrim(brep.m_V[top_vertex_index[lti]], top_loop, bottom_trim.m_iso, top_c2i ).m_trim_index;
    }
    else if ( bottom_trim.m_type != ON_BrepTrim::singular && top_edge_index[lti] >= 0 && top_edge_index[lti] < brep.m_E.Count() )
    {
      ON_BrepEdge& top_edge = brep.m_E[top_edge_index[lti]];
      top_trim_index = brep.NewTrim( top_edge, top_trim_bRev3d[lti], top_loop, top_c2i ).m_trim_index;
    }
    else
    {
      ON_ERROR("ON_BrepExtrudeHelper_MakeTopLoop ran into capping trouble.");
      rc = false;
      break;
    }
    ON_BrepTrim& top_trim = brep.m_T[top_trim_index];
    top_trim.m_pline = bottom_trim.m_pline;
    top_trim.m_pbox = bottom_trim.m_pbox;
    top_trim.m_iso = bottom_trim.m_iso;
    top_trim.m_type = bottom_trim.m_type;
    top_trim.m_tolerance[0] = bottom_trim.m_tolerance[0];
    top_trim.m_tolerance[1] = bottom_trim.m_tolerance[1];
    top_trim.m__legacy_2d_tol = bottom_trim.m__legacy_2d_tol;
    top_trim.m__legacy_3d_tol = bottom_trim.m__legacy_2d_tol;
    top_trim.m__legacy_flags = bottom_trim.m__legacy_flags;
  }
  if (rc)
  {
    top_loop.m_pbox = bottom_loop.m_pbox;
  }
  return rc;
}
开发者ID:ToMadoRe,项目名称:v4r,代码行数:101,代码来源:opennurbs_brep_extrude.cpp


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