When the line segments that form closed shape is given how to check whether the given point lies inside the diagram or not
for example
AB ,BC ,CD,DE,EA are the line segments given and i know the co-ordinates of endpoints each line segment . Now how to find whether a given point is inside the diagram or not ?
My approach: By using ray casting or winding number for checking whether the point is inside or not . But i am struck at "how to find the vertices of polygon"
You need to find the equations of your segments, and try parallel lines.
If a point is inside a triangle every line parallel to a side of triangle and passing through that point will intersect the other two sides at points between vertices.
On the other hand for a point outside the triangle one of the lines parallel to the three sides do not intersect the triangle at all.
Same is true for the pentagon.