示例#1
0
RH_C_FUNCTION void ON_Brep_DuplicateEdgeCurves(const ON_Brep* pBrep, ON_SimpleArray<ON_Curve*>* pOutCurves, bool nakedOnly)
{
  if (pBrep && pOutCurves)
  {
    for(int i = 0; i < pBrep->m_E.Count(); i++)
    {
      const ON_BrepEdge& edge = pBrep->m_E[i];
      if( nakedOnly && edge.m_ti.Count()!=1 )
        continue;

      ON_Curve* curve = edge.DuplicateCurve();
      if(curve)
      {
        // From RhinoScript:
        // make the curve direction go in the natural boundary loop direction
        // so that the curve directions come out consistantly
        if( pBrep->m_T[edge.m_ti[0]].m_bRev3d )
          curve->Reverse();
        if( pBrep->m_T[edge.m_ti[0]].Face()->m_bRev )
          curve->Reverse();

        pOutCurves->Append(curve);
      }
    }
  }
}
示例#2
0
RH_C_FUNCTION void ON_Brep_DuplicateEdgeCurves(const ON_Brep* pConstBrep, ON_SimpleArray<ON_Curve*>* pOutCurves, bool nakedOnly, bool nakedOuter, bool nakedInner)
{
  if (pConstBrep && pOutCurves)
  {
    for(int i = 0; i < pConstBrep->m_E.Count(); i++)
    {
      const ON_BrepEdge& edge = pConstBrep->m_E[i];
      if( nakedOnly )
      {
        if( edge.m_ti.Count() != 1 )
          continue;

        const ON_BrepTrim& trim = pConstBrep->m_T[edge.m_ti[0]];
        const ON_BrepLoop& loop = pConstBrep->m_L[trim.m_li];

        bool acceptable = (nakedOuter && loop.m_type == ON_BrepLoop::outer) ||
                          (nakedInner && loop.m_type == ON_BrepLoop::inner);
        if( !acceptable )
          continue;
      }

      ON_Curve* curve = edge.DuplicateCurve();
      if(curve)
      {
        // From RhinoScript:
        // make the curve direction go in the natural boundary loop direction
        // so that the curve directions come out consistantly
        if( pConstBrep->m_T[edge.m_ti[0]].m_bRev3d )
          curve->Reverse();
        if( pConstBrep->m_T[edge.m_ti[0]].Face()->m_bRev )
          curve->Reverse();

        pOutCurves->Append(curve);
      }
    }
  }
}