The task is as follows: arbitrary four points are given in the Cartesian coordinate system and they form a convex quadrilateral. It is necessary to draw all the points that are formed by a rectangular grid stretched on this formed quadrilateral. The difficulty is that the type used to create the grid is double (double precision real number).
Problems:
- Print all non-repeating grid points, it is reasonable to distribute their internal and external points (internal - what is inside the quadrilateral, external - lie on the border).
- It is necessary to take into account that external points can be formed by the equation y = 2 or x = 5.
- It is necessary to take into account that two cycles do not give all points. It is necessary to take into account all these 4 points.
- There is a problem when the step is very large, an anomaly may occur - in that the lines formed by x and y do not intersect, but they are external.
Please help by listing the program!
And any step! Thanks in advance.