File indexing completed on 2025-01-18 09:59:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053 #ifndef G4QUADRANGULARFACET_HH
0054 #define G4QUADRANGULARFACET_HH
0055
0056 #include "G4VFacet.hh"
0057 #include "G4Types.hh"
0058 #include "G4ThreeVector.hh"
0059 #include "G4TriangularFacet.hh"
0060
0061 class G4QuadrangularFacet : public G4VFacet
0062 {
0063 public:
0064
0065 G4QuadrangularFacet (const G4ThreeVector& Pt0, const G4ThreeVector& vt1,
0066 const G4ThreeVector& vt2, const G4ThreeVector& vt3,
0067 G4FacetVertexType);
0068 G4QuadrangularFacet (const G4QuadrangularFacet& right);
0069 ~G4QuadrangularFacet () override;
0070
0071 G4QuadrangularFacet& operator=(const G4QuadrangularFacet& right);
0072
0073 G4VFacet* GetClone () override;
0074
0075 G4ThreeVector Distance (const G4ThreeVector& p);
0076 G4double Distance (const G4ThreeVector& p, G4double minDist) override;
0077 G4double Distance (const G4ThreeVector& p, G4double minDist,
0078 const G4bool outgoing) override;
0079 G4double Extent (const G4ThreeVector axis) override;
0080 G4bool Intersect (const G4ThreeVector& p, const G4ThreeVector& v,
0081 const G4bool outgoing, G4double& distance,
0082 G4double& distFromSurface,
0083 G4ThreeVector& normal) override;
0084 G4ThreeVector GetSurfaceNormal () const override;
0085
0086 G4double GetArea () const override;
0087 G4ThreeVector GetPointOnFace () const override;
0088
0089 G4GeometryType GetEntityType () const override;
0090
0091 inline G4bool IsDefined () const override;
0092 inline G4int GetNumberOfVertices () const override;
0093 inline G4ThreeVector GetVertex (G4int i) const override;
0094 inline void SetVertex (G4int i, const G4ThreeVector& val) override;
0095 inline void SetVertices(std::vector<G4ThreeVector>* v) override;
0096
0097 inline G4double GetRadius () const override;
0098 inline G4ThreeVector GetCircumcentre () const override;
0099
0100 private:
0101
0102 inline G4int GetVertexIndex (G4int i) const override;
0103 inline void SetVertexIndex (G4int i, G4int val) override;
0104
0105 inline G4int AllocatedMemory() override;
0106
0107 private:
0108
0109 G4double fRadius = 0.0;
0110
0111 G4ThreeVector fCircumcentre;
0112
0113 G4TriangularFacet fFacet1, fFacet2;
0114 };
0115
0116
0117
0118
0119
0120 inline G4int G4QuadrangularFacet::GetNumberOfVertices () const
0121 {
0122 return 4;
0123 }
0124
0125 inline G4ThreeVector G4QuadrangularFacet::GetVertex (G4int i) const
0126 {
0127 return i == 3 ? fFacet2.GetVertex(2) : fFacet1.GetVertex(i);
0128 }
0129
0130
0131 inline G4double G4QuadrangularFacet::GetRadius () const
0132 {
0133 return fRadius;
0134 }
0135
0136 inline G4ThreeVector G4QuadrangularFacet::GetCircumcentre () const
0137 {
0138 return fCircumcentre;
0139 }
0140
0141 inline void G4QuadrangularFacet::SetVertex (G4int i, const G4ThreeVector &val)
0142 {
0143 switch (i)
0144 {
0145 case 0:
0146 fFacet1.SetVertex(0, val);
0147 fFacet2.SetVertex(0, val);
0148 break;
0149 case 1:
0150 fFacet1.SetVertex(1, val);
0151 break;
0152 case 2:
0153 fFacet1.SetVertex(2, val);
0154 fFacet2.SetVertex(1, val);
0155 break;
0156 case 3:
0157 fFacet2.SetVertex(2, val);
0158 break;
0159 }
0160 }
0161
0162 inline void G4QuadrangularFacet::SetVertices(std::vector<G4ThreeVector>* v)
0163 {
0164 fFacet1.SetVertices(v);
0165 fFacet2.SetVertices(v);
0166 }
0167
0168 inline G4bool G4QuadrangularFacet::IsDefined () const
0169 {
0170 return fFacet1.IsDefined();
0171 }
0172
0173 inline G4int G4QuadrangularFacet::GetVertexIndex (G4int i) const
0174 {
0175 return i == 3 ? fFacet2.GetVertexIndex(2) : fFacet1.GetVertexIndex(i);
0176 }
0177
0178
0179 inline void G4QuadrangularFacet::SetVertexIndex (G4int i, G4int val)
0180 {
0181 switch (i)
0182 {
0183 case 0:
0184 fFacet1.SetVertexIndex(0, val);
0185 fFacet2.SetVertexIndex(0, val);
0186 break;
0187 case 1:
0188 fFacet1.SetVertexIndex(1, val);
0189 break;
0190 case 2:
0191 fFacet1.SetVertexIndex(2, val);
0192 fFacet2.SetVertexIndex(1, val);
0193 break;
0194 case 3:
0195 fFacet2.SetVertexIndex(2, val);
0196 break;
0197 }
0198 }
0199
0200 inline G4int G4QuadrangularFacet::AllocatedMemory()
0201 {
0202 return sizeof(*this) + fFacet1.AllocatedMemory() + fFacet2.AllocatedMemory();
0203 }
0204
0205 #endif