Before revision:  Initially, we solve this problem for two given points s, t and a query point q. Then, the proposed solution would be extended to a general case for three arbitrary query points s, t and q. In the former, we propose an algorithm with O(n) preprocessing time.
After revision:  Initially, we solve this problem for two given points s, t and a query point q. Then, the proposed solution is extended to a general case for three arbitrary query points s, t and q. In the former, we propose an algorithm with O(n) preprocessing time.