!********************** csyswri ******************************** ! +++ ! ! Write coordinate system to a file ! ! --- ! Revision history ! ________________ ! ! Copyright 1997-06-18 Gunnar Liden, All Rights Reserved ! ! Released under the MIT License: ! ! Permission is hereby granted, free of charge, to any person ! obtaining a copy of this software and associated documentation ! files (the "Software"), to deal in the Software without ! restriction, including without limitation the rights to use, ! copy, modify, merge, publish, distribute, sublicense, and/or sell ! copies of the Software, and to permit persons to whom the ! Software is furnished to do so, subject to the following ! conditions: ! ! The above copyright notice and this permission notice shall be ! included in all copies or substantial portions of the Software. ! ! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ! OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ! NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ! HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ! WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ! FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ! OTHER DEALINGS IN THE SOFTWARE. ! ! !****************************************************************** GLOBAL GEOMETRY MODULE csyswri ( STRING f_name*132; ! Full file name STRING csy_name*28; ! Name of coordinate system STRING rel_name*28; ! Relative coordinate system VAR FLOAT csy_mat(4,4)); ! Coordinate system matrix !sdesce Write coordinate system to a file !sdescs Skriv koordinatsystem data till fil ! Internal variables FILE dat; ! Coordinate system file VECTOR origin; ! Origin for system BEGINMODULE ! +++ ! Algorithm ! _________ ! --- ! +++ ! 1. Initializations and checks ! --- ! A check of the matrix should perhaps be added ... ! Origin for the system origin.x:= - csy_mat(1,1)*csy_mat(1,4) - csy_mat(2,1)*csy_mat(2,4) - csy_mat(3,1)*csy_mat(3,4); origin.y:= - csy_mat(1,2)*csy_mat(1,4) - csy_mat(2,2)*csy_mat(2,4) - csy_mat(3,2)*csy_mat(3,4); origin.z:= - csy_mat(1,3)*csy_mat(1,4) - csy_mat(2,3)*csy_mat(2,4) - csy_mat(3,3)*csy_mat(3,4); ! +++ ! 2. Open file ! --- OPEN(dat, "W", f_name); IF IOSTAT(dat) <> 0 THEN EXIT("csywri Open "+f_name+ " failed"); ENDIF; ! +++ ! 3. Write data to the file ! --- OUTSTR(dat, " "+csy_name+" "+rel_name); OUTLIN(dat); ! Not right !!!!! ! OUTFLT(dat, csy_mat(1,4), 20, 8); ! OUTFLT(dat, csy_mat(2,4), 20, 8); ! OUTFLT(dat, csy_mat(3,4), 20, 8); OUTFLT(dat, origin.x , 20, 8); OUTFLT(dat, origin.y , 20, 8); OUTFLT(dat, origin.z , 20, 8); OUTLIN(dat); OUTFLT(dat, csy_mat(1,1), 20, 12); OUTFLT(dat, csy_mat(1,2), 20, 12); OUTFLT(dat, csy_mat(1,3), 20, 12); OUTLIN(dat); OUTFLT(dat, csy_mat(2,1), 20, 12); OUTFLT(dat, csy_mat(2,2), 20, 12); OUTFLT(dat, csy_mat(2,3), 20, 12); OUTLIN(dat); OUTFLT(dat, csy_mat(3,1), 20, 12); OUTFLT(dat, csy_mat(3,2), 20, 12); OUTFLT(dat, csy_mat(3,3), 20, 12); OUTLIN(dat); ! +++ ! 4. Close file ! --- CLOSE(dat); ENDMODULE