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 G4SurfaceBoundary 00031 // 00032 // Class description: 00033 // 00034 // Definition of a surface boundary. 00035 00036 // Authors: J.Sulkimo, P.Urban. 00037 // Revisions by: L.Broglia, G.Cosmo. 00038 // ---------------------------------------------------------------------- 00039 #ifndef included_G4SurfaceBoundary 00040 #define included_G4SurfaceBoundary 00041 00042 #include "G4Point3D.hh" 00043 #include "G4Point3DVector.hh" 00044 #include "G4Vector3D.hh" 00045 #include "G4Transform3D.hh" 00046 #include "G4Curve.hh" 00047 #include "G4CurveVector.hh" 00048 #include "G4CurveRayIntersection.hh" 00049 00050 class G4Ray; 00051 class G4CylindricalSurface; 00052 00053 class G4SurfaceBoundary 00054 { 00055 00056 public: // with description 00057 00058 00059 G4SurfaceBoundary(); 00060 ~G4SurfaceBoundary(); 00061 // Constructor & destructor. 00062 00063 void Init(const G4CurveVector& bounds0); 00064 // Initializes with a set of closed curves, each of which is an 00065 // (inner or outer) boundary. No responsibility to delete the curves 00066 // is taken. 00067 00068 inline const G4CurveVector& GetBounds() const; 00069 // Returns closed curve boundaries. 00070 00071 inline const G4BoundingBox3D& BBox() const; 00072 // Returns the bounding-box. 00073 00074 G4SurfaceBoundary* Project(const G4Transform3D& tr = G4Transform3D::Identity); 00075 // Projection onto the xy plane after transformation tr. 00076 // The returned object is allocated dynamically; it is the caller's 00077 // responsibility to delete it. 00078 // In case the projection maps a line into a point, 0 is returned. 00079 00080 G4int IntersectRay2D(const G4Ray& ray); 00081 // Intersects a 2D boundary with a ray. The ray is projected onto the 00082 // xy plane. If no intersection 0 is returned, otherwise 1 is returned. 00083 // and the intersection set to intersection0. 00084 // The intersection point is: ray.start+ray.dir*intersection0. 00085 00086 G4bool Tangent(G4CurvePoint& cp, G4Vector3D& v); 00087 // Tangent vector to a curve at the point with parameter u. 00088 // Returns true if exists. The vector is stored in v. 00089 00090 00091 public: // without description 00092 00093 void SplitWithPlane(const G4Point3D& p0, 00094 const G4Vector3D& n, 00095 G4SurfaceBoundary*& new1, 00096 G4SurfaceBoundary*& new2 ); 00097 // Splits a boundary with a plane containing p0 with normal n. 00098 // Pointers to the resulting boundaries are put into new1 and new2. 00099 // It is the caller's responsibility to delete them. 00100 // To be implemented yet. 00101 00102 void SplitWithCylinder(const G4CylindricalSurface& c, 00103 G4SurfaceBoundary*& new1, 00104 G4SurfaceBoundary*& new2 ); 00105 // Splits a boundary with a cylindrical surface. 00106 // Pointers to the resulting boundaries are put into new1 and new2. 00107 // It is the caller's responsibility to delete them. 00108 // To be implemented yet. 00109 00110 inline G4int GetNumberOfPoints() const; 00111 inline const G4Point3D& GetPoint(G4int Count) const; 00112 // Functions probably not used and should be removed in the future 00113 00114 // void IntersectRay2D(const G4Ray& ray, G4CurveRayIntersection& is); 00115 00116 private: 00117 00118 G4SurfaceBoundary(const G4SurfaceBoundary&); 00119 G4SurfaceBoundary& operator=(const G4SurfaceBoundary&); 00120 // Private copy constructor and assignment operator. 00121 00122 private: 00123 00124 G4Point3DVector points; 00125 G4CurveVector bounds; 00126 G4BoundingBox3D bBox; 00127 00128 // to speed up the tangent computation 00129 G4CurveRayIntersection lastIntersection; 00130 00131 }; 00132 00133 #include "G4SurfaceBoundary.icc" 00134 00135 #endif