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 // ---------------------------------------------------------------------- 00030 // Class G4KnotVector 00031 // 00032 // Class description: 00033 // 00034 // Utility class for operations on a vector of knots. 00035 00036 // Authors: J.Sulkimo, P.Urban. 00037 // Revisions by: L.Broglia, G.Cosmo. 00038 // ---------------------------------------------------------------------- 00039 #ifndef __KNOTVECTOR_H 00040 #define __KNOTVECTOR_H 00041 00042 #include <cmath> 00043 #include "geomdefs.hh" 00044 00045 class G4KnotVector 00046 { 00047 00048 public: // with description 00049 00050 G4KnotVector(); 00051 G4KnotVector(G4int sz); 00052 ~G4KnotVector(); 00053 // Constructors & destructor. 00054 00055 G4KnotVector(const G4KnotVector& orig); 00056 // Copy constructor. 00057 00058 G4KnotVector& operator=(const G4KnotVector& right); 00059 // Assignment operator. 00060 00061 inline G4int GetSize() const; 00062 // Gets number of knots. 00063 00064 inline G4double GetKnot(G4int knot_number) const; 00065 // Retrieves knot from knot vector index knot_number. 00066 00067 inline void PutKnot(G4int knot_number, G4double value); 00068 // Sets knot vector index knot_number to value. 00069 00070 G4KnotVector* MultiplyKnotVector(G4int num, G4double value); 00071 // Adds the internal knots to the new knot vector. 00072 00073 G4double* MergeKnotVector(const G4double *knots_to_add, G4int add_size); 00074 // Creates the new vector by merging the old vector with the 00075 // knots in the vector knots_to_add. 00076 00077 G4int CheckKnotVector(G4double val) const; 00078 // Finds out how many times val occurs in the knot vector. 00079 00080 void ExtractKnotVector(G4KnotVector* kv, G4int upper, G4int lower); 00081 // Copies either the first half or the second half of 00082 // the new knot vector values to the knot vectors of the 00083 // new surfaces created by splitting. 00084 00085 G4int GetKnotIndex(G4double k_value, G4int order) const; 00086 // Searches the knot vector for the value and returns the index 00087 // This is used in the evaluation of the intersection to find 00088 // out between which knots the intersection point is on the b-spline 00089 // surface. 00090 00091 private: 00092 00093 inline G4double ApxEq(G4double x, G4double y) const; 00094 00095 private: 00096 00097 G4int k_size; 00098 // Number of knots. 00099 00100 G4double *knots; 00101 // Knot vector. 00102 00103 G4double kCarTolerance; 00104 // Surface thickness. 00105 00106 }; 00107 00108 #include "G4KnotVector.icc" 00109 00110 #endif