Angle Occlusion Algorithm

I have two vectors forming a certain angle, which means what is “visible”, represented as a blue corner in the following figure.

The red corner is an "occlusal angle" that blocks incoming light.

I need to efficiently calculate the violet angle, which represents the percentage of visible light versus the occlusal angle, which creates four possible cases that are partially closed (one or two sides) are fully occluded or have no occlusion at all.

I was not able to find an effective algorithm for this very specific task, given that the blue angle can be as large as the PI, but the occlusal angle can be equal to 2PI placed anywhere inside the circle

enter image description here

Edit: both angles are indicated from 4 normalized vectors, this is not strictly necessary for working with angles in general, since I just need to know what percentage of the area / angle between the blue vectors overlaps with red vectors

+1
source share
1 answer

To determine if angular segments intersect and intersect, you can use the approach described in my answers here

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

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

To check if an intersection exists and which intersection is occurring, find 4 Boolean values

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

(, ) , ( - )

+3

Source: https://habr.com/ru/post/1668734/


All Articles