Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

developer:brepstructure [2015/09/14] (current)
Line 1: Line 1:
 +======Brep Data Structure======
 +> **Developer:​** //C++//
 +
 +{{:​legacy:​en:​Brep_structure.gif}}
 +
 +=====Example=====
 +====C++====
 +<code c++>
 +
 +//Given a brep and a face index
 +const ON_Brep* brep;
 +const int face_index = 0;
 +ON_SimpleArray<​int>​ face_ti_list;​ //trims indeces list
 +ON_SimpleArray<​int>​ face_ei_list;​ //edges indeces list
 +
 +//Get the BrepFace of the given index
 +const ON_BrepFace* face = brep->​Face(face_index);​
 +if( 0 == face )
 +  return false;
 +
 +//Get the loop of the face
 +for( int fli = 0; fli < face->​LoopCount();​ fli++ )
 +{
 +  const ON_BrepLoop* loop = face->​Loop( fli );
 +  if( 0 == loop )
 +    continue;
 +
 +  for( int lti = 0; lti < loop->​TrimCount();​ lti++ )
 +  {
 +    //Find the trim
 +    const ON_BrepTrim* trim = loop->​Trim( lti );
 +    if( 0 == trim )
 +      continue;
 +    face_ti_list.Append( trim->​m_trim_index );
 +
 +    //Find the edge of that trim
 +    //Each trim has exactly one edge attached to it
 +    const ON_BrepEdge* edge = trim->​Edge();​
 +    if( 0 == edge )
 +      continue;
 +    face_ei_list.Append( edge->​m_edge_index );
 +  }
 +}
 +</​code>​
 +
 +{{tag>​Developer cplusplus Brep}}
  
developer/brepstructure.txt ยท Last modified: 2015/09/14 (external edit)