转发并翻译一篇外国人写的关于利用 GeomFill_Pipe() 类构造管形结构的文章,这篇文章表现出来的技术、逻辑和对OpenCasCade的理解,都是非常值得学习的。文章原网址http://quaoar.su/blog/page/postroenie-trubki-po-dvum-sechenijam
需求:沿着给定轨迹通过入口、出口两个截面构造管道结构,如下图所示:
这个操作看起来很简单,开发人员可能会这样写代码:
// Construct path.
TColgp_Array1OfPnt pathPoles (1, 3);
pathPoles (1) = gp_Pnt (0, 0, 0);
pathPoles (2) = gp_Pnt (100, 0, 0);
pathPoles (3) = gp_Pnt (100, 100, 0);
//
Handle (Geom_BezierCurve) path = new Geom_BezierCurve (pathPoles);
// Construct sections.
Handle (Geom_Curve) c1 = new Geom_Circle (gp_Ax2 (gp_Pnt (0, 0, 0), gp :: DX ()), 10.0);
Handle (Geom_Curve) c2 = new Geom_Circle (gp_Ax2 (gp_Pnt (100, 100, 0), gp :: DY ()),