角度遮挡算法 [英] Angle occlusion algorithm

查看:150
本文介绍了角度遮挡算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个向量形成一个特定的角度,该角度表示可见",在下图中以蓝色角度表示.

红色角表示阻止入射光的遮挡角".

我需要有效地计算紫光角,紫光角代表可见光相对于遮挡角的百分比,这会导致四种可能的情况,即部分遮挡(一侧或两侧)完全遮挡或完全没有遮挡.

考虑到蓝角可能只是一个PI,但遮挡角可能高达2PI,我无法找到一种有效的算法来完成这项非常具体的任务 >

两个角度都是从4个归一化向量中指定的,因此完全不需要使用角度,因为我只需要知道红色向量遮盖蓝色向量之间的面积/角度的百分比

解决方案

要确定角度段是否相交和相交,可以使用我的答案中所述的方法

The red angle represents an "occluding angle" that blocks incoming light.

I need to efficiently calculate the violet angle, which represents the percentage of the visible light against the occluding angle, which creates four possible cases depicted as partially occluded (one or two sides) fully occluded or no occlusion at all.

I've failed to find an efficient algorithm to do this very specific task, considering that the blue angle could be as big a just PI, but the occluding angle may be as much as 2PI, placed anywhere inside the circle

Edit: both angles are specified from 4 normalized vectors, it's not strictly needed to work with angles at all, since I just need to know what percentage of the area/angle between the blue vectors is occluded by the red vectors

解决方案

To determine whether angular segments do intersect and intersection type, you can use approach described in my answers here

a1 and a2 are ends of the first sector, b1 and b2 are ends of the second sector, ma and mb are bisectors, da and db are half-angles:

da = (a2 - a1)/ 2  
db = (b2 - b1)/ 2  
ma = (a2 + a1)/ 2  
mb = (b2 + b1)/ 2  
cda = Cos(da)
cdb = Cos(db)

To check whether intersection exists and what kind of intersection takes place, find 4 boolean values

 BStartInsideA = (Cos(ma - b1) >= cda)
 BEndInsideA  =  (Cos(ma - b2) >= cda)
 AStartInsideB = (Cos(mb - a1) >= cdb)
 AEndInsideB =   (Cos(mb - a2) >= cdb)

Linked answer discusses also problems of normalization of weird-defined arcs (perhaps not important for your case) and getting of binary code characterizing intersection type (important - in your case it is excluded interval)

这篇关于角度遮挡算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