正交视图三维重建 笔记 2d线到3d线

这种代码怎么写好,x1==tx1 x2==tx2 x1x2在一条线上tx2和tx1在一条线上输出x1 y1 ty1,x2 y2 ty2

 

线过的点 的集合

俯视图找深度

测试一下 

目标

四条线变一条线

复杂度贼大跑起来贼慢

加了16000条

去重

for (const [x1, y1, x2, y2, lineId, type] of frontpointlist) {for (const [x3, y3, x4, y4, lineId2, type2] of toppointlist) {if (x1 === x3 && x2 === x4) {const drawline1=[x1, y1, y3 - clusterMinY, x2, y2, y3 - clusterMinY]const drawline2=[x1, y1, y4 - clusterMinY, x2, y2, y4 - clusterMinY]const key = drawline1.map(v => v.toFixed(2)).join(',');if (!seenLinePairs.has(key)) {seenLinePairs.add(key);lines3d.push([x1, y1, y3 - clusterMinY, x2, y2, y3 - clusterMinY, lineId, type]);}const key2 = drawline2.map(v => v.toFixed(2)).join(',');if (!seenLinePairs.has(key2)) {seenLinePairs.add(key2);lines3d.push([x1, y1, y4 - clusterMinY, x2, y2, y4 - clusterMinY, lineId, type]);}}}
}

上下分离

俯视图的拉伸需要旋转

yz调换

升天

俯视图z忘记归零了

多了4条线,不过问题不大,不影响生成面,生成面是要闭合环

经典缺线

分开判断看看

多这条线是不能容忍的

飞了

取x,x不一样

这条线不存在于俯视图

按x方向投

主视图侧视图投影线需要在俯视图里

for (const [x1, y1, x2, y2,lineId] of mostFrequentCluster.lines) {for (const [x3, y3, x4, y4,lineId2,type] of mostFrequentCluster.lines) {
if(x1<=x3 && x2>=x4 && y1<=y3 && y2>=y4 )
{frontpointlist.push([x3, y3, x4, y4,lineId2,type]);
frontpointmap .set([x3, y3,x4, y4], true);}}
}

200,0 

捕捉不到兀线

