Rhino Brep数据结构
本文介绍Rhino/OpenNurbs中Brep模型的数据结构,如Surface、Curve3D、Curve2D、Vertex、Edge、Trim、Loop、Face等。
1、概念图
2、示例代码
//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 );
}
}
原文链接:Brep Data Structure
BimAnt翻译整理,转载请标明出处