ETHZ_Logo RAMSES_Logo_Right   RAMSES   RAMSES_Logo_Left Systems Ecology  
Start    search button      Modules:   A-Z   Function   Layer        QuickRefs:   DM   AuxLib   AuxLibE   SciLib   EasyMW   MW   ISIS   RMSLib

DEFINITION MODULE Graphics3D;

  (*******************************************************************

    Module  Graphics3D     (Version 1.0)

      Copyright (c) 1986-2006 by Markus Ulrich and ETH Zurich.

    Purpose   Provides routines for three dimensional (3D) drawing
              and a graphic coordinate system (CS) editor.

    Remarks   The module supports the definition of a 3D-CS, and
              drawing of the CS with axis labels and scaling.
              3D points can be transformed to two dimensional
              user or pixel coordinates of the current output window.

              The outstanding feature of this module is its
              graphic CS-Editor.  The position of all axes and
              the origin, as well as the scaling can be defined
              graphically with the mouse.  In that way you can
              define your own view of the coordinate system.
              Namely, it is possible to change any 3D view to a
              two dimensional projection of one or two planes,
              behaving like any conventional 2D plot.

              This library module is an auxiliary library module
              working on top of the Dialog Machine.  The plot has to
              be drawn with procedures of DMWindows.


    Programming

      o Design
        Markus Ulrich             25/03/1986

      o Implementation
        Markus Ulrich             25/03/1986


    ETH Zurich
    Systems Ecology
    CHN E 35.1
    Universitaetstrasse 16
    8092 Zurich
    SWITZERLAND

    URLs:
        <mailto:RAMSES@env.ethz.ch>
        <http://www.sysecol.ethz.ch>
        <http://www.sysecol.ethz.ch/SimSoftware/RAMSES>


    Last revision of definition:  15/07/1988  AF

  *******************************************************************)


FROM DMWindows IMPORT   RectArea;

CONST
  MaxLabelLength  = 4;

TYPE
  Point3D         = RECORD x,y,z: REAL END;
  AxisLabelString = ARRAY [0..MaxLabelLength-1] OF CHAR;
  CSType          = RECORD
                      origin,
                      xPoint,  yPoint,  zPoint: RECORD x, y: INTEGER END;
                      xMax,    yMax,    zMax  : REAL;
                      xLabel,  yLabel,  zLabel: AxisLabelString;
                    END;

PROCEDURE SetTermMenuText(mText,mCmdText: ARRAY OF CHAR;
						  aliasChar: CHAR);
(* defaults are set for German and English (in case of all other
DM languages, maximum of 64 chars *)
PROCEDURE GetTermMenuText(VAR mText,mCmdText: ARRAY OF CHAR;
						  VAR aliasChar: CHAR);
PROCEDURE InstallCS(r: RectArea; CS: CSType);
  (* Installs a 3D CS in the current output window. The location of the CS
     in the window is defined by the RectArea r, and the location, the
     scaling and the axis labels by CS.
     IMPORTANT: This procedure must be called before any of the below
                listed procedures!
     CS is defined as follows:
       The coordinates of the origin and of the axis endpoints, as well
       as the maximal values for each axis, have to be stored in the
       CS-record. All coordinates refer to the pixel coordinate
       sytem of the current output window (see DMWindows).

       Note: x-,y- and z-Point MUST all lie on the  border of r,
             the origin MUST lie within r and all maxima MUST be positive!

                                 zPoint,zMax    (r.x+r.h,r.y+r.w)
                         ______________.________B
                         |            .         |
                         |           .          |
                         |          .           |
                         |         .            |
             yPoint,yMax .........o origin      |  pixel coordinates!
                         |         .            |
                         |          .           |
                         |           .          |
                         A____________.__________
                    (r.x,r.y)        xPoint, xMax

     This procedure does not perform any drawing, but it sets the clip
     region to r, as most drawing procedures of Graphics3D do.
     All user coordinate procedures of DMWindows can be used, they refer
     to r ("InstallCS" calls "DMWindows.ScaleUC" with the parameter r.  *)

PROCEDURE GetCS(VAR CS: CSType);
  (* This procedure returns the parameters of the current CS. Editing
     of the CS changes the current CS.                                  *)


PROCEDURE DrawCS;
  (* This procedure sets the clip region to r, plots the CS with a frame
     around r. All labels are positionned automatically.                *)

PROCEDURE Convert3DToPoint(P:Point3D; VAR x,y: INTEGER);
  (* Projects P on the two dimensional drawing plane. Returns pixel-window
     coordinates of the current output window as defined by DMWindows.  *)

PROCEDURE Convert3DTo2D(P:Point3D; VAR xUC,yUC: REAL);
  (* Projects P on the two dimensional drawing plane. Returns user coordi-
     nates of the current output window as defined by DMWindows.        *)

PROCEDURE EditCS;
  (* This procedure calls the graphic coordinate system editor.
     Before calling this procedure, ALL menu commands must be disabled
     (EditCS supports no updating ), DeskAccessories are disabled by EditCS.

     It clears the content of the area r, draws the edit CS and supports
     the following editing actions:
       a) Changing the position of any axis by clicking and dragging the
          axis endpoint.
       b) Moving the origing by clicking and dragging it.
       c) Changing the scaling of any axis by clicking and dragging the
          axis scalepoint. Any changes of the scaling are possible.
       d) Ending the edit actions by clicking outside the area r. After the
          procedure EditCS, the content of the area r will be erased.

          Remark: All labels are positioned automatically.
       e) If current DM Language is German the terminate menu will be
          in German, in all other cases in English
  *)

END Graphics3D.

  Contact RAMSES@env.ethz.ch Last updated: 25-Jul-2011 [Top of page]