I am having three coordinate locations A(x1, y1), B(x2, y2) and C(x3, y3). A is the starting location, B is the end location and C is the arbitrary coordinate location. Now I want to calculate whether the end-location(B) at least 25% closer to the point-location(C) when compared to start-location(A).
Can someone write pseudocode for this problem?
This is simple vector geometry:
The squared distance d2 from A to B is (Ax - Bx)^2 + (Ay - By)^2
So B to C is 25% less than A to C if:
sqrt(d2(A,C)) * 0.75 >= sqrt(d2(B,C))
And simplified, so you dont need to deal with roots:
d2(A, C) * 0.75^2 >= d2(B, C)