Files
geant4/source/geometry/solids/specific/include/G4TriangularFacet.icc
2025-12-05 08:54:02 +01:00

90 lines
2.9 KiB
Plaintext

//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Implementation of inline methods of G4TriangularFacet
// --------------------------------------------------------------------
inline G4bool G4TriangularFacet::IsDefined () const
{
return fIsDefined;
}
inline G4int G4TriangularFacet::GetNumberOfVertices () const
{
return 3;
}
inline G4ThreeVector G4TriangularFacet::GetVertex (G4int i) const
{
G4int indice = fIndices[i];
return indice < 0 ? (*fVertices)[i] : (*fVertices)[indice];
}
inline void G4TriangularFacet::SetVertex (G4int i, const G4ThreeVector& val)
{
(*fVertices)[i] = val;
}
inline G4ThreeVector G4TriangularFacet::GetCircumcentre () const
{
return fCircumcentre;
}
inline G4double G4TriangularFacet::GetRadius () const
{
return fRadius;
}
inline G4int G4TriangularFacet::AllocatedMemory()
{
G4int size = sizeof(*this);
size += GetNumberOfVertices() * sizeof(G4ThreeVector);
return size;
}
inline G4int G4TriangularFacet::GetVertexIndex (G4int i) const
{
if (i < 3)
{
return fIndices[i];
}
return 999999999;
}
inline void G4TriangularFacet::SetVertexIndex (G4int i, G4int j)
{
fIndices[i] = j;
}
inline void G4TriangularFacet::SetVertices(std::vector<G4ThreeVector>* v)
{
if (fIndices[0] < 0 && (fVertices != nullptr))
{
delete fVertices;
fVertices = nullptr;
}
fVertices = v;
}