NSDT工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器 - REVIT导出3D模型插件 - 3D模型语义搜索引擎 - AI模型在线查看 - Three.js虚拟轴心开发包 - 3D模型在线减面 - STL模型在线切割 - 3D道路快速建模
本文介绍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翻译整理,转载请标明出处