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:

  1. 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).
  2. It is necessary to take into account that external points can be formed by the equation y = 2 or x = 5.
  3. 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.
  4. 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.

    1 answer 1

    I don’t know if I understood correctly, but I think the leftmost point will be the first (zero) column, counting from one point to the rightmost point, this is the last column, the same with the top and bottom, here’s a rectangular grid and ready, next two cycles to get them out.