for (const [x1, y1, x2, y2, lineId, type] of toppointlist) {for (const [x3, y3, x4, y4, lineId2, type2] of frontpointlist){if (x1 === x3 && x2 === x4) {const drawline1=[x1, y3, y1 , x2, y3, y2];const drawline2=[x1, y4, y1 , x2, y4, y2];const key = drawline1.map(v => v.toFixed(2)).join(',');if (!seenLinePairs.has(key)) {seenLinePairs.add(key);//  lines3d.push([x1, y3, y1, x2, y3, y2, lineId, type]);}const key2 = drawline2.map(v => v.toFixed(2)).join(',');if (!seenLinePairs.has(key2)) {seenLinePairs.add(key2);//  lines3d.push([x1, y4, y1 , x2, y4, y2, lineId, type]);}}}}for (const [x1, y1, x2, y2, lineId, type] of rightpointlist) {for (const [x3, y3, x4, y4, lineId2, type2] of frontpointlist) {if (y1 === y3&& y2 === y4) {const drawline1=[x3, y1, x1, x3, y2, x2];const drawline2=[x4, y1, x1, x4, y2, x2];const key = drawline1.map(v => v.toFixed(2)).join(',');if (!seenLinePairs.has(key)) {seenLinePairs.add(key);lines3d.push([x3, y1, x1, x3, y2, x2 ,lineId, type]);}const key2 = drawline2.map(v => v.toFixed(2)).join(',');if (!seenLinePairs.has(key2)) {seenLinePairs.add(key2);lines3d.push([x4, y1, x1, x4, y2, x2, lineId, type]);}}}

没什么软用

for (const [x1, y1, x2, y2,lineId] of mostFrequentCluster.lines) {for (const [x3, y3, x4, y4,lineId2,type] of mostFrequentCluster.lines) {
if(x1<=x3 && x2>=x4 && y1<=y3 && y2>=y4 )
{frontpointlist.push([x3, y3, x4, y4,lineId2,type]);
frontpointmap .set(`${x3},${y3 }`, true);
frontpointmap .set(   `${x4},${y4}`, true);}}
}
for (const [x1, y1, x2, y2,lineId] of topcluauster.lines) {for (const [x3, y3, x4, y4,lineId2,type] of topcluauster.lines) {if(x1<=x3 && x2>=x4 && y1<=y3 && y2>=y4 )
{toppointlist.push([x3, y3- clusterMinY, x4, y4- clusterMinY,lineId2,type]);
toppointmap .set(`${x3},${y3- clusterMinY }`, true);
toppointmap .set(   `${x4},${y4- clusterMinY}`, true);
}}
}
for (const [x1, y1, x2, y2,lineId] of rightcluster.lines) {for (const [x3, y3, x4, y4,lineId2,type] of rightcluster.lines) {if(x1<=x3 && x2>=x4 && y1<=y3 && y2>=y4 )
{rightpointlist.push([x3-clusterMinx, y3, x4-clusterMinx, y4,lineId2,type]);rightpointmap .set(`${x3-clusterMinx },${y3 }`, true);rightpointmap .set(   `${x4-clusterMinx },${y4}`, true);}}
}


看看别人怎么写的

 

for (const [fx1, fy1, fx2, fy2, lineId, type] of frontpointlist) {for (const [tx1, ty1, tx2, ty2, lineId2, type2] of toppointlist) {if (fx1 === tx1 && fx2 === tx2) {const A=[fx1, fy1, ty1];const Ahat=[fx1, fy1, ty2];const B=[fx2, fy2, ty1];const Bhat=[fx2, fy2, ty2];}}
}

好短

const seenLinePairs = new Set<string>(); // 用于记录已经添加过的 [lineId, lineId2] 对
function drawlines(x1:number, y1:number, z1:number , x2:number, y2:number, z2:number , lineId:number, type:number){if([x1, y1, z1].join(',') === [x2, y2, z2].join(','))return;const drawline2=[x1, y1, z1 , x2, y2,z2]const key2 = drawline2.map(v => v.toFixed(2)).join(',');if (!seenLinePairs.has(key2)) {seenLinePairs.add(key2);lines3d.push([x1, y1, z1, x2, y2, z2 , lineId, type]);}}
for (const [fx1, fy1, fx2, fy2, lineId, type] of frontpointlist) {for (const [tx1, ty1, tx2, ty2, lineId2, type2] of toppointlist) {if (fx1 === tx1 && fx2 === tx2) {const A=[fx1, fy1, ty1];const Ahat=[fx1, fy1, ty2];const B=[fx2, fy2, ty1];const Bhat=[fx2, fy2, ty2];drawlines(A[0], A[1], A[2], Ahat[0], Ahat[1], Ahat[2], lineId, type);drawlines(B[0], B[1], B[2], Bhat[0], Bhat[1], Bhat[2], lineId, type);drawlines(A[0], A[1], A[2], B[0], B[1], B[2], lineId, type);drawlines(Ahat[0], Ahat[1], Ahat[2], Bhat[0], Bhat[1], Bhat[2], lineId, type);}}
}

又缺线 

for (const [fx1, fy1, fx2, fy2, lineId, type] of frontpointlist) {for (const [tx1, ty1, tx2, ty2, lineId2, type2] of toppointlist) {if (isLineInSet([fx1,ty1,fx2,ty1] ,toplineSet)&& isLineInSet([fx1,ty2,fx2,ty2] ,toplineSet)) {const A=[fx1, fy1, ty1];const Ahat=[fx1, fy1, ty2];const B=[fx2, fy2, ty1];const Bhat=[fx2, fy2, ty2];drawlines(A[0], A[1], A[2], Ahat[0], Ahat[1], Ahat[2], lineId, type);drawlines(B[0], B[1], B[2], Bhat[0], Bhat[1], Bhat[2], lineId, type);drawlines(A[0], A[1], A[2], B[0], B[1], B[2], lineId, type);drawlines(Ahat[0], Ahat[1], Ahat[2], Bhat[0], Bhat[1], Bhat[2], lineId, type);}}
}

 

明天用rbush解决兀的情况,然后前视图俯视图调换一下看看效果

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/web/86731.shtml
繁体地址,请注明出处:http://hk.pswp.cn/web/86731.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【耳机】IEM 前腔 后腔 泄压孔 -> 调音纸对频响曲线的影响

一、后腔 1.曲线说明 绿色&#xff1a;无调音纸 红色&#xff1a;使用Y3 粉色&#xff1a;使用Y6 2.结论 后腔是负责微调的&#xff0c;阻尼大小和低频升降成 反比。 阻 大 -> 低频 降低 阻 小 -> 低频 升高 二、前腔 1.曲线说明 红色&#xff1a;无调音纸 黄色&am…

信息安全与网络安全---引言

仅供参考 文章目录 一、计算机安全1.1 CIA三元组1.2 影响等级1.3 计算机安全的挑战 二、OSI安全体系结构2.1 安全攻击2.2 安全服务2.3 安全机制 三、基本安全设计准则四、攻击面和攻击树&#xff08;重点&#xff09;4.1 攻击面4.2 攻击树 五、习题与答案 一、计算机安全 &…

C# VB.NET取字符串中全角字符数量和半角字符数量

C# VB.NET中Tuple轻量级数据结构和固定长度数组-CSDN博客 https://blog.csdn.net/xiaoyao961/article/details/148872196 下面提供了三种统计字符串中全角和半角字符数量的方法&#xff0c;并进行了性能对比。 性能对比&#xff08;处理 100 万次 "Hello&#xff0c;世界…

CC++公司面试题[个人总结,持续更新中]

嵌入式初级面试题 姓名: 日期: 开始时间: (答题时间60分钟,答题过程中请不要上网查询资料,不可带走答卷) 1:设float a=2,b=4,c=3;,以下C语言表达式与代数式(a+b)+c计算结果不一致的是( )[3分] A.(a+b)c/2 B. (1/2)*(a+b)c C. (a+b)c*1/2 D.c/2(a+b) 2:为了向二进制文件尾部…

Qt QGraphics简述及例程 - QGraphicsView、QGraphicsScene和QGraphicsItem

Qt QGraphics简述及例程 引言一、简单例程二、关于坐标系问题 引言 QGraphics*是Qt框架中&#xff0c;主要用于处理2D图形项的显示、交互和管理的模块&#xff0c;包括QGraphicsView、QGraphicsScene和QGraphicsItem。提供了一套高效的场景-视图架构&#xff0c;适合开发复杂的…

代码随想录打卡第一天

文章讲解&#xff1a;代码随想录 视频讲解&#xff1a;手把手带你撕出正确的二分法 | 二分查找法 | 二分搜索法 | LeetCode&#xff1a;704. 二分查找_哔哩哔哩_bilibili class Solution { public:int search(vector<int>& nums, int target) {int left0;//左边界int…

时序数据库全面解析与对比

文章目录 1. 时序数据库概述1.1 时序数据特点1.2 时序数据库核心功能 2. 主流时序数据库对比2.1 InfluxDB2.2 Prometheus2.3 TimescaleDB2.4 OpenTSDB2.5 TDengine 3. 全方位对比3.1 功能对比3.2 性能对比3.3 适用场景对比3.4 社区与生态 4. 选型建议4.1 根据数据规模选择4.2 根…

【STM32CubeMX】ST官网MCU固件库下载及安装

用STM32CubeMX自带的Updater更新固件包会遇到各种幺蛾子&#xff08;如下图所示&#xff09;&#xff0c;所以干脆自己下载固件包&#xff0c;快速升级固件。 1. ST官网搜索你需要的MCU型号&#xff0c;并选择需要的固件版本&#xff0c;我这里是H7的MCU所以就找H7&#xff08;…

青少年编程与数学 01-012 通用应用软件简介 13 网上学习资源

青少年编程与数学 01-012 通用应用软件简介 13 网上学习资源 一、什么是网上学习资源&#xff08;一&#xff09;网上学习资源的基本定义&#xff08;二&#xff09;网上学习资源的工作原理&#xff08;三&#xff09;网上学习资源的类型 二、网上学习资源的重要意义&#xff0…

Python Selenium 忽略证书错误

文章目录 Python Selenium 忽略证书错误和忽略&#x1f527; **一、忽略 SSL 证书错误**1. **基础配置&#xff08;适用于 Chrome/Firefox&#xff09;**2. **高级场景&#xff1a;指定证书指纹**3. **浏览器兼容方案** &#x1f507; **二、隐藏 DevTools 监听提示**1. **禁用…

YOLOv8模型在RDK5开发板上的部署指南:.pt到.bin转换与优化实践

以下是针对在RDK5开发板(基于NVIDIA Jetson Orin平台)部署YOLOv8模型的详细技术指南,涵盖从模型转换、优化到部署的全流程: YOLOv8模型在RDK5开发板上的部署指南:.pt到.bin转换与优化实践 ——基于TensorRT的高性能嵌入式部署方案 第一章:技术背景与核心概念 1.1 RDK5开…

内网横向-工作流

一、信息收集阶段 操作 工具 / 命令 说明 系统基础信息采集 systeminfo、whoami /user 查看系统版本、用户 SID 等 域内用户 / 组查询 net user /domain、net group "domain admins" /domain 列出域用户及管理员组 域控及网络结构探测 nltest /dsgetdc、ip…

个人日记本小程序开发方案(使用IntelliJ IDEA)

个人日记本小程序开发方案(使用IntelliJ IDEA) 一、项目创建与环境配置 1. 新建项目 打开IDEA → New Project → JavaFX选择JDK 11+版本添加必要依赖:<!-- pom.xml --> <dependencies><dependency><groupId

react快速开始项目模板

代码仓库 gitee 创建项目 首先保证安装了node, 然后使用vite创建项目 vite npm create vite react-learn cd react-learn npm i 目录结构 一个完整的前端项目需要: 状态管理 在全局维护共有的状态(数据), 让页面组件之间共享数据, 我们使用pinia路由 路由让页面之间可以…

scrapy+django+pyecharts+mysql 实现西安游客行为分析系统大屏_用户画像_空间分析_路线智能推荐

项目地址 link 此处展示部分结果 思路 描述性统计 可视化大屏 用户画像&#xff08;聚类&#xff0c;情感分析&#xff09; 空间分析

AC-DC-AC间接变频电源设计方案(工频50Hz→20KHz)

AC-DC-AC间接变频电源设计方案(工频50Hz→20KHz) 一、方案分析与选择 1. 可选电路结构分析 方案1:二极管整流+Boost PFC+全桥逆变 优点: 输入功率因数高(>0.99)直流电压稳定可控输出波形质量好缺点: 电路复杂度较高成本相对较高方案2:晶闸管相控整流+电容滤波+半…

七天学完十大机器学习经典算法-09.梯度提升算法:预测艺术的精进之道

接上一篇《七天学完十大机器学习经典算法-08.K均值聚类&#xff1a;无监督学习的万能分箱术》 想象你在教一个学生解决复杂数学题&#xff1a;先让他做基础题&#xff0c;然后针对错误部分强化练习&#xff0c;再针对新错误继续训练...如此反复精进&#xff0c;直到完美掌握——…

数据库(MYsql)

一、Mysql概述 数据库&#xff1a;存储数据的仓库 &#xff0c;数据是有组织的进行存储 数据库管理系统&#xff1a;操纵和管理数据库的大型软件&#xff08;BBMS&#xff09; SQL&#xff1a;定义了一套操作关系型数据库统一标准&#xff0c;操作关系型数据库的编程语言 数…

【SpringBoot】Spring Boot + RESTful 技术实战指南

在当今的软件开发领域&#xff0c;Spring Boot 与 RESTful API 的结合已成为构建高效、可扩展 Web 应用的标配。本文将通过一个完整的项目示例&#xff0c;从知识铺垫到部署上线&#xff0c;带你一步步掌握 Spring Boot RESTful 的开发流程。 一、知识铺垫 1.1 Spring Boot …

安卓中静态和动态添加子 View 到容器

1.静态添加子View 在XML布局文件中直接定义子View&#xff1a; <!-- activity_main.xml --> <LinearLayoutxmlns:android"http://schemas.android.com/apk/res/android"android:id"id/container"android:layout_width"match_parent"a…