I am interpreting a value based on the amount an object is "facing" a wall in a performance critical computer simulation. I take the dot product between the object's forward vector and the negated normal of the wall, so if it's facing the wall 100%, the function returns 1, and if 100% parallel to the wall, it returns 0.
I want to scale another value based on the return value of this function. I want it to scale linearly within the domain of this function from 100% facing, to 100% parallel.
But as you know, the dot product is based on cosine, so the range of return values will be non-linear. When the vector is 50% facing and 50% parallel, it will return something around 0.7, but I want it to return 0.5. If it is 75% facing and 25% parallel, it should return 0.75.
I know this involves slerping, but dont know how to apply it.
* I already have the dot product, so I would like to avoid further calculations, like arrcos to get the angle, which is expensive.
* This is not a quaternion situation either. I just want to distribute the output range of the dotproduct linearly between 0 and 1.
Please help, thanks.