Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4VFacet.hh
Go to the documentation of this file.
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 and of QinetiQ Ltd, *
20 // * subject to DEFCON 705 IPR conditions. *
21 // * By using, copying, modifying or distributing the software (or *
22 // * any work based on the software) you agree to acknowledge its *
23 // * use in resulting scientific publications, and indicate your *
24 // * acceptance of all terms of the Geant4 Software license. *
25 // ********************************************************************
26 //
27 // $Id: G4VFacet.hh 67011 2013-01-29 16:17:41Z gcosmo $
28 //
29 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
30 //
31 // Class G4VFacet
32 //
33 // Class description:
34 //
35 // Base class defining the facets which are components of a
36 // G4TessellatedSolid shape.
37 
38 // CHANGE HISTORY
39 // --------------
40 //
41 // 31 October 2004, P R Truscott, QinetiQ Ltd, UK - Created.
42 // 12 October 2012, M Gayer, CERN, - Reviewed optimized implementation.
43 //
45 
46 #ifndef G4VFacet_hh
47 #define G4VFacet_hh
48 
49 #include <iostream>
50 #include <vector>
51 
52 #include "globals.hh"
53 #include "G4ThreeVector.hh"
54 #include "G4VSolid.hh"
55 
57 
58 class G4TessellatedSolid;
59 
60 class G4VFacet
61 {
62  public:
63 
64  virtual ~G4VFacet ();
65 
66  G4bool operator== (const G4VFacet &right) const;
67 
68  virtual G4int GetNumberOfVertices () const = 0;
69  virtual G4ThreeVector GetVertex (G4int i) const = 0;
70  virtual void SetVertex (G4int i, const G4ThreeVector &val) = 0;
71  virtual G4GeometryType GetEntityType () const = 0;
72  virtual G4ThreeVector GetSurfaceNormal () const = 0;
73  virtual G4bool IsDefined () const = 0;
74  virtual G4ThreeVector GetCircumcentre () const = 0;
75  virtual G4double GetRadius () const = 0;
76  virtual G4VFacet *GetClone () = 0;
77  virtual G4double Distance (const G4ThreeVector&, G4double) = 0;
78  virtual G4double Distance (const G4ThreeVector&, G4double,
79  const G4bool) = 0;
80  virtual G4double Extent (const G4ThreeVector) = 0;
81  virtual G4bool Intersect (const G4ThreeVector&, const G4ThreeVector &,
82  const G4bool , G4double &, G4double &,
83  G4ThreeVector &) = 0;
84  virtual G4double GetArea() = 0;
85  virtual G4ThreeVector GetPointOnFace() const = 0;
86 
87  void ApplyTranslation (const G4ThreeVector v);
88 
89  std::ostream &StreamInfo(std::ostream &os) const;
90 
91  G4bool IsInside(const G4ThreeVector &p) const;
92 
93  virtual G4int AllocatedMemory() = 0;
94  virtual void SetVertexIndex (G4int i, G4int j) = 0;
95  virtual G4int GetVertexIndex (G4int i) const = 0;
96 
97  virtual void SetVertices(std::vector<G4ThreeVector> *vertices) = 0;
98 
99  protected:
100 
101  static const G4double dirTolerance;
102  static const G4double kCarTolerance;
103 };
104 
105 #endif