[831] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
| 27 | // $Id: G4SurfaceBoundary.hh,v 1.8 2006/06/29 18:40:45 gunter Exp $ |
---|
[1337] | 28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $ |
---|
[831] | 29 | // |
---|
| 30 | // ---------------------------------------------------------------------- |
---|
| 31 | // Class G4SurfaceBoundary |
---|
| 32 | // |
---|
| 33 | // Class description: |
---|
| 34 | // |
---|
| 35 | // Definition of a surface boundary. |
---|
| 36 | |
---|
| 37 | // Authors: J.Sulkimo, P.Urban. |
---|
| 38 | // Revisions by: L.Broglia, G.Cosmo. |
---|
| 39 | // ---------------------------------------------------------------------- |
---|
| 40 | #ifndef included_G4SurfaceBoundary |
---|
| 41 | #define included_G4SurfaceBoundary |
---|
| 42 | |
---|
| 43 | #include "G4Point3D.hh" |
---|
| 44 | #include "G4Point3DVector.hh" |
---|
| 45 | #include "G4Vector3D.hh" |
---|
| 46 | #include "G4Transform3D.hh" |
---|
| 47 | #include "G4Curve.hh" |
---|
| 48 | #include "G4CurveVector.hh" |
---|
| 49 | #include "G4CurveRayIntersection.hh" |
---|
| 50 | |
---|
| 51 | class G4Ray; |
---|
| 52 | class G4CylindricalSurface; |
---|
| 53 | |
---|
| 54 | class G4SurfaceBoundary |
---|
| 55 | { |
---|
| 56 | |
---|
| 57 | public: // with description |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | G4SurfaceBoundary(); |
---|
| 61 | ~G4SurfaceBoundary(); |
---|
| 62 | // Constructor & destructor. |
---|
| 63 | |
---|
| 64 | void Init(const G4CurveVector& bounds0); |
---|
| 65 | // Initializes with a set of closed curves, each of which is an |
---|
| 66 | // (inner or outer) boundary. No responsibility to delete the curves |
---|
| 67 | // is taken. |
---|
| 68 | |
---|
| 69 | inline const G4CurveVector& GetBounds() const; |
---|
| 70 | // Returns closed curve boundaries. |
---|
| 71 | |
---|
| 72 | inline const G4BoundingBox3D& BBox() const; |
---|
| 73 | // Returns the bounding-box. |
---|
| 74 | |
---|
| 75 | G4SurfaceBoundary* Project(const G4Transform3D& tr = |
---|
| 76 | HepGeom::Transform3D::Identity); |
---|
| 77 | // Projection onto the xy plane after transformation tr. |
---|
| 78 | // The returned object is allocated dynamically; it is the caller's |
---|
| 79 | // responsibility to delete it. |
---|
| 80 | // In case the projection maps a line into a point, 0 is returned. |
---|
| 81 | |
---|
| 82 | G4int IntersectRay2D(const G4Ray& ray); |
---|
| 83 | // Intersects a 2D boundary with a ray. The ray is projected onto the |
---|
| 84 | // xy plane. If no intersection 0 is returned, otherwise 1 is returned. |
---|
| 85 | // and the intersection set to intersection0. |
---|
| 86 | // The intersection point is: ray.start+ray.dir*intersection0. |
---|
| 87 | |
---|
| 88 | G4bool Tangent(G4CurvePoint& cp, G4Vector3D& v); |
---|
| 89 | // Tangent vector to a curve at the point with parameter u. |
---|
| 90 | // Returns true if exists. The vector is stored in v. |
---|
| 91 | |
---|
| 92 | |
---|
| 93 | public: // without description |
---|
| 94 | |
---|
| 95 | void SplitWithPlane(const G4Point3D& p0, |
---|
| 96 | const G4Vector3D& n, |
---|
| 97 | G4SurfaceBoundary*& new1, |
---|
| 98 | G4SurfaceBoundary*& new2 ); |
---|
| 99 | // Splits a boundary with a plane containing p0 with normal n. |
---|
| 100 | // Pointers to the resulting boundaries are put into new1 and new2. |
---|
| 101 | // It is the caller's responsibility to delete them. |
---|
| 102 | // To be implemented yet. |
---|
| 103 | |
---|
| 104 | void SplitWithCylinder(const G4CylindricalSurface& c, |
---|
| 105 | G4SurfaceBoundary*& new1, |
---|
| 106 | G4SurfaceBoundary*& new2 ); |
---|
| 107 | // Splits a boundary with a cylindrical surface. |
---|
| 108 | // Pointers to the resulting boundaries are put into new1 and new2. |
---|
| 109 | // It is the caller's responsibility to delete them. |
---|
| 110 | // To be implemented yet. |
---|
| 111 | |
---|
| 112 | inline G4int GetNumberOfPoints() const; |
---|
| 113 | inline const G4Point3D& GetPoint(G4int Count) const; |
---|
| 114 | // Functions probably not used and should be removed in the future |
---|
| 115 | |
---|
| 116 | // void IntersectRay2D(const G4Ray& ray, G4CurveRayIntersection& is); |
---|
| 117 | |
---|
| 118 | private: |
---|
| 119 | |
---|
| 120 | G4SurfaceBoundary(const G4SurfaceBoundary&); |
---|
| 121 | G4SurfaceBoundary& operator=(const G4SurfaceBoundary&); |
---|
| 122 | // Private copy constructor and assignment operator. |
---|
| 123 | |
---|
| 124 | private: |
---|
| 125 | |
---|
| 126 | G4Point3DVector points; |
---|
| 127 | G4CurveVector bounds; |
---|
| 128 | G4BoundingBox3D bBox; |
---|
| 129 | |
---|
| 130 | // to speed up the tangent computation |
---|
| 131 | G4CurveRayIntersection lastIntersection; |
---|
| 132 | |
---|
| 133 | }; |
---|
| 134 | |
---|
| 135 | #include "G4SurfaceBoundary.icc" |
---|
| 136 | |
---|
| 137 | #endif |
---|