I have a set of points (std::pair
of double
) on a 2D plan and I want to apply a mask (wich is a closed contour : square, circle, polygon...) to it. If a point is contained by the mask (or under the mask), it does not appear, otherwise it appears.
For example, if the mask is a rectangle with (m_x,m_y)
the coordinates of its top-left corner and m_width
and m_height
its width and height, a point would be contained in the mask (and should not appear) if :
if (x >= m_x && x <= m_x + m_width && y >= m_y && y <= m_y + m_height)
return true;
For simple shapes (rectangle, circle) it is not that difficult, but how would you do it/what would you use to consider more difficult shapes like polygons ? Is Qt (5.6) doing that ? Or should I use something like OpenCv ?
EDIT 1
Qt can do it with the QPolygonF class (thanks Aurélien) but do you know if the std is doing that ? We implemented our data libraries without any other library than the std, if we can continue it would be great, if not it's not a problem.