00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // Class description: 00030 // 00031 // G4AnalyticalPolSolver allows the user to solve analytically a polynomial 00032 // equation up to the 4th order. This is used by CSG solid tracking functions 00033 // like G4Torus. 00034 // 00035 // The algorithm has been adapted from the CACM Algorithm 326: 00036 // 00037 // Roots of low order polynomials 00038 // Author: Terence R.F.Nonweiler 00039 // CACM (Apr 1968) p269 00040 // Translated into C and programmed by M.Dow 00041 // ANUSF, Australian National University, Canberra, Australia 00042 // m.dow@anu.edu.au 00043 // 00044 // Suite of procedures for finding the (complex) roots of the quadratic, 00045 // cubic or quartic polynomials by explicit algebraic methods. 00046 // Each Returns: 00047 // 00048 // x=r[1][k] + i r[2][k] k=1,...,n, where n={2,3,4} 00049 // 00050 // as roots of: 00051 // sum_{k=0:n} p[k] x^(n-k) = 0 00052 // Assumes p[0] != 0. (< or > 0) (overflows otherwise) 00053 00054 // --------------------------- HISTORY -------------------------------------- 00055 // 00056 // 13.05.05 V.Grichine ( Vladimir.Grichine@cern.ch ) 00057 // First implementation in C++ 00058 00059 #ifndef G4AN_POL_SOLVER_HH 00060 #define G4AN_POL_SOLVER_HH 00061 00062 #include "G4Types.hh" 00063 00064 class G4AnalyticalPolSolver 00065 { 00066 public: // with description 00067 00068 G4AnalyticalPolSolver(); 00069 ~G4AnalyticalPolSolver(); 00070 00071 G4int QuadRoots( G4double p[5], G4double r[3][5]); 00072 G4int CubicRoots( G4double p[5], G4double r[3][5]); 00073 G4int BiquadRoots( G4double p[5], G4double r[3][5]); 00074 G4int QuarticRoots( G4double p[5], G4double r[3][5]); 00075 }; 00076 00077 #endif