/******************************************************************** * Description: * Author: George-Catalin Serbanut * * Copyright (c) 2005 George-Catalin Serbanut All rights reserved. * ********************************************************************/ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include "include/crystal.hh" #include "include/point.hh" #include "include/line.hh" #include "include/plan.hh" #include "include/angles.hh" #include "include/math.hh" #include "include/algebra.hh" using namespace std; Crystal::Crystal() { } Crystal::~Crystal() { } void Crystal::SetCrystal(vector p) { if(!Crystal::crystal_in.empty()) Crystal::crystal_in.clear(); if(!Crystal::crystal_out.empty()) Crystal::crystal_out.clear(); if(!Crystal::crystal.empty()) Crystal::crystal.clear(); for(int i=0; i pts; Algebra alg; Point temp; Math math; for(int i=0; i0.0) { temp = pts[j]; pts[j] = pts[i]; pts[i] = temp; }; for(int i=0; i<4; i++) { int j1=i+4; for(int j2=j1+1; j2<8; j2++) if(math.Precision(alg.Magnitude(Line(pts[i],pts[j1]))-alg.Magnitude(Line(pts[i],pts[j2])),math.precision)>0.0) { temp = pts[j1]; pts[j1] = pts[j2]; pts[j2] = temp; }; }; // >>>> for the barrel >>>> // for(int i=0; i>>> for the forward endcap >>>> /* pts.clear(); pts.push_back(Crystal::crystal_in[0]); pts.push_back(Crystal::crystal_in[1]); pts.push_back(Crystal::crystal_in[2]); pts.push_back(Crystal::crystal_in[3]); pts.push_back(Crystal::crystal_in[7]); pts.push_back(Crystal::crystal_in[6]); pts.push_back(Crystal::crystal_in[5]); pts.push_back(Crystal::crystal_in[4]); */ for(int i=0; i plan1P; vector plan2P; Point perp1, perp2, perp; Point center1, center2; Point temp; vector al; Angles ap; Math math; double a[3][3], atemp[3][3]; double col1[3], col2[3]; double x1, y1, z1; double x2, y2, z2; double psi, omega, psil, omegal; for(int i=0; i<4; i++) { plan1P.push_back(Crystal::crystal[i]); // cout< vi; // if(!vi.empty()) vi.clear(); // for(int i=0; i<8; i++) // for(int j=0; j<8; j++) // if(math.Precision(Crystal::crystal_in[i].GetX()-Crystal::crystal[j].GetX(),2)==0.0) // if(math.Precision(Crystal::crystal_in[i].GetY()-Crystal::crystal[j].GetY(),2)==0.0) // if(math.Precision(Crystal::crystal_in[i].GetZ()-Crystal::crystal[j].GetZ(),2)==0.0) // vi.push_back(j); // cout<<"IGES order : "; // for(int i=0; i<8; i++) cout<