github.com/archlabjp/eeslism-go@v0.0.0-20231109122333-4bb7bfcdf292/eeslism/URA.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 裏側の面を見つける 19 FILE=URA.c 20 Create Date=1999.6.7 21 22 */ 23 24 package eeslism 25 26 import "math" 27 28 /*---------------------------------------------------------*/ 29 func URA(u, w int, LP []P_MENN, t []bekt, OP []P_MENN) { 30 for j := 0; j < u; j++ { 31 for i := 0; i < w; i++ { 32 for k := 0; k < LP[i].polyd; k++ { 33 34 t[j].ps[i][k] = -(OP[j].e.X*OP[j].P[k].X + OP[j].e.Y*OP[j].P[k].Y + 35 OP[j].e.Z*OP[j].P[k].Z - OP[j].e.X*LP[i].P[k].X - 36 OP[j].e.Y*LP[i].P[k].Y - OP[j].e.Z*LP[i].P[k].Z) / 37 ((OP[j].e.X)*(OP[j].e.X) + (OP[j].e.Y)*(OP[j].e.Y) + 38 (OP[j].e.Z)*(OP[j].e.Z)) 39 } 40 } 41 } 42 } 43 44 /*-------------------------------------------------------------*/ 45 46 func URA_M(ls, ms, ns float64, s *float64, wb float64) { 47 ex := 0.0 48 ey := -math.Sin((-wb) * math.Pi / 180) 49 ez := math.Cos((-wb) * math.Pi / 180) 50 51 *s = (ex*ls + ey*ms + ez*ns) / (ex*ex + ey*ey + ez*ez) 52 }