INTERFACE PZOptMatrix; (* Procedures for iptimizing a transformation matrix *) (* Last edited on 1999-09-04 00:59:57 by hcgl *) IMPORT LR4x4; FROM PZTypes IMPORT LONG, NAT; TYPE MatrixFunction = PROCEDURE (READONLY m: LR4x4.T): LONG; PROCEDURE Optimize( func: MatrixFunction; (* Function to optimize. *) scaleX, scaleY: LONG; (* Scale lengths for translation. *) maxEvals: NAT; (* Maximum number of "func" calls. *) VAR nEvals: NAT; (* Total number of "func" calls performed. *) VAR m: LR4x4.T; (* IN: initial guess, OUT: optimized matrix. *) VAR f: LONG; (* OUT: "func(m)". *) plotName: TEXT; (* Plot file for "func" (minus extension), or empty. *) ); (* Returns a rotation/translation matrix "m" that minimizes "func". The "scaleX" and "scaleY" parameters are the unit of translation in each axis. They should be chosen so that translation by "(eps*scaleX,0)" or "(0,eps*scaleY)" away from the optimum has roughly the same effect on "func" as a rotation by "eps" radians away from the optimum. If "plotName" is not empty, the procedure writes to "plotName & \".plt\"" a graph of "func(m)", where "m" varies along a path from the initial matrix "m" to the returned optimum, and then beyond it. *) END PZOptMatrix. (* Copyright © 2001 Universidade Estadual de Campinas (UNICAMP). Authors: Helena C. G. Leitão and Jorge Stolfi. This file can be freely distributed, used, and modified, provided that this copyright and authorship notice is preserved, and that any modified versions are clearly marked as such. This software has NO WARRANTY of correctness or applicability for any purpose. Neither the authors nor their employers chall be held responsible for any losses or damages that may result from its use. *)