app网站平台搭建,网站建设用什么软件,洛阳做网站优化,生产管理软件appOCC的基础知识可能还是要系统学习一下#xff0c;部分导入的模型面类型是很多面都是GeomAbs_BSplineSurface#xff0c;最终获取参数都要拟合一下#xff0c;拟合后的生成的面对象没有大小#xff0c;比如平面只有矢量#xff08;大小没有思路#xff09; 圆柱拟合面没有…OCC的基础知识可能还是要系统学习一下部分导入的模型面类型是很多面都是GeomAbs_BSplineSurface最终获取参数都要拟合一下拟合后的生成的面对象没有大小比如平面只有矢量大小没有思路 圆柱拟合面没有高度圆柱最后我用的投影的方法获取高度。
本章拾取的面按步距生成点云因为没有大小或者没办法通过UV控制所以尝试通过点云类直接操作
1、通过点云生成TopoDS_Shape
可以尝试BRepLib_PointCloudShape
2、通过TopoDS_Shape 直接生成点云。
BRepLib_PointCloudShape 这个类可以实现。
参考连接Open Cascade 7.7.0 新功能模拟三维扫描点云-BRepLib_PointCloudShape - unicornsir - 博客园
代码如下
a.类继承和虚函数的实现:
class PointCloudPntFiller : public BRepLib_PointCloudShape { public: PointCloudPntFiller(Standard_Real theTol) : BRepLib_PointCloudShape(TopoDS_Shape(), theTol) {} void SetPointArray(const Handle(Graphic3d_ArrayOfPoints) thePoints) { myPoints thePoints; }
protected: virtual void addPoint(const gp_Pnt thePoint, const gp_Vec theNorm, const gp_Pnt2d theUV, const TopoDS_Shape) Standard_OVERRIDE { const Standard_Integer aPntIndex myPoints-AddVertex(thePoint, theUV); if (theNorm.SquareMagnitude() gp::Resolution()) { myPoints-SetVertexNormal(aPntIndex, theNorm); } if (myPoints-HasVertexColors()) { Quantity_Color aColor(360.0 * Standard_Real(aPntIndex) / Standard_Real(myPoints-VertexNumberAllocated()), 1.0, 0.5, Quantity_TOC_HLS); myPoints-SetVertexColor(aPntIndex, aColor); } }
private: Handle(Graphic3d_ArrayOfPoints) myPoints; };
b,.类的调用 Handle(Graphic3d_ArrayOfPoints)thePointsnew Graphic3d_ArrayOfPoints(10000, false, true);; PointCloudPntFiller thePointCloudPntFiller( Precision::Confusion()); thePointCloudPntFiller.SetShape(aFace); thePointCloudPntFiller.SetDistance(uStep); thePointCloudPntFiller.SetPointArray(thePoints); thePointCloudPntFiller.GeneratePointsByDensity(); 总结
1、这个方法应该也可以根据密度生成网格小平面可以在和其他系统交互中把TopoDS_Shape 转换为数据
2、步距只能一个参数不存UV 经纬这种操作。
我的遗留问题为什么部分GeomAbs_BSplineSurface类型面通过BRepTools::UVBounds没办法获取大小。
double umin, umax, vmin, vmax; BRepTools::UVBounds(aFace, umin, umax, vmin, vmax);