Tag Info

Hot answers tagged


No conditions, you don't need normalised vectors, a single trig function: Vector2 pc = p - c; float crossp = pc.x * ray.direction.y - pc.y * ray.direction.x; float dotp = pc.x * ray.direction.x + pc.y * ray.direction.y; return Math.atan2(crossp, dotp); Here is the explanation. A fast summary: Cross product between two vectors is the same as sin(theta) * ...

Only top voted, non community-wiki answers of a minimum length are eligible