#### Dirac

##### 22710180

- Reaction score
- 147

JASS:

**Example:**

Lets say there's a cone facing 0 degrees with opening 70, and we want to know if the angle 45 is inside of it

[ljass]Cone(45,0,70)[/ljass] returns true because 45 happens to be inside that cone

**Explanation:**

[ljass]Cos(45-0) - > Cos(45) == 0.707[/ljass]

[ljass]Cos(70) == 0.342[/ljass]

The result of the Cosine of the difference of both angles is greater than the opening's Cosine, the function returns true.

"Cos" is a function that evaluates the position of an angle according to it's image in the X axis.

So now imagine that the cone's aperture is 0, and Cos(0) == 1, and that Cos can't go beyond 1 and can't got below -1... And the function evaluates if the difference is greater than or equal to the opening's cosine, that means that because there's no greater value than 1, the only possibility to return true is being equal to 1.

Now imagine that the cone's opening is 60, and Cos(60) == 0.5, also that Cos(60) == Cos(360-60) it has a better chance to be over 0.5. The greater the cone operture the greater the chance for the difference of the angles to be greater to it, thats because 0 opening means 1 and 180 aperture means -1.

*Please credit if used.*