Hi,
I have started puttering with J8.01 and in particular have been looking
to create an analog of the graphics/fvj3/dwin.ijs addon that allows
users to declare a range for x and y coordinates and open a window for
plotting polygons and doing simple animations.
I have essentially duplicated that script using the graphics/graph/graph
addon which seemed to be very nice starting place.
But I wonder
(1) is there an easy way in the graphics addon to control or hint about
the desired window size or aspect ratio?
(2) is there an easy way to label the window with something other than
the parent name?
(3) should I really be using wd gl2 commands instead?
(4) I wonder if there isn't a bug in gdarc01? Below is a fairly short
example illustrating the point.
Best, Cliff
require '~addons/graphics/graph/graph.ijs'
NB. ------------------------------------------------
NB.* dwin v Opens a drawing window
NB. Example:
NB. _2 _3 2 3 dwin 'example'
NB. opens a drawing window where coordinates range
NB. from _2 to 2 in x and _3 to 3 in y and
NB. window name "example"
dwin=: 3 : 0 NB. pixel sized window drawing
0 0 1 1 dwin y
:
'a b c d'=.x
SC=:((-&(a,b)) %((c-a),d-b)"1)"1
gdopen y
gdshow''
)
NB. (0 0 255;3 0) darc x y w h x0 y0 x1 y1
NB. where x,y is a corner of the circumscribing box;
NB. w h is the extent;
NB. x0 y0 is on a ray from the center to the start point;
NB. x1 y1 is on a ray from the center to the end point;
darc=:3 : 0"1
(0 0 0;1 0) darc y
:
if. 32=3!:0 x do.
gdpencolor >{.x
gdpen >{:x
else. gdcolor x end.
'a b c d'=.4 2$y
'A B C D'=.SC a,(a+b),c,:d
gdarc01 x:^:_1 A,(B-A),C,D
gdshow''
)
_2 _2 2 2 dwin 'si'
(0 255 255;3 0) darc 0 0 2 2 2 0 0 2
draws the arc as though the circle's center is _1 1 instead of 1 1
--
Clifford A. Reiter
Lafayette College, Easton, PA 18042
http://webbox.lafayette.edu/~reiterc/
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm