Program Lab_6_1; uses crt, Types, Poligon, IOGeom, GrGeom, Punct; (**************************************** * Apartenenta la domeniu: * Poligon convex ****************************************) const filein = 'Convex.txt'; var Polig: TPoligon; t: TPunct; begin with Polig do begin clrscr; writeln; { Citirea datelor din fisierul , daca exista } nr := readf_puncte(filein, p); { Citirea coordonatelor punctelor de la tastatura } if nr = 0 then begin writeln('Introdu nr de puncte: '); readln(nr); writeln('Sa incerc sa generez un poligon convex? (D/N)'); if UpCase(ReadKey) = 'D' then nr := gen_polig_conv(p, nr, ZeroP) else begin writeln('Introdu coordonatele varfurilor poligonului convex: '); read_puncte(p, nr); end; {Salvarea punctelor in fisier} writef_puncte(filein, p, nr); end; { Afisarea coordonatelor } clrscr; write_puncte(p, nr); {Punctul de verificat} writeln; writeln('Scrie coordonatele punctului de verifica la apartenenta:'); read_punct(t, 'p'); { Afisarea rezultatului } if apart_conv(p, nr, t) then writeln('Apartine!') else writeln('Nu apartine!'); readkey; InitGr(0); graph.setcolor(blue); drow_poligon(p, nr); drow_set_puncte(p, nr, GREEN); drow_punct(t, WHITE); drow_cerc(t, 5); delay(1000); t.x := -MidX/Ratio; with t do while (x < MidX/Ratio) do begin y := -MidY/Ratio; while (y < MidY/Ratio) do begin if apart_conv(p, nr, t) then drow_punct(t, YELLOW) else drow_punct(t, RED); y := y + 1/Ratio; end; x := x + 1/Ratio; end; readkey; end end.