9 The graphmath Library

The graphmath library defines patterns for making graphical computations: point, rectangle, matrix, region, etc. Each of these patterns defines several operations.

9.1 Using the graphmath Library

Remember that in order to utilize this extension to Lidskjalv, the fragment graphmath must be included as follows:

ORIGIN '~beta/guienv/guienv';
INCLUDE '~beta/guienv/graphmath'
--- program: descriptor ---
guienv(# p1, p2: @point;
         ...
      do ...
         p1 -> p2.inset -> ...;
         ...
      #)

9.2 Examples of Use of the graphmath Fragment

This example gives an example of how to use the containsPoint operation of a rectangle.

Program 8: containspoint.bet

ORIGIN '~beta/guienv/guienv';
(* This demo gives an example of how to use the containsPoint
 * operation of a rectangle.
 *)
--- program: descriptor ---
guienv
(# theWindow: @window
     (# hitZone: @rectangle;
        open::
          (# 
          do 'Graphmath Demo' -> title;
             (40,40) -> position;
             (300,300) -> size;
             ((0,0), (30,30)) -> hitZone
          #);
        eventHandler::
          (# onAboutToClose:: (# do terminate #);
             onMouseDown::
               (# 
               do (if localPosition -> hitZone.containsPoint then
                      'Mouse down in Hit Zone.' -> screen.putline
                  if)
               #)
          #)
     #)
do theWindow.open
#)
[24kb 300x319 GIF]


Lidskjalv: User Interface Framework - Reference Manual
© 1994-2004 Mjølner Informatics
[Modified: Friday October 27th 2000 at 14:56]