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

伊犁北京网站建设青岛关键词搜索排名

伊犁北京网站建设,青岛关键词搜索排名,陕西高速公路建设集团公司网站,天猫 网站建设 靠谱前言:在很多情况下,需要根据点云来拟合球体,本博文主要介绍各种方法的拟合情况及优缺点,希望对各位小伙伴有所帮助! 目录 1. vtkFitImplicitFunction进行球拟合 2. 四点求解球 1. vtkFitImplicitFunction进行球拟合 …

前言:在很多情况下,需要根据点云来拟合球体,本博文主要介绍各种方法的拟合情况及优缺点,希望对各位小伙伴有所帮助!

目录

1. vtkFitImplicitFunction进行球拟合

2. 四点求解球


1. vtkFitImplicitFunction进行球拟合

缺点:需要输入待拟合球的半径和结构,即在已知最优解的情况下求解。

vtkMath::RandomSeed(4355412); // for test result consistencydouble radius = 1.0;
vtkSmartPointer<vtkBoundedPointSource> points =vtkSmartPointer<vtkBoundedPointSource>::New();
points->SetNumberOfPoints(1000000);
points->SetBounds(-2.0, 2.0, -2.0, 2.0, -2.0, 2.0);
points->Update();vtkSmartPointer<vtkSphere> sphere =vtkSmartPointer<vtkSphere>::New();
sphere->SetRadius(radius*2);vtkSmartPointer<vtkFitImplicitFunction> fit =vtkSmartPointer<vtkFitImplicitFunction>::New();
fit->SetInputConnection(points->GetOutputPort());
fit->SetImplicitFunction(sphere);
fit->SetThreshold(.01);
fit->Update();
std::cout << fit->GetOutput()->GetNumberOfPoints() << " out of "<< points->GetNumberOfPoints() << " points are within "<< fit->GetThreshold() << " of the implicit function" << std::endl;vtkSmartPointer<vtkSphereSource> sphereSource =vtkSmartPointer<vtkSphereSource>::New();
sphereSource->SetRadius(radius * .05);vtkSmartPointer<vtkGlyph3D> glyph3D =vtkSmartPointer<vtkGlyph3D>::New();
glyph3D->SetInputConnection(fit->GetOutputPort());
glyph3D->SetSourceConnection(sphereSource->GetOutputPort());
glyph3D->ScalingOff();
glyph3D->Update();vtkSmartPointer<vtkPolyDataMapper> glyph3DMapper =vtkSmartPointer<vtkPolyDataMapper>::New();
glyph3DMapper->SetInputConnection(glyph3D->GetOutputPort());vtkSmartPointer<vtkActor> glyph3DActor =vtkSmartPointer<vtkActor>::New();
glyph3DActor->SetMapper(glyph3DMapper);
glyph3DActor->GetProperty()->SetColor(0.8900, 0.8100, 0.3400);m_viewer->renderWindow()->GetRenderers()->GetFirstRenderer()->AddActor(glyph3DActor);
m_viewer->renderWindow()->Render();

2. 四点求解球

缺点:要求输入的四点为精确球上的点;否则计算错误。

void fitSphere(vtkPoints* points, double center[3], double& radius) {double p1[3];double p2[3];double p3[3];double p4[3];points->GetPoint(0, p1);points->GetPoint(1, p2);points->GetPoint(2, p3);points->GetPoint(3, p4);double a = p1[0] - p2[0], b = p1[1] - p2[1], c = p1[2] - p2[2];double a1 = p3[0] - p4[0], b1 = p3[1] - p4[1], c1 = p3[2] - p3[2];double a2 = p2[0] - p3[0], b2 = p2[1] - p3[1], c2 = p2[2] - p3[2];double D = a * b1 * c2 + a2 * b * c1 + c * a1 * b2 - (a2 * b1 * c + a1 * b * c2 + a * b2 * c1);if (D == 0){return;}double A = p1[0] * p1[0] - p2[0] * p2[0];double B = p1[1] * p1[1] - p2[1] * p2[1];double C = p1[2] * p1[2] - p2[2] * p2[2];double A1 = p3[0] * p3[0] - p4[0] * p4[0];double B1 = p3[1] * p3[1] - p4[1] * p4[1];double C1 = p3[2] * p3[2] - p4[2] * p4[2];double A2 = p2[0] * p2[0] - p3[0] * p3[0];double B2 = p2[1] * p2[1] - p3[1] * p3[1];double C2 = p2[2] * p2[2] - p3[2] * p3[2];double P = (A + B + C) / 2;double Q = (A1 + B1 + C1) / 2;double R = (A2 + B2 + C2) / 2;double Dx = P * b1 * c2 + b * c1 * R + c * Q * b2 - (c * b1 * R + P * c1 * b2 + Q * b * c2);double Dy = a * Q * c2 + P * c1 * a2 + c * a1 * R - (c * Q * a2 + a * c1 * R + c2 * P * a1);double Dz = a * b1 * R + b * Q * a2 + P * a1 * b2 - (a2 * b1 * P + a * Q * b2 + R * b * a1);center[0] = Dx / D;center[1] = Dy / D;center[2] = Dz / D;radius = sqrt((p1[0] - center[0]) * (p1[0] - center[0]) +(p1[1] - center[1]) * (p1[1] - center[1]) +(p1[2] - center[2]) * (p1[2] - center[2]));}

http://www.hkea.cn/news/287855/

相关文章:

  • 团队做网站分工搜索引擎案例分析结论
  • 企业网站的建设过程做整站优化
  • 最简单的cms网站怎么做惠州抖音seo
  • 做网站销售怎么开发客户自己做一个网站
  • wordpress发布文章空白整站优化 mail
  • vs怎么做网站的首页seo知识培训
  • 网站建设的一般步骤包括知乎关键词排名工具
  • 网页设计怎样做一个网页seo软件哪个好
  • 销售性网站建设需求seo案例
  • 企业怎样选择域名做网站电脑突然多了windows优化大师
  • 网站一元空间有哪些呀品牌策划方案范文
  • 最便宜的网站建设企点
  • 网站代码加密深圳新闻今日最新
  • 不要钱做网站软件网站seo优化效果
  • 公司做网站提供产品加盟费互联网销售怎么做
  • 视频网站开发架构百度app最新版本
  • 网站上内容列表怎么做的网站模板中心
  • 上海利恩建设集团有限公司网站国内好用的搜索引擎
  • 网站模板论坛今日重大军事新闻
  • 昆山自适应网站建设电商平台的营销方式
  • 盘龙区网站建设外包高级搜索引擎技巧
  • 什么做的网站吗58百度搜索引擎
  • wordpress 企业站开发口碑营销的概念
  • 广州免费核酸检测点东莞seo项目优化方法
  • 学风建设网站版块设计个人网站
  • 网站底部连接怎么做福州seo推广
  • 生猪价格今日猪价行情关键词优化是什么工作
  • 网站建设公司下载搜索引擎查询
  • 韩国吃秀在哪个网站做直播企业宣传
  • 江西网站建设成都百度