|more useful options|
Re: Some simple 2d game-related maths questionsby pajout (Curate)
|on Aug 28, 2008 at 13:03 UTC||Need Help??|
It is funny to reinvent the wheel sometimes :>)
I suppose that position of the line is constant and the radius of moving circle is constant too. In that case you can define that line by formula
(Note: vector (a,b) is perpendicular to the line.)
If you consider left side of  as function,
you can easily see that f(X,Y) = 0 only if point X,Y is on the line, and, f(X,Y) > 0 for each points of one half-plane defined by the line, and, f(X,Y) < 0 for each point of the other half-plane.
Consequently, it is directly usable for testing if two points are on the same half-plane. But you want to test something different a bit. Let you construct two helper lines parallel to the  line, both in the distance equal to circle radius, g(X,Y) in positive half-plane and h(X,Y) in negative half-plane of the , with the same "orientation" of positivity/negativity. You can construct these functions just once when program starts, regardless on the position of the circle.
Let (X1,Y1) is position of the circle center before movement and (X2, Y2) is position after movement. Exploring signs of f(X1,Y1), f(X2,Y2), g(X1,Y1), g(X2,Y2), h(X1,Y1), h(X2,Y2) will give you, what do you need.
I think it is more suitable than some non-linear expressions.