Skip to main content

I have a a set of point objects with a rotation attribute. These are later to be turned into labels. Each label point has a corresponding reference point that it needs to be facing away from. That's where the "behind" and "front" come into the picture.

A quick example of what I want to do:

Say I have a label point rotated to 20 degrees, and the reference point is at an angle of 50 degrees. This means that the reference is in the "forward" 180 degree sector and that the label needs to be flipped/rotated 180 degrees.

The above example is straightforward but the fact that this is a rotating object that jumps from 360 degrees to 0 has me pulling my hairs.

I need help with the math, and syntax. I have tried to incorporate a modulus 360 but have not managed to get it working. I am using a Testfilter to detect the relations between the points. What should the formula look like?

Let assume that the rotation of the label is R and the angle to the reference point is A. I want to measure if the angle A is between R+90 and R-90.

Hi @aron 

you can easily find if the angle between A and R is <= 90 degrees (I "flipped" your condition):

@cos(A-R) >= 0

As @cos requires the argument to be in radians and your data is in degrees, the condition should look like:

@cos((A-R)/180*3.14) >= 0

Would this be enough to solve the problem? If not, let's think deeper :)


Thanks @LenaAtSafe,

 

This answers my question!

 


Reply