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 Splines;

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

    Module  Splines     (Version 1.0)

      Copyright (c) 1990-2006 by Olivier Roth and ETH Zurich.

    Purpose   Cubic splines, cyclic splines, bezier curves
              and open or closed curve drawings.

    Remarks   See: B. Edlinger, 1989, "Splines - Einführung für den Praktiker",
              CHIP Professional Programmieren Nr. 7:21-40


    Programming

      o Design
        Olivier Roth              29/06/1990

      o Implementation
        Olivier Roth              29/06/1990


    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:  29/06/1990  OR

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


(* Computing procedures: *)

  PROCEDURE Spline( n: INTEGER;  VAR x, y, y1, y2: ARRAY OF REAL );
  (* computes a general spline function trough the n (x,y) points,
     returns the first derivative in y1 and second in y2 *)


  PROCEDURE Spline1( n: INTEGER;  ya, yb: REAL;
                     VAR x, y, y1, y2: ARRAY OF REAL );
  (* computes a spline function trough the n (x,y) points, with
     the derivatives ya at x[0] and yb at x[n] (must be specified),
     returns the first derivative in y1 and second in y2 *)


  PROCEDURE Spline2( n: INTEGER;  VAR x, y, y1, y2: ARRAY OF REAL );
  (* computes a cyclic spline function trough the n (x,y) points,
     (should be: y[n] = y[0];  n >= 3),
     returns the first derivative in y1 and second in y2 *)


  PROCEDURE Intrpl( x0: REAL;  n: INTEGER;
                    VAR x, y, y1, y2: ARRAY OF REAL ): REAL;
  (* interpolates in the spline function given by x, y, y1, and y2
     (must be computed before by Spline, Spline1 or Spline2) at x0 *)



  PROCEDURE SplineCurve( n: INTEGER;
                         VAR x, y, t, x1, x2, y1, y2: ARRAY OF REAL );
  (* computes the spline function for open curves, i.e. x[0] <> x[n] *)


  PROCEDURE SplineCurve2( n: INTEGER;
                          VAR x, y, t, x1, x2, y1, y2: ARRAY OF REAL );
  (* computes the spline function for closed curves: i.e.
     x[0] = x[n] and y[0] = y[n] *)


(* Drawing procedures: *)

(* the following procedures draw to the current output window
   in user coordinates.  This implies that the user must define
   these coordinates previously by a call to DMWindowIO.ScaleUC.
   Internally the following routines call SetUCPen, and UCLineTo
   (both from DMWindowIO). *)

  PROCEDURE Bezier( x0, y0, x1, y1, x2, y2, x3, y3: REAL );
  (* draws a bezier curve from (x0,y0) to (x3,x4); (x1,y1) and (x2,y2)
     define the asymptotic cross points of the first derivative of the
     bezier curve (cubic function) (i.e (x1,y1) and (x2,y2) are not
     on the bezier curve) *)


  PROCEDURE PlotSpline( n: INTEGER;
                        VAR x, y, y1: ARRAY OF REAL );
  (* draws any spline function defined by n, x, y, y1. These data
     must be computed previosly by Spline, Spline1, or Spline2. *)


  PROCEDURE PlotSpline2( n: INTEGER;
                        VAR t, x, x1, y, y1: ARRAY OF REAL );
  (* draws any spline function defined by n, t, x, x1, y, y1. These
     data must be computed previosly by SplineCurve or SplineCurve2. *)


END Splines.

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