|Online Judge||Problem Set||Authors||Online Contests||User|
Initialize intersectionCount to zero. For each edge e of Q, defined by p1 and p2, check the following: If p1y < Py and p2y < Py, do nothing (both points are in region R1). If p1y >= Py and p2y >= Py, do nothing (both points are in region R2). Otherwise, calculate the intersection point S of edge e and the line y = Py. If Sx >= Px, increment intersectionCount. After all edges have been checked, P is inside Q, if and only if intersectionCount is odd.
Post your reply here:
Home Page Go Back To top
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator