Sutherland-Hodgman polygon clipping: Difference between revisions

Content added Content deleted
Line 3,299: Line 3,299:
=={{header|Modula-2}}==
=={{header|Modula-2}}==
{{trans|ATS}}
{{trans|ATS}}
{{works with|GNU Modula-2|13.0.0 20220926 (experimental)}}
<syntaxhighlight lang="modula2">
<syntaxhighlight lang="modula2">
(* Sutherland-Hodgman polygon clipping, for ISO Modula-2. *)
(* Sutherland-Hodgman polygon clipping, for ISO Modula-2. *)
Line 3,605: Line 3,606:
END Sutherland_Hodgman_Task.
END Sutherland_Hodgman_Task.
</syntaxhighlight>
</syntaxhighlight>
{{out}}
<pre>gm2 sutherland_hodgman_task.mod && ./a.out
(100.0000, 116.6667)
(125.0000, 100.0000)
(275.0000, 100.0000)
(300.0000, 116.6667)
(300.0000, 300.0000)
(250.0000, 300.0000)
(200.0000, 250.0000)
(175.0000, 300.0000)
(125.0000, 300.0000)
Wrote sutherland-hodgman.eps</pre>
[[File:Sutherland-hodgman-from-mod2.png|alt=Sutherland-Hodgman task polygons from Modula-2.]]


=={{header|Nim}}==
=={{header|Nim}}==