当前位置: 首页 > news >正文

OCC 点云

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)thePoints=new  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);

http://www.lryc.cn/news/474705.html

相关文章:

  • 方法重写与方法重载
  • Vue3实现地球上加载柱体
  • OpenGL入门003——使用Factory设计模式简化渲染流程
  • 01_AI编程案例展示:借助AI轻松爬取海量网盘链接
  • 【机器学习导引】ch5-神经网络
  • 【Axure原型分享】颜色选择器——填充颜色
  • 怎么安装行星减速电机才是正确的
  • Unity程序化生成地形
  • Vxe UI vue vxe-table 表格中使用下拉表格,单元格渲染下拉表格
  • Android开发教程实加载中...动效
  • NVR设备ONVIF接入平台EasyCVR视频融合平台智慧小区视频监控系统建设方案
  • 适配器模式适用的场景
  • Ambari里面添加hive组件
  • Windows部署rabbitmq
  • 【Flask】四、flask连接并操作数据库
  • ES跟Kafka集成
  • Python Matplotlib:基本图表绘制指南
  • 供应商图纸外发:如何做到既安全又高效?
  • 探索 Move 编程语言:智能合约开发的新纪元
  • vue3+vant实现视频播放(含首次禁止进度条拖拽,视频看完后恢复,保存播放视频进度,刷新及下次进入继续播放,判断视频有无全部看完等)
  • 情感强度分析:精确衡量文本情感强弱的 AI 技术
  • 工厂方法模式与抽象工厂模式
  • 「Math」初等数学知识点大纲(占位待处理)
  • 百元高性价比头戴式降噪耳机选哪款?四款平价性价比品牌别错过!
  • vue3 setup写不写到标签上的区别
  • 【论文解读】EdgeYOLO:一种边缘实时目标检测器(附论文地址)
  • xlwings,让excel飞起来!
  • C语言学习,标准库 <stddef.h>
  • PyQt5实战——操作台打印重定向,主界面以及stacklayout使用(四)
  • React + Vite + TypeScript + React router项目搭建教程