正交視圖三維重建 筆記 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
英文地址,請注明出處:http://en.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…