github.com/archlabjp/eeslism-go@v0.0.0-20231109122333-4bb7bfcdf292/eeslism/ZPRINT.go (about) 1 //This file is part of EESLISM. 2 // 3 //Foobar is free software : you can redistribute itand /or modify 4 //it under the terms of the GNU General Public License as published by 5 //the Free Software Foundation, either version 3 of the License, or 6 //(at your option) any later version. 7 // 8 //Foobar is distributed in the hope that it will be useful, 9 //but WITHOUT ANY WARRANTY; without even the implied warranty of 10 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 11 //GNU General Public License for more details. 12 // 13 //You should have received a copy of the GNU General Public License 14 //along with Foobar.If not, see < https://www.gnu.org/licenses/>. 15 16 /* 17 18 OP,LPの座標出力(デバッグ用) 19 FILE=ZPRINT.c 20 Create Date=1999.10.26 21 22 */ 23 24 package eeslism 25 26 import ( 27 "fmt" 28 "os" 29 ) 30 31 func ZPRINT(lp []P_MENN, op []P_MENN, lpn, opn int, name string) { 32 name += ".gchi" 33 fp, err := os.Create(name) 34 if err != nil { 35 fmt.Println("File not open") 36 os.Exit(1) 37 } 38 39 for i := 0; i < opn; i++ { 40 fmt.Fprintf(fp, "op[%d] %s\n", i, op[i].opname) 41 for j := 0; j < op[i].polyd; j++ { 42 fmt.Fprintf(fp, " P[%d] X=%f Y=%f Z=%f\n", j, op[i].P[j].X, op[i].P[j].Y, op[i].P[j].Z) 43 } 44 for k := 0; k < op[i].wd; k++ { 45 fmt.Fprintf(fp, "op[%d] opw[%d] %s\n ", i, k, op[i].opw[k].opwname) 46 for j := 0; j < 4; j++ { 47 fmt.Fprintf(fp, " P[%d] X=%f Y=%f Z=%f\n", j, op[i].opw[k].P[j].X, op[i].opw[k].P[j].Y, op[i].opw[k].P[j].Z) 48 } 49 } 50 fmt.Fprintln(fp) 51 } 52 53 for i := 0; i < lpn; i++ { 54 fmt.Fprintf(fp, "lp[%d] %s\n ", i, lp[i].opname) 55 fmt.Fprintf(fp, " e.X=%f e.Y=%f e.Z=%f\n", lp[i].e.X, lp[i].e.Y, lp[i].e.Z) 56 for j := 0; j < lp[i].polyd; j++ { 57 fmt.Fprintf(fp, " P[%d] X=%f Y=%f Z=%f\n", j, lp[i].P[j].X, lp[i].P[j].Y, lp[i].P[j].Z) 58 } 59 fmt.Fprintln(fp) 60 } 61 62 fp.Close() 63 }