ViewDesignEngine  3.1.0
高性能 CAD 计算几何引擎
vde::brep::BrepModel类 参考

B-Rep 模型 更多...

#include <brep.h>

Public 成员函数

 BrepModel ()=default
 
int add_vertex (const Point3D &p)
 添加顶点 更多...
 
int add_edge (int v0, int v1)
 添加直线边 更多...
 
int add_edge (int v0, int v1, const curves::NurbsCurve &curve)
 添加曲线边 更多...
 
int add_loop (const std::vector< int > &edges, bool outer=true)
 添加环 更多...
 
int add_face (int surface_id, const std::vector< int > &loops)
 添加面 更多...
 
int add_shell (const std::vector< int > &faces, bool closed=true)
 添加壳 更多...
 
int add_body (const std::vector< int > &shells, const std::string &name="")
 添加体 更多...
 
int add_surface (const curves::NurbsSurface &surf)
 添加 NURBS 曲面 更多...
 
size_t num_vertices () const
 顶点数量 更多...
 
size_t num_edges () const
 边数量 更多...
 
size_t num_faces () const
 面数量 更多...
 
size_t num_bodies () const
 体数量 更多...
 
size_t num_surfaces () const
 曲面数量 更多...
 
const TopoVertexvertex (int id) const
 按数组索引访问顶点 更多...
 
const TopoVertexvertex_by_id (int id) const
 按唯一 ID 访问顶点(适用于边数据中的 ID 引用) 更多...
 
const TopoEdgeedge (int id) const
 按数组索引访问边 更多...
 
const TopoFaceface (int id) const
 按数组索引访问面 更多...
 
const curves::NurbsSurfacesurface (int id) const
 按数组索引访问曲面 更多...
 
const TopoLooploop_by_id (int id) const
 按唯一 ID 访问环 更多...
 
const std::vector< TopoLoop > & all_loops () const
 获取所有环的只读引用 更多...
 
core::AABB3D bounds () const
 计算模型的轴对齐包围盒 更多...
 
bool is_valid () const
 检查模型有效性(快速版本) 更多...
 
mesh::HalfedgeMesh to_mesh (double deflection=0.01) const
 将 B-Rep 模型 tessellate 为三角网格 更多...
 
std::vector< int > face_edges (int face_id) const
 获取面的所有边 更多...
 
std::vector< int > edge_faces (int edge_id) const
 获取边的所有相邻面 更多...
 
std::vector< int > vertex_edges (int vertex_id) const
 获取顶点的所有相邻边 更多...
 

详细描述

B-Rep 模型

完整的三维边界表示模型,包含几何和拓扑数据。

主要职责

  • 构建: 通过 add_* 方法从底层构建拓扑结构
  • 查询: 获取顶点、面、边及它们的拓扑关系
  • 导出: 转换为三角网格(用于渲染)或导出到文件格式
  • 验证: 检查水密性和拓扑一致性

容差约定

容差 典型值 用途
顶点容差 1e-6 判断两点是否视为同一点
边曲线容差 1e-5 曲线拟合精度
tessellation 0.01 曲面转网格的弦高误差
参见
brep_validate.h 验证
modeling.h 高层建模 API
brep_boolean.h 布尔运算

在文件 brep.h177 行定义.

构造及析构函数说明

◆ BrepModel()

vde::brep::BrepModel::BrepModel ( )
default

成员函数说明

◆ add_body()

int vde::brep::BrepModel::add_body ( const std::vector< int > &  shells,
const std::string &  name = "" 
)

添加体

参数
shells壳 ID 列表
name体名称
返回
新体的 ID

◆ add_edge() [1/2]

int vde::brep::BrepModel::add_edge ( int  v0,
int  v1 
)

添加直线边

参数
v0起点顶点 ID
v1终点顶点 ID
返回
新边的 ID

◆ add_edge() [2/2]

int vde::brep::BrepModel::add_edge ( int  v0,
int  v1,
const curves::NurbsCurve curve 
)

添加曲线边

参数
v0起点顶点 ID
v1终点顶点 ID
curve边的几何曲线
返回
新边的 ID

◆ add_face()

int vde::brep::BrepModel::add_face ( int  surface_id,
const std::vector< int > &  loops 
)

添加面

参数
surface_id关联曲面 ID
loops环 ID 列表
返回
新面的 ID

◆ add_loop()

int vde::brep::BrepModel::add_loop ( const std::vector< int > &  edges,
bool  outer = true 
)

添加环

参数
edges环中边的 ID 序列(顺序连接)
outertrue = 外环, false = 内环
返回
新环的 ID

◆ add_shell()

int vde::brep::BrepModel::add_shell ( const std::vector< int > &  faces,
bool  closed = true 
)

添加壳

参数
faces面 ID 列表
closed是否为封闭壳
返回
新壳的 ID

◆ add_surface()

int vde::brep::BrepModel::add_surface ( const curves::NurbsSurface surf)

添加 NURBS 曲面

参数
surfNURBS 曲面定义
返回
新曲面的 ID

◆ add_vertex()

int vde::brep::BrepModel::add_vertex ( const Point3D &  p)

添加顶点

参数
p顶点坐标
返回
新顶点的 ID

◆ all_loops()

const std::vector<TopoLoop>& vde::brep::BrepModel::all_loops ( ) const
inline

获取所有环的只读引用

在文件 brep.h282 行定义.

◆ bounds()

core::AABB3D vde::brep::BrepModel::bounds ( ) const

计算模型的轴对齐包围盒

遍历所有顶点,取最小/最大坐标。

返回
包围盒(AABB)

◆ edge()

const TopoEdge& vde::brep::BrepModel::edge ( int  id) const
inline

按数组索引访问边

在文件 brep.h270 行定义.

◆ edge_faces()

std::vector<int> vde::brep::BrepModel::edge_faces ( int  edge_id) const

获取边的所有相邻面

反向查找:哪些面包含此边。 在流形网格中每条边应有恰好 2 个相邻面。

参数
edge_id边 ID
返回
相邻面 ID 列表

◆ face()

const TopoFace& vde::brep::BrepModel::face ( int  id) const
inline

按数组索引访问面

在文件 brep.h273 行定义.

◆ face_edges()

std::vector<int> vde::brep::BrepModel::face_edges ( int  face_id) const

获取面的所有边

展开面的所有环,收集其中包含的边 ID。

参数
face_id面 ID
返回
边 ID 列表(去重)

◆ is_valid()

bool vde::brep::BrepModel::is_valid ( ) const

检查模型有效性(快速版本)

进行基本检查:是否有顶点/边/面,ID 引用是否有效。 完整验证请使用 brep_validate.h 中的 validate()

返回
true 如果模型通过基本检查
参见
validate() 完整验证(水密性、方向一致性等)

◆ loop_by_id()

const TopoLoop& vde::brep::BrepModel::loop_by_id ( int  id) const

按唯一 ID 访问环

◆ num_bodies()

size_t vde::brep::BrepModel::num_bodies ( ) const
inline

体数量

在文件 brep.h256 行定义.

◆ num_edges()

size_t vde::brep::BrepModel::num_edges ( ) const
inline

边数量

在文件 brep.h250 行定义.

◆ num_faces()

size_t vde::brep::BrepModel::num_faces ( ) const
inline

面数量

在文件 brep.h253 行定义.

◆ num_surfaces()

size_t vde::brep::BrepModel::num_surfaces ( ) const
inline

曲面数量

在文件 brep.h259 行定义.

◆ num_vertices()

size_t vde::brep::BrepModel::num_vertices ( ) const
inline

顶点数量

在文件 brep.h247 行定义.

◆ surface()

const curves::NurbsSurface& vde::brep::BrepModel::surface ( int  id) const
inline

按数组索引访问曲面

在文件 brep.h276 行定义.

◆ to_mesh()

mesh::HalfedgeMesh vde::brep::BrepModel::to_mesh ( double  deflection = 0.01) const

将 B-Rep 模型 tessellate 为三角网格

所有曲面和曲线以给定的弦高误差 tessellate 为三角形。

参数
deflection弦高误差(控制 tessellation 精度,默认 0.01)
返回
HalfedgeMesh 三角网格
注解
deflection 越小网格越精细,但三角形数量显著增加。

◆ vertex()

const TopoVertex& vde::brep::BrepModel::vertex ( int  id) const
inline

按数组索引访问顶点

在文件 brep.h264 行定义.

◆ vertex_by_id()

const TopoVertex& vde::brep::BrepModel::vertex_by_id ( int  id) const

按唯一 ID 访问顶点(适用于边数据中的 ID 引用)

◆ vertex_edges()

std::vector<int> vde::brep::BrepModel::vertex_edges ( int  vertex_id) const

获取顶点的所有相邻边

参数
vertex_id顶点 ID
返回
相邻边 ID 列表

该类的文档由以下文件生成: