简体   繁体   中英

Finding two "bounding" vertices of a given polygon w.r.t. a known (light source) point

Context : I apologize in advance of the non-rigorousness of the question, as it turned out to be harder to formulate than I originally thought. I'm going over different ways to find two "bounding" vertices in 2D space of a given polygon wrt to a known point. In this context by "bounding" vertex I mean the situation best described by this image . Ie let p be the known point and imagine that we place a light source at p . Then the bounding vertices of a polygon P(x_1,...,x_n) are those two points v_1, v_2 for which the connected line segment l(v_1, v_2) blocks the light from p in the same way as the whole polygon P(x_1,...,x_n) does.

Question : I already have a solution which compares vertices of P by the rotation angle wrt to p . However this method requires using the trigonometric atan2 function, so I'm interested in knowing is there a computationally cheaper method.

Choose an arbitrary starting vertex, let A. Now choose another, let B, and check if it lies to the left of FA. If yes, continue with FB and so on. Do this for left and right simultaneously.

The LeftOf test is a mere sign of a 2x2 determinant.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM