Ramer-Douglas-Peucker line simplification: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: elided the use of a separate assignment for dressing up the output (points) with parenthesis.)
m (→‎{{header|REXX}}: corrected spelling of the name: Peucker.)
Line 787: Line 787:
=={{header|REXX}}==
=={{header|REXX}}==
The computation for the   ''perpendicular distance''   was taken from the   '''GO'''   example.
The computation for the   ''perpendicular distance''   was taken from the   '''GO'''   example.
<lang rexx>/*REXX program uses the Ramer─Douglas─Peuker (RDP) line simplification algorithm for*/
<lang rexx>/*REXX program uses the Ramer─Douglas─Peucker (RDP) line simplification algorithm for*/
/*───────────────────────────── reducing the number of points used to define its shape. */
/*───────────────────────────── reducing the number of points used to define its shape. */
parse arg epsilon pts /*obtain optional arguments from the CL*/
parse arg epsilon pts /*obtain optional arguments from the CL*/
Line 795: Line 795:
say ' error threshold: ' epsilon /*echo the error threshold to the term.*/
say ' error threshold: ' epsilon /*echo the error threshold to the term.*/
say ' points specified: ' pts /* " " shape points " " " */
say ' points specified: ' pts /* " " shape points " " " */
$= RDP(pts) /*invoke the Ramer─Douglas─Peuker func.*/
$= RDP(pts) /*invoke Ramer─Douglas─Peucker function*/
say 'points simplified: ' rez($) /*display points with () ───► terminal.*/
say 'points simplified: ' rez($) /*display points with () ───► terminal.*/
exit /*stick a fork in it, we're all done. */
exit /*stick a fork in it, we're all done. */