Cesium实现线段与贴地三角形交点的捕获 --Cesium.IntersectionTests.lineSegmentTriangle

27 篇文章 16 订阅
25 篇文章 2 订阅

 在Cesium开发中需要获取线段【line Segment】与地面三角形【Triangle】三条边的交点,查阅官方API文档说明,发现Cesium框架提供了 Cesium.IntersectionTests.lineSegmentTriangle()功能函数。但是在使用中无法获取交点。

被此问题困扰了两天,今天想到可能因为地球是个球体,所以贴地面是弧面,导致水平线段,不能与三角面相交。所以此处在三角面的三条边处,分别绘制垂直于地球平面的竖立着的三角面,分别求其交点,最终获取到了梦寐以求的交点处经纬度。

var IntersectionList = [];	
var IntersectionPoint = Cesium.IntersectionTests.lineSegmentTriangle(log_point1, log_point2, pois_no_hei[0], pois_no_hei[1], pois_hei[0], false);
if(IntersectionPoint != null)
{
		IntersectionList.push(IntersectionPoint);
		// console.log(IntersectionPoint);
}
		
IntersectionPoint = Cesium.IntersectionTests.lineSegmentTriangle(log_point1, log_point2, pois_no_hei[1], pois_no_hei[2], pois_hei[1], false);
if(IntersectionPoint != null)
{
		IntersectionList.push(IntersectionPoint);
		// console.log(IntersectionPoint);
}
IntersectionPoint = Cesium.IntersectionTests.lineSegmentTriangle(log_point1, log_point2, pois_no_hei[0], pois_no_hei[2], pois_hei[2], false);
	if(IntersectionPoint != null)
{
		IntersectionList.push(IntersectionPoint);
		// console.log(IntersectionPoint);
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值