CGAL 三点确定一个平面

一、概述

  CGAL中有现成的函数能够实现三个点确定一个平面。

二、代码实现

#include <iostream>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polygon_2_algorithms.h>
#include <CGAL/Plane_3.h>
#include <CGAL/Polygon_2.h>
using namespace std;

typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3                                     Point;
typedef Kernel::Plane_3                                     Plane;




int main()
{
	Point P1(-0.9566, 0.3566, 0.0);
	Point P2(0.9974, 0.21207, 0.0);
	Point P3(0.0235, -0.3286, 0.0);

	Plane p3(P1, P2, P3);    
	vector<Plane> planeFit;
	planeFit.push_back(p3);
	double A = planeFit[0].a();
	double B = planeFit[0].b();
	double C = planeFit[0].c();
	double D = planeFit[0].d();

	cout << "平面的系数为:" << "\n A = " << A << "\n B = " << B << "\n C = " << C << "\n D = " << D << endl;
	return 0;
}

三、结果展示

1、实验数据

在这里插入图片描述

2、CloudCompare计算结果

0,0,1

在这里插入图片描述

3、矩阵分解计算结果

在这里插入图片描述

4、PCL计算结果

代码见:PCL 三点确定一个平面原理及代码实现

平面方程系数:
a=0
b=0
c=-1
d=-0

5、CGAL计算结果

平面的系数为:
 A = 0
 B = 0
 C = -1.19723
 D = 0

可以看出,CGAL计算结果,法向量未进行归一化。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

点云侠

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值