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

Shortest path 代码

Project

https://graphics.cs.utah.edu/research/projects/shortest-path-to-boundary/

Build and Debug

Fork:(在Win10上)
https://github.com/chunleili/Shortest-Path-to-Boundary-for-Self-Intersecting-Meshes

commit hash
d3160168d2b6a58188d12e6cd959da0ac9b56e95

./vscode/launch.json
{
“version”: “0.2.0”,
“configurations”: [
{
“name”: “(msvc) Launch”,
“type”: “cppvsdbg”,
“request”: “launch”,
// Resolved by CMake Tools:
“program”: “ w o r k s p a c e F o l d e r / b u i l d / D e b u g / S h o r t e s t − P a t h − T e s t . e x e " , " a r g s " : [ " T e s t D a t a / P a r a m e t e r s . j s o n " , " T e s t D a t a / I n t e r s e c t i n g S h a p e . t " ] , " s t o p A t E n t r y " : t r u e , " c w d " : " {workspaceFolder}/build/Debug/Shortest-Path-Test.exe", "args": ["TestData/Parameters.json", "TestData/IntersectingShape.t"], "stopAtEntry": true, "cwd": " workspaceFolder/build/Debug/ShortestPathTest.exe","args":["TestData/Parameters.json","TestData/IntersectingShape.t"],"stopAtEntry":true,"cwd":"{workspaceFolder}”,
“environment”: [
{
// add the directory where our target was built to the PATHs
// it gets resolved by CMake Tools:
“name”: “PATH”,
“value”: “ e n v : P A T H : {env:PATH}: env:PATH:{command:cmake.getLaunchTargetDirectory}”
},
],
“console”: “internalConsole”,
}
]
}

Code Explain

Test.cpp中是入口main函数
40行之前是初始化(mesh和param)
在这个for loop当中查找每个Vert的最近点。

在这里插入图片描述

关键的函数
dcd.vertexCollisionDetection(iV, meshId, &colDecResult);
用BVH做碰撞检测。(Broad Phase)

dcd.closestPointQuery(&colDecResult, &queryResult);
用碰撞检测后的结果查找最近点。(Narrow Phase)

Broad Phase:vertexCollisionDetection

核心就rtcPointQuery,调用的是intel embree的API

D:\Dev\Shortest-Path-to-Boundary-for-Self-Intersecting-Meshes\ShortestPath\CollisionDetector\DiscreteCollisionDetector.cpp
L598

https://github.com/chunleili/Shortest-Path-to-Boundary-for-Self-Intersecting-Meshes/blob/5be890b7775dc92cde410895d124c81162bee978/ShortestPath/CollisionDetector/DiscreteCollisionDetector.cpp#L598

在这里插入图片描述

在这里插入图片描述

Narrow Phase: closestPointQuery

https://github.com/chunleili/Shortest-Path-to-Boundary-for-Self-Intersecting-Meshes/blob/5be890b7775dc92cde410895d124c81162bee978/ShortestPath/CollisionDetector/DiscreteCollisionDetector.cpp#L621

在这里插入图片描述

其中较为关键的是idTetIntersected,表示相交的四面体的id。intersectedTets则是所有相交四面的的array。

执行查询最近点:
rtcPointQuery(surfaceMeshScenes[idTMIntersected], &query, &context, nullptr, (void*)pClosestPtResult); 仍然是用API来查询点。目的是针对某个表面网格(surfaceMeshScenes[idTMIntersected]),找到距离查询点最近的表面点,并把结果存储在 pClosestPtResult 中。
在这里插入图片描述

接下来是存储找到的最近点的信息:其face id, 坐标, barycentric coord.
在这里插入图片描述

另外,rtc是根据注册机制自动调用一些hook函数的例如比较关键的是

其中checkTetTraverse这个flag表示检查四面体的遍历,正是文中提到的连接性检测(valid path)
在这里插入图片描述

相关文章:

  • 【深度学习:进阶篇】--2.3.深度学习正则化
  • Magentic-UI:人机协作的网页自动化革命
  • 亡羊补牢与持续改进 - SRE 的安全日志、审计与事件响应
  • 怎么开机自动启动vscode项目
  • 【Deepseek 学网络互联】跨节点通信global 和节点内通信CLAN保序
  • 如何打造一份出色的技术文档?
  • K8S StatefulSet 快速开始
  • Spring Boot的启动流程,以及各个扩展点的执行顺序
  • STM32F407VET6学习笔记8:UART5串口接收中断的Cubemx配置
  • 美创专家分享医疗数据安全分类分级实践与探索
  • React 第五十节 Router 中useNavigationType的使用详细介绍
  • stm32 + ads1292心率检测报警设置上下限
  • python打卡第36天
  • Linux线程池(上)(33)
  • 驱动开发学习20250529
  • 前端开发中 <> 符号解析问题全解:React、Vue 与 UniApp 场景分析与解决方案
  • 前端的面试笔记——Vue2/3(一)Vue2和Vue3的区别和优缺点
  • ai如何绘制mg人物眉毛
  • 爬虫到智能数据分析:Bright Data × Kimi 智能洞察亚马逊电商产品销售潜力
  • C++ —(详述c++特性)
  • jsp和php哪个做网站快/百度竞价排名广告
  • 珠海网站建设搭建/seo要点
  • 磁县网站推广/广告联盟app
  • 朝鲜族做的电影网站/友情链接平台赚钱吗
  • 做a免费网站/谈谈你对网络营销的认识
  • 天津做公司的网站/南宁seo优化公司排名