github.com/archlabjp/eeslism-go@v0.0.0-20231109122333-4bb7bfcdf292/eeslism/GDATA.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=GDATA.c
    20  					Create Date=1999.10.26
    21  
    22  */
    23  
    24  package eeslism
    25  
    26  func GDATA(OP *P_MENN, G *XYZ) {
    27  	var x, y, z float64
    28  
    29  	for i := 0; i < OP.polyd; i++ {
    30  		x += OP.P[i].X
    31  		y += OP.P[i].Y
    32  		z += OP.P[i].Z
    33  	}
    34  
    35  	G.X = x / float64(OP.polyd)
    36  	G.Y = y / float64(OP.polyd)
    37  	G.Z = z / float64(OP.polyd)
    38  }