Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #135647

Re: General routine for a polyline or a polygon

Date 2026-09-10 23:33 +1000
Subject Re: General routine for a polyline or a polygon
Newsgroups comp.lang.forth
References <117u1p9$1toc3$1@dont-email.me>
From dxf <dxforth@gmail.com>
Message-ID <6aa2b1a4$1@news.ausics.net> (permalink)
Organization Ausics - https://newsgroups.ausics.net

Show all headers | View raw


On 10/09/2026 8:46 pm, Hans Bezemer wrote:
> Can be used with any LINE command, as long as it draws a line between two absolute coordinates. ( x1 y1 x2 y2 --):

That was a 'star' effort!  Never had the patience for graphics myself to it's good
to see someone else do it.

1 fload xplgraph

6 value color

: line ( x1 y1 x2 y2 --)  2swap moveto color line ;  \ simulate using XPL graphics

\ General routine for a polyline or a polygon.  H. Bezemer
\
\ Can be used with any LINE command, as long as it draws a line between
\ two absolute coordinates. ( x1 y1 x2 y2 --):

\ : line cr rot >r -rot r> rot 0 .r ." ," . 0 .r ." ," . ; \ dummy line word

variable 'lineto \ stores address of (lineto)

:noname drop drop drop drop ; constant (cancel) ( x1 y1 x2 y2 --)
:noname 2dup 2>r line 2r> 'lineto @ ; constant (lineto) ( x1 y1 x2 y2 -- x2 y2 xt)
:noname 2dup (lineto) ; constant (moveto) ( x y -- x y x y xt)
: polygon[ ['] line (moveto) ; ( -- xt1 xt2)
: polyline[ (cancel) (moveto) ; ( -- xt1 xt2)
: +point rot execute ; ( x1 y1 xt x2 y2 -- x2 y2 xt)
: ]poly drop 2>r rot 2r> +point ; ( xt1 x1 y1 x2 y2 xt2 --)

(lineto) 'lineto !

$12 SetVid \ 640x480x16

polygon[ \ start a polygon
75 300 +point \ now issue all the points
161 329 +point
161 419 +point
215 347 +point
301 373 +point
250 300 +point
301 227 +point
215 253 +point
161 181 +point
161 271 +point
]poly \ close the polygon

key drop \ admire

$03 SetVid \ text mode

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

General routine for a polyline or a polygon Hans Bezemer <the.beez.speaks@gmail.com> - 2026-09-10 12:46 +0200
  Re: General routine for a polyline or a polygon dxf <dxforth@gmail.com> - 2026-09-10 23:33 +1000
    Re: General routine for a polyline or a polygon Hans Bezemer <the.beez.speaks@gmail.com> - 2026-09-10 19:22 +0200
      Re: General routine for a polyline or a polygon Hans Bezemer <the.beez.speaks@gmail.com> - 2026-09-11 13:30 +0200
        Re: General routine for a polyline or a polygon dxf <dxforth@gmail.com> - 2026-09-12 01:04 +1000
          Re: General routine for a polyline or a polygon dxf <dxforth@gmail.com> - 2026-09-12 02:34 +1000
            Re: General routine for a polyline or a polygon Hans Bezemer <the.beez.speaks@gmail.com> - 2026-09-11 19:22 +0200

csiph-web