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

使用 VTK 中的单元定位器来查找最近的点


开发环境:

  1. Windows 11 家庭中文版
  2. Microsoft Visual Studio Community 2019
  3. VTK-9.3.0.rc0
  4. vtk-example

demo解决问题:使用 VTK 中的单元定位器来查找最近的点
在这里插入图片描述

关键点:

  1. 创建了一个球体数据源,并使用它构建了一个单元定位器(cell locator)。
  2. 通过 FindClosestPoint 方法查找了测试点的最近点,并输出了最近点的坐标、到最近点的距离的平方以及包含最近点的单元格的 ID。

prj name: CellLocator

#include <vtkCellLocator.h>
#include <vtkNew.h>
#include <vtkSphereSource.h>int main(int, char*[])
{vtkNew<vtkSphereSource> sphereSource;sphereSource->Update();// Create the treevtkNew<vtkCellLocator> cellLocator;cellLocator->SetDataSet(sphereSource->GetOutput());cellLocator->BuildLocator();double testPoint[3] = {2.0, 0.0, 0.0};// Find the closest points to TestPointdouble closestPoint[3];   // the coordinates of the closest point will be// returned heredouble closestPointDist2; // the squared distance to the closest point will be// returned herevtkIdType cellId; // the cell id of the cell containing the closest point will// be returned hereint subId;        // this is rarely used (in triangle strips only, I believe)cellLocator->FindClosestPoint(testPoint, closestPoint, cellId, subId,closestPointDist2);std::cout << "Coordinates of closest point: " << closestPoint[0] << " "<< closestPoint[1] << " " << closestPoint[2] << std::endl;std::cout << "Squared distance to closest point: " << closestPointDist2<< std::endl;std::cout << "CellId: " << cellId << std::endl;return EXIT_SUCCESS;
}
http://www.lryc.cn/news/295387.html

相关文章:

  • 时序预测 | MATLAB实现基于CNN-LSTM-AdaBoost卷积长短期记忆网络结合AdaBoost时间序列预测
  • Xcode 15 及以上版本:libarclite 库缺少问题
  • Spring设计模式之单例模式
  • Fink CDC数据同步(二)MySQL数据同步
  • JavaWeb后端开发(第一期):Maven基础、Maven的安装配置、如何创建maven项目模块、maven的生命周期
  • Windows SDK(四)鼠标和键盘消息处理
  • LabVIEW汽车自燃监测预警系统
  • 数据图表方案,企业视频生产数据可视化
  • 【HarmonyOS应用开发】APP应用的通知(十五)
  • 开启一个服务,将服务器指定的文件读取,传播到网上其他终端
  • nii convert to 2D image【python】
  • C语言指针学习 之 指针是什么
  • 【文本到上下文 #10】探索地平线:GPT 和 NLP 中大型语言模型的未来
  • (四)elasticsearch 源码之索引流程分析
  • 飞天使-k8s知识点16-kubernetes实操1-pod
  • 【gcc】webrtc发送侧 基于丢包更新码率
  • 数字经济的未来:探索Web3的商业模式
  • Centos7部署MetaBase-v0.48.3
  • 【计算机网络】Socket的SO_TIMEOUT与连接超时时间
  • 解密 ARMS 持续剖析:如何用一个全新视角洞察应用的性能瓶颈?
  • 【OJ比赛日历】春节快乐 #02.10-02.16 #9场
  • 前端下载文件有哪些方式
  • vscode预览github上的markdown效果
  • 使用PaddleNLP识别垃圾邮件:用BERT做中文邮件内容分类,验证集准确率高达99.6%以上(附公开数据集)
  • 在bash或脚本中,如何并行执行命令或任务(命令行、parallel、make)
  • 拼音笔记笔记
  • 13. Threejs案例-绘制3D文字
  • clickhouse清理日志。
  • JS中实现继承
  • spring boot学习第九篇:操作mongo的集合和集合中的数据