INTERFACE H3; (* Oriented projective geometry in three dimensions Author: Jorge Stolfi Last edited: M. Carrard - 18/05/1993 - Transcricao para modula-3 *) IMPORT R3, R4, R4x4; TYPE Point = RECORD c: R4.T END; (* c[0..3] are coords [w,x,y,z]. *) Plane = RECORD c: R4.T END; (* c[0..3] are coeffs . *) PMap = RECORD dir: R4x4.T; inv: R4x4.T END; Sign = [-1..1]; PROCEDURE errmsg( s: TEXT ); (* Output error messages *) PROCEDURE mk_point( w,x,y,z: REAL ): Point; (* Sets res := [w,x,y,z] *) PROCEDURE mk_plane( W,X,Y,Z: REAL ): Plane; (* Sets res := *) PROCEDURE test( p: Point; Q: Plane ): Sign; (* Returns sign of point p relative to plane Q: +1 in positive halfspace 0 on the plane -1 in negative halfspace *) PROCEDURE join( p,q,r: Point ): Plane; (* Return the plane through p, q, and r. *) PROCEDURE meet( P,Q,R: Plane ): Point; (* Return the point common to P, Q, and R. *) PROCEDURE map_point( p: Point; m: PMap ): Point;(* Applies projective map m to point p. *) PROCEDURE map_plane( P: Plane; m: PMap ): Plane;(* Applies projective map m to plane P *) PROCEDURE comp_map( m,n: PMap ): PMap; (* Results the composition of m and n, applied in that order *) PROCEDURE dir( frm,tto: Point ): R3.T; (* *) PROCEDURE dst( frm,tto: Point ): REAL; (* *) PROCEDURE persp_map( obs,foc,upp: Point ): PMap;(* Computes a perspective transformation with given viewing parameters. obs => scenesys coords of imagesys (0,0,d) (observer) foc => scenesys coords to imagesys (0,0,0) (image focus) up => scenesys point to project on imagesys Z axis *) END H3.