gVXR Documentation

class AnatomicalMesh : public gVirtualXRay::PolygonMesh
#include <AnatomicalMesh.h>

AnatomicalMesh is a class to handle a polygon mesh for tissue.

Subclassed by gVirtualXRay::InternalOrganMesh, gVirtualXRay::SkinMesh

Public Functions

AnatomicalMesh()

Default Constructor.

virtual ~AnatomicalMesh()

Destructor.

virtual bool isTransparent() const = 0

return true if the mesh has to be displayed with transparency

virtual bool isSoftTissue() const = 0

return true if the mesh represent a soft tissue

virtual void defineDisplayShaderInput(unsigned int aShaderID)

Link the attributes to their id in the shader.

virtual void initialize() = 0

initialize the needful depending on the organ

void copyFrom(const AnatomicalMesh &aPolygonMesh)
AnatomicalMesh &operator=(const PolygonMesh &aPolygonMesh)
AnatomicalMesh &operator=(const AnatomicalMesh &aPolygonMesh)
virtual const std::string &getLabel() const

Accessor on the label that determines the type of the mesh.

void reset()

Reset the data.

inline void resetVBOs()

Reset the VBOs only.

inline void setDisplayFlag(bool display)

Set if the mesh is displayed or not.

Parameters

display – true or false

inline bool getDisplayFlag() const

Accessor on the display flag of the polygon mesh.

Returns

display flag

void display()

Display the triangular mesh using OpenGL.

void displayWireFrame()

Display the triangular mesh in wireframe using OpenGL.

void displayFaceNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the face normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

void displayVertexNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the vertex normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

inline void setFilename(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFilename(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline const std::string &getFilename() const

Accessor on the name of the file that contains the polygon mesh.

Returns

the file name

inline const RATIONAL_NUMBER &getUnitOfLength() const

Accessor on the unit of length of the mesh.

Returns

the unit of length

void loadSTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void writeSTLFile(bool aBinaryFlag)

Write the STL file.

Parameters

aBinaryFlag – if true, save a binary file; if false save an ASCII file

inline void moveToCentre()

Move the polygon to the centre.

inline void moveToCenter()

Move the polygon to the center.

void computeNormalVectors()

Compute the normal vectors using the cross product method.

inline bool useVBO(int aBufferUsageHing, int aTypeOfPrimitive)

Use a vertex buffer object if possible.

Parameters
  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

Returns

true if the VBO can be used, false otherwise

inline void setHU(short HU)
inline void setHounsfieldUnit(short HU)
inline void setHounsfieldValue(short HU)
inline void setElement(unsigned short Z)
inline void setElement(const std::string &aName)
inline void setMixture(const Mixture &aMixture)
inline void setMixture(const std::map<int, double> &aMixture)
inline void setMixture(const std::map<std::string, double> &aMixture)
inline void setMixture(const std::string &aName)
inline void setCompound(const std::string &aName)
inline void setMassAttenuationCoefficient(double aCoefficient)
inline void setLinearAttenuationCoefficient(double aCoefficient)
inline void setDensity(double aDensity)
inline double getDensity()
inline const std::string &getMaterialLabel() const
inline std::string getCompound() const

Accessor on the compound description of the polygon mesh.

Returns

if the sample is made of a compound, then return the description of the compound (e.g. H2O for water), otherwise return an empty string

inline std::vector<int> getMixtureElementSet() const

Accessor on the element Z number set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element Z number set of the mixture, otherwise return an empty vector

inline std::vector<double> getMixtureWeightSet() const

Accessor on the element weight set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element weight set of the mixture, otherwise return an empty vector

inline const PhotonCrossSection &getPhotonCrossSection() const
inline void setPhotonCrossSection(const PhotonCrossSection &aPhotonCrossSection)
inline const VEC3 &getLocalMinCorner() const

Accessor on the bounding box lower corner.

Returns

the bounding box lower corner

inline const VEC3 &getLocalMaxCorner() const

Accessor on the bounding box upper corner.

Returns

the bounding box upper corner

inline void applyTranslation(const VEC3 &aTranslationVector)

Translate the polygon mesh given a translation vector, and update the VBO if needed.

Parameters

aTranslationVector – the translation vector

inline void applyScaling(RATIONAL_NUMBER x, RATIONAL_NUMBER y, RATIONAL_NUMBER z)

Scale the polygon mesh given scaling factors, and update the VBO if needed.

Parameters
  • x – the scaling factor along the X-axis

  • y – the scaling factor along the Y-axis

  • z – the scaling factor along the Z-axis

inline void applyRotation(const VEC3 &aRotationAxis, RATIONAL_NUMBER aRotationAngleInDegrees)

Rotate the polygon mesh given a rotation axis and angle, and update the VBO if needed.

Parameters
  • aRotationAxis – the rotation axis

  • aRotationAngleInDegrees – the rotation angle in degrees

inline void applyTransform(const MATRIX4 &aTransformationMatrix)

Transform the polygon mesh given a transformation matrix and update the VBO if needed.

Parameters

aTransformationMatrix – the transformation matrix

unsigned int getFaceNumber() const

Accessor on the number of faces.

Returns

the number of faces

unsigned int getTriangleNumber() const

Accessor on the number of triangles.

Returns

the number of triangles

inline unsigned int getFaceNormalNumber() const

Accessor on the number of face normal vectors.

Returns

the number of face normal vectors

inline unsigned int getVertexNormalNumber() const

Accessor on the number of vertex normal vectors.

Returns

the number of vertex normal vectors

inline unsigned int getVertexNumber() const

Accessor on the number of vertices.

Returns

the number of vertices

inline unsigned int getIndexNumber() const

Accessor on the number of indices.

Returns

the number of indices

void mergeVertices(bool aPrintDebugInfoFlag = false)

Merge the vertices of the mesh if the data is managed by the class instance, and if no index has been build.

void splitFaces(bool aPrintDebugInfoFlag = false)

Split each face into four faces.

VEC3 getVertex(unsigned int anIndex) const

Accessor on a given vertex.

Parameters

anIndex – the index of the vertex to access

Returns

the vertex

void setVertex(unsigned int anIndex, const VEC3 &aVertex)

Change the value of a given vertex.

Parameters
  • anIndex – the index of the vertex to access

  • aVertex – the new value of the vertex

inline void setFaceNormal(unsigned int anIndex, const VEC3 &aNormalVector)
inline void setVertexNormal(unsigned int anIndex, const VEC3 &aNormalVector)
int getIndex(unsigned int anIndex) const

Accessor on a given index.

Parameters

anIndex – the index of the index to access

Returns

the index

void setIndex(unsigned int anIndex, unsigned int aValue)

Set the value of a given index.

Parameters
  • anIndex – the index of the index to access

  • aValue – the new value of the index

inline VEC3 getFaceNormal(unsigned int anIndex) const

Accessor on a given face normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

inline VEC3 getVertexNormal(unsigned int anIndex) const

Accessor on a given vertex normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

void setExternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setVBOData(const void *aVertexArray, unsigned int aNumberOfVertices, unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO, unsigned int aNumberOfIndices, int anIndexDataType, const void *aIndexArray = NULL, const void *aNormalArray = NULL)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aIndexArray – array containing the index data

  • aNormalArray – array containing the normal data

void setInternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)
void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

inline void applyScale(const RATIONAL_NUMBER &aScale)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters

aScale – scaling factor

void applyScale(const RATIONAL_NUMBER &aScaleX, const RATIONAL_NUMBER &aScaleY, const RATIONAL_NUMBER &aScaleZ)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters
  • aScaleX – scaling factor alng the x-axis

  • aScaleY – scaling factor alng the y-axis

  • aScaleZ – scaling factor alng the z-axis

inline void invertNormalVectors()

Inverse the normal vectors.

virtual void updateVBO(int aTypeOfVBO, int aTypeOfPrimitive)

Update the VBO.

Parameters
  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

virtual void updateVBOs(unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO)

Update the VBOs with VBO already created.

Parameters
  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

inline const Material &getMaterial() const

Accessor on the material of the polygon mesh.

Returns

the material

inline Material &getMaterial()

Accessor on the material of the polygon mesh.

Returns

the material

void copyFrom(const PolygonMesh &aPolygonMesh)

Copy.

Parameters

aPolygonMesh – the polygon mesh to copy

virtual PolygonMesh operator+(const PolygonMesh &aPolygonMesh) const

operator+.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh operator+(const VEC3 &aTranslationVector) const

operator+.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const PolygonMesh &aPolygonMesh) const

operator-.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const VEC3 &aTranslationVector) const

operator-.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const PolygonMesh &aPolygonMesh)

operator+=.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const VEC3 &aTranslationVector)

operator+=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const PolygonMesh &aPolygonMesh)

operator-=.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const VEC3 &aTranslationVector)

operator-=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

std::map<RATIONAL_NUMBER, VEC3> rayIntersect(const VEC3 &aRayOrigin, const VEC3 &aRayDirection, const MATRIX4 &aTransformationMatrix) const
void getTriangleVertices(VEC3 &v0, VEC3 &v1, VEC3 &v2, unsigned int anIndex) const
inline bool hasNormalVectorsInverted() const

Check if the normal vectors have been inverted.

Returns

true if the normal vectors have been inverted; false otherwise.

Protected Functions

inline void computeBoundingBox()

Update the bounding box.

void normaliseNormals()

Normalise the normal vectors.

void destroyVertexData()

Release the memory held by the vertex data if needed.

void destroyIndexData()

Release the memory held by the index data if needed.

void removeIndex(bool aPrintDebugInfoFlag = false)

Remove the index.

void copyVertexSet(const void *apVertexSet)

Copy a vertex set.

void copyIndexSet(const void *apIndexSet)

Copy an index set.

void loadASCIISTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadBinarySTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadSTLDataFromBinaryStream(const char *apInputData, bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • apInputData – the input data to load

  • aMoveToCentreFlag – a flag to move the polygon to the centre or not

  • anAutoComputeNormalFlag – a flag to compute normals or nor

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

Protected Attributes

int m_use_texture

1 if the mesh use texturing; default value is 0

int m_use_bump_map

1 if the mesh use bump mapping; default value is 0

std::string m_label

A label to determine the type of the mesh.

std::string m_filename

Name of the file that contains the polygon mesh.

RATIONAL_NUMBER m_file_scale

Unit of length of the file that contains the polygon mesh (if negative, then unknown)

std::auto_ptr<VBO> m_p_vbo

Vertex buffer object.

std::auto_ptr<PolygonMesh> m_p_face_normal_vbo
std::auto_ptr<PolygonMesh> m_p_vertex_normal_vbo
PhotonCrossSection m_photon_cross_section

Material properties, with respect to X-ray.

VEC3 m_local_min_corner

Lower corner of the bounding box.

VEC3 m_local_max_corner

Upper corner of the bounding box.

std::vector<RATIONAL_NUMBER> m_p_vertex_normal_set

Array containing the normal vectors (one per triangle)

Array containing the normal vectors (one per vertex)

void *m_p_vertex_set

Array containing the vertices.

void *m_p_index_set

Array containing the index.

unsigned int m_number_of_indices

Number of indices.

unsigned int m_number_of_vertices

Number of vertices.

int m_index_data_type

Data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

int m_vertex_data_type

Data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

int m_polygon_type

Polygon type; valid values are GL_TRIANGLES.

bool m_external_data_flag

A flag set to true if the memory is managed outside of this class instance; set to false if the memory is managed by this class instance

bool m_display_flag

A flag set to true if you want to display in the Xray image

Material m_material

Material of the object.

bool m_has_inverted_normal_vectors

A flag set to true if the normal vectors are inverted.

class AssimpSceneGraphBinder : public gVirtualXRay::SceneGraphBinder

Public Functions

AssimpSceneGraphBinder()
AssimpSceneGraphBinder(const AssimpSceneGraphBinder &aSceneGraph)
AssimpSceneGraphBinder(const std::string &aFileName, RATIONAL_NUMBER aUnitOfLength)
AssimpSceneGraphBinder(const char *aFileName, RATIONAL_NUMBER aUnitOfLength)
virtual ~AssimpSceneGraphBinder()
AssimpSceneGraphBinder &operator=(const AssimpSceneGraphBinder &aSceneGraph)
virtual void loadSceneGraph(const char *aFileName, RATIONAL_NUMBER aUnitOfLength)
virtual void loadSceneGraph(const std::string &aFileName, RATIONAL_NUMBER aUnitOfLength)
void clear()
void display(GLint aShaderID)
void scale(const std::string &aNodeLabel, const VEC3 &aScalingFactorSet)
virtual void scale(const char *aNodeLabel, const VEC3 &aScalingFactorSet)
void rotate(const std::string &aNodeLabel, float aRotationAngleInDegrees, const VEC3 &aRotationAxis)
virtual void rotate(const char *aNodeLabel, float aRotationAngleInDegrees, const VEC3 &aRotationAxis)
void translate(const std::string &aNodeLabel, const VEC3 &aTranslationVector)
virtual void translate(const char *aNodeLabel, const VEC3 &aTranslationVector)
MATRIX4 getLocalTransformationMatrix(const std::string &aNodeLabel) const
MATRIX4 getLocalTransformationMatrix(const char *aNodeLabel) const
MATRIX4 getWorldTransformationMatrix(const std::string &aNodeLabel) const
MATRIX4 getWorldTransformationMatrix(const char *aNodeLabel) const
void moveToCentre(const std::string &aNodeLabel)
void moveToCentre(const char *aNodeLabel)
void moveToCentre()
void moveToCenter(const std::string &aNodeLabel)
void moveToCenter(const char *aNodeLabel)
void moveToCenter()
virtual MATRIX4 getRootNodeTransformationMatrix() const
virtual MATRIX4 getNodeLocalTransformationMatrix(const char *aNodeLabel) const
virtual MATRIX4 getNodeWorldTransformationMatrix(const char *aNodeLabel) const
virtual void setRootNodeTransformationMatrix(const MATRIX4 &aTransformationMatrix)
virtual void setNodeLocalTransformationMatrix(const char *aNodeLabel, const MATRIX4 &aTransformationMatrix)
std::pair<VEC3, VEC3> getBoundingBox()
void addPolygonMesh(const std::string &aLabel, const PolygonMesh &aPolygonMesh, const VEC3 &aPosition, const std::string &aParent = "root")
SceneGraphNode *getNode(const std::string &aLabel)
const SceneGraphNode *getNode(const std::string &aLabel) const

Protected Attributes

SceneGraphNode m_root_node
RATIONAL_NUMBER m_unit_of_length
class AtomicElement
#include <AtomicElement.h>

AtomicElement is a class to manage elements in material.

Public Functions

inline AtomicElement(const std::string &aName = "", const std::string &aSymbol = "", unsigned short aZNumber = 0, double aMolarMass = 0.0, double aDensity = 0.0, const std::string &aState = "")

Default Constructor.

inline AtomicElement(const AtomicElement &anElement)

Copy Constructor.

inline ~AtomicElement()

Destructor.

inline void setName(const std::string &aName)

Set the name of the element.

inline void setSymbol(const std::string &aSymbol)

Set the symbol of the element.

inline void setAtomicNumber(unsigned short aZNumber)

Set the atomic number (Z) of the element.

inline void setMolarMass(double aMolarMass)

Set the molar mass of the element.

inline void setDensity(double aDensity)

Set the density of the element.

inline void setState(const std::string &aState)

Set the state of the element.

inline double getMassAttenuationTotal(double anEnergy)

Get the mass attenuation coefficient at a given energy (values are interpolated).

inline double getMU(double anEnergy)

Get the linear attenuation coefficient at a given energy (in mm-1) (values are interpolated).

inline const std::string &getName() const

Accessor on the name of the element.

inline const std::string &getSymbol() const

Accessor on the symbol of the element.

inline unsigned short getAtomicNumber() const

Accessor on the atomic number (Z) of the element.

inline unsigned short getZ() const

Accessor on the atomic number (Z) of the element.

inline unsigned short Z() const

Accessor on the atomic number (Z) of the element.

inline double getMolarMass() const

Accessor on the molar mass of the element.

inline double getDensity() const

Accessor on the density of the element.

inline const std::string &getState() const

Accessor on the state of the element.

inline unsigned int getEnergyChannelNumber() const

Accessor on the number of energy channels in the attenuation coefficient list.

double getSmallestEnergyStep() const

Accessor on the smallest energy step in the linear attenuation coefficient list.

inline AtomicElement &operator=(const AtomicElement &anElement)

Copy operator.

inline double getEnergyChannel(unsigned int i) const
inline double getMassAttenuationCoefficientChannel(unsigned int i) const
void printSummary() const

Protected Attributes

std::string m_name

The name of the element.

std::string m_symbol

The symbol of the element.

unsigned short m_atomic_number

The atomic number of the element.

double m_molar_mass

The molar mass of the element.

double m_density

The density of the element.

std::string m_state

The state of the element.

std::vector<double> m_p_energy_set

The energy set.

std::vector<double> m_p_mass_attenuation_coefficient_set

The mass attenuation coefficient set corresponding to the energy set.

class AttenuationCoefficient

AttenuationCoefficient is a class to handle an attenuation coefficient.

Public Functions

inline AttenuationCoefficient(const RATIONAL_NUMBER &anEnergy = 0, const RATIONAL_NUMBER &anAttenuationCoefficient = 0)

Default constructor.

Parameters
  • anEnergy – the energy (default value: 0)

  • anAttenuationCoefficient – the attenuation coefficient (default value: 0)

inline RATIONAL_NUMBER getEnergy() const

Accessor on the energy.

Returns

the energy

inline RATIONAL_NUMBER getAttenuationCoefficient() const

Accessor on the attenuation coefficient.

Returns

the attenuation coefficient

Protected Attributes

RATIONAL_NUMBER m_energy

Energy.

RATIONAL_NUMBER m_mu

Attenuation coefficient corresponding to m_energy.

Friends

friend std::istream &operator>>(std::istream &is, AttenuationCoefficient &obj)

operator>>

Parameters
  • is – the input stream

  • obj – the record to load from the stream

Returns

the input stream

friend std::ostream &operator<<(std::ostream &os, const AttenuationCoefficient &obj)

operator<<

Parameters
  • os – the output stream

  • obj – the record to store in the stream

Returns

the output stream

class BoneMesh : public gVirtualXRay::InternalOrganMesh
#include <BoneMesh.h>

BoneMesh is a class to handle a polygon mesh for Bone, with thin bumps stored using a 3D texture.

Public Functions

BoneMesh(unsigned int texture_3D_size = 32)

Default Constructor.

virtual ~BoneMesh()

Destructor.

virtual bool isSoftTissue() const

return true if the mesh represent a soft tissue

virtual void updateVBO(int aTypeOfVBO, int aTypeOfPrimitive)

Update the VBO.

Parameters
  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

virtual void defineDisplayShaderInput(int shader_id)

Link the attributes to their id in the shader.

virtual void initialize()

Merge the vertices for optimization and a smoother display and create the bump map

virtual bool isTransparent() const

return true if the mesh has to be displayed with transparency

virtual void defineDisplayShaderInput(unsigned int aShaderID)

Link the attributes to their id in the shader.

virtual void splitFaces()

Split each face into four faces.

void splitFaces(bool aPrintDebugInfoFlag = false)

Split each face into four faces.

void copyFrom(const InternalOrganMesh &aPolygonMesh)
void copyFrom(const AnatomicalMesh &aPolygonMesh)
void copyFrom(const PolygonMesh &aPolygonMesh)

Copy.

Parameters

aPolygonMesh – the polygon mesh to copy

virtual const std::string &getLabel() const

Accessor on the label that determines the type of the mesh.

void reset()

Reset the data.

inline void resetVBOs()

Reset the VBOs only.

inline void setDisplayFlag(bool display)

Set if the mesh is displayed or not.

Parameters

display – true or false

inline bool getDisplayFlag() const

Accessor on the display flag of the polygon mesh.

Returns

display flag

void display()

Display the triangular mesh using OpenGL.

void displayWireFrame()

Display the triangular mesh in wireframe using OpenGL.

void displayFaceNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the face normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

void displayVertexNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the vertex normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

inline void setFilename(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFilename(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline const std::string &getFilename() const

Accessor on the name of the file that contains the polygon mesh.

Returns

the file name

inline const RATIONAL_NUMBER &getUnitOfLength() const

Accessor on the unit of length of the mesh.

Returns

the unit of length

void loadSTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void writeSTLFile(bool aBinaryFlag)

Write the STL file.

Parameters

aBinaryFlag – if true, save a binary file; if false save an ASCII file

inline void moveToCentre()

Move the polygon to the centre.

inline void moveToCenter()

Move the polygon to the center.

void computeNormalVectors()

Compute the normal vectors using the cross product method.

inline bool useVBO(int aBufferUsageHing, int aTypeOfPrimitive)

Use a vertex buffer object if possible.

Parameters
  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

Returns

true if the VBO can be used, false otherwise

inline void setHU(short HU)
inline void setHounsfieldUnit(short HU)
inline void setHounsfieldValue(short HU)
inline void setElement(unsigned short Z)
inline void setElement(const std::string &aName)
inline void setMixture(const Mixture &aMixture)
inline void setMixture(const std::map<int, double> &aMixture)
inline void setMixture(const std::map<std::string, double> &aMixture)
inline void setMixture(const std::string &aName)
inline void setCompound(const std::string &aName)
inline void setMassAttenuationCoefficient(double aCoefficient)
inline void setLinearAttenuationCoefficient(double aCoefficient)
inline void setDensity(double aDensity)
inline double getDensity()
inline const std::string &getMaterialLabel() const
inline std::string getCompound() const

Accessor on the compound description of the polygon mesh.

Returns

if the sample is made of a compound, then return the description of the compound (e.g. H2O for water), otherwise return an empty string

inline std::vector<int> getMixtureElementSet() const

Accessor on the element Z number set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element Z number set of the mixture, otherwise return an empty vector

inline std::vector<double> getMixtureWeightSet() const

Accessor on the element weight set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element weight set of the mixture, otherwise return an empty vector

inline const PhotonCrossSection &getPhotonCrossSection() const
inline void setPhotonCrossSection(const PhotonCrossSection &aPhotonCrossSection)
inline const VEC3 &getLocalMinCorner() const

Accessor on the bounding box lower corner.

Returns

the bounding box lower corner

inline const VEC3 &getLocalMaxCorner() const

Accessor on the bounding box upper corner.

Returns

the bounding box upper corner

inline void applyTranslation(const VEC3 &aTranslationVector)

Translate the polygon mesh given a translation vector, and update the VBO if needed.

Parameters

aTranslationVector – the translation vector

inline void applyScaling(RATIONAL_NUMBER x, RATIONAL_NUMBER y, RATIONAL_NUMBER z)

Scale the polygon mesh given scaling factors, and update the VBO if needed.

Parameters
  • x – the scaling factor along the X-axis

  • y – the scaling factor along the Y-axis

  • z – the scaling factor along the Z-axis

inline void applyRotation(const VEC3 &aRotationAxis, RATIONAL_NUMBER aRotationAngleInDegrees)

Rotate the polygon mesh given a rotation axis and angle, and update the VBO if needed.

Parameters
  • aRotationAxis – the rotation axis

  • aRotationAngleInDegrees – the rotation angle in degrees

inline void applyTransform(const MATRIX4 &aTransformationMatrix)

Transform the polygon mesh given a transformation matrix and update the VBO if needed.

Parameters

aTransformationMatrix – the transformation matrix

unsigned int getFaceNumber() const

Accessor on the number of faces.

Returns

the number of faces

unsigned int getTriangleNumber() const

Accessor on the number of triangles.

Returns

the number of triangles

inline unsigned int getFaceNormalNumber() const

Accessor on the number of face normal vectors.

Returns

the number of face normal vectors

inline unsigned int getVertexNormalNumber() const

Accessor on the number of vertex normal vectors.

Returns

the number of vertex normal vectors

inline unsigned int getVertexNumber() const

Accessor on the number of vertices.

Returns

the number of vertices

inline unsigned int getIndexNumber() const

Accessor on the number of indices.

Returns

the number of indices

void mergeVertices(bool aPrintDebugInfoFlag = false)

Merge the vertices of the mesh if the data is managed by the class instance, and if no index has been build.

VEC3 getVertex(unsigned int anIndex) const

Accessor on a given vertex.

Parameters

anIndex – the index of the vertex to access

Returns

the vertex

void setVertex(unsigned int anIndex, const VEC3 &aVertex)

Change the value of a given vertex.

Parameters
  • anIndex – the index of the vertex to access

  • aVertex – the new value of the vertex

inline void setFaceNormal(unsigned int anIndex, const VEC3 &aNormalVector)
inline void setVertexNormal(unsigned int anIndex, const VEC3 &aNormalVector)
int getIndex(unsigned int anIndex) const

Accessor on a given index.

Parameters

anIndex – the index of the index to access

Returns

the index

void setIndex(unsigned int anIndex, unsigned int aValue)

Set the value of a given index.

Parameters
  • anIndex – the index of the index to access

  • aValue – the new value of the index

inline VEC3 getFaceNormal(unsigned int anIndex) const

Accessor on a given face normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

inline VEC3 getVertexNormal(unsigned int anIndex) const

Accessor on a given vertex normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

void setExternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setVBOData(const void *aVertexArray, unsigned int aNumberOfVertices, unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO, unsigned int aNumberOfIndices, int anIndexDataType, const void *aIndexArray = NULL, const void *aNormalArray = NULL)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aIndexArray – array containing the index data

  • aNormalArray – array containing the normal data

void setInternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)
void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

inline void applyScale(const RATIONAL_NUMBER &aScale)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters

aScale – scaling factor

void applyScale(const RATIONAL_NUMBER &aScaleX, const RATIONAL_NUMBER &aScaleY, const RATIONAL_NUMBER &aScaleZ)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters
  • aScaleX – scaling factor alng the x-axis

  • aScaleY – scaling factor alng the y-axis

  • aScaleZ – scaling factor alng the z-axis

inline void invertNormalVectors()

Inverse the normal vectors.

virtual void updateVBOs(unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO)

Update the VBOs with VBO already created.

Parameters
  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

inline const Material &getMaterial() const

Accessor on the material of the polygon mesh.

Returns

the material

inline Material &getMaterial()

Accessor on the material of the polygon mesh.

Returns

the material

virtual PolygonMesh operator+(const PolygonMesh &aPolygonMesh) const

operator+.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh operator+(const VEC3 &aTranslationVector) const

operator+.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const PolygonMesh &aPolygonMesh) const

operator-.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const VEC3 &aTranslationVector) const

operator-.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const PolygonMesh &aPolygonMesh)

operator+=.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const VEC3 &aTranslationVector)

operator+=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const PolygonMesh &aPolygonMesh)

operator-=.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const VEC3 &aTranslationVector)

operator-=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

std::map<RATIONAL_NUMBER, VEC3> rayIntersect(const VEC3 &aRayOrigin, const VEC3 &aRayDirection, const MATRIX4 &aTransformationMatrix) const
void getTriangleVertices(VEC3 &v0, VEC3 &v1, VEC3 &v2, unsigned int anIndex) const
inline bool hasNormalVectorsInverted() const

Check if the normal vectors have been inverted.

Returns

true if the normal vectors have been inverted; false otherwise.

Protected Types

enum ToCreate

To know if a bump map or a colour texture has to be created.

Values:

enumerator TO_CREATE_BUMP_MAP
enumerator TO_CREATE_COLOUR_TEXTURE

Protected Functions

virtual void generateTextures()

generates the textures

virtual void defineBumpMapShaderInput(int shader_id)

Link the attributes to their id in the shader bump map generation.

virtual void defineColourTextureShaderInput(int shader_id)

Link the attributes to their id in the shader for colour texture generation

virtual void generate2DTexture(Shader const &shader, unsigned int &frame_buffer, ToCreate to_create)

generates a 2D texture

virtual void generate3DTexture(Shader const &shader, unsigned int &frame_buffer, unsigned int &texture, ToCreate to_create)

generates a 3D texture

virtual void initialize2DBuffer(unsigned int &aTexture, unsigned int &aFrameBuffer)

initialize a 2D frame buffer and bind a texture to it

virtual void initialize3DBuffer(unsigned int &aTexture, unsigned int &aFrameBuffer, bool has_colours)

initialize a 3D frame buffer and bind a texture to its layer 0

virtual void load2DBumpShader()

Load the shader to create the 2D bump map.

virtual void load3DBumpShader()

Load the shader to create the 3D bump map.

virtual void initialize2DTextureCoordinates()

Initialise optimised texture coordinates by sharing an hypothenuse in the texture for two adjacent polygons.

virtual void initialize3DTextureCoordinates()

Initialise 3D texture coordinates.

virtual void shareNormalVectors()

Compute a normal vector per vertex for a smoother display.

virtual void deleteIndices()

delete the indices and calculate new normal vectors

virtual void initGradientTab()

initialize gradient tab for gnoise

virtual void initPermutation()

initialize permutation tab for all noises

inline void computeBoundingBox()

Update the bounding box.

void normaliseNormals()

Normalise the normal vectors.

void destroyVertexData()

Release the memory held by the vertex data if needed.

void destroyIndexData()

Release the memory held by the index data if needed.

void removeIndex(bool aPrintDebugInfoFlag = false)

Remove the index.

void copyVertexSet(const void *apVertexSet)

Copy a vertex set.

void copyIndexSet(const void *apIndexSet)

Copy an index set.

void loadASCIISTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadBinarySTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadSTLDataFromBinaryStream(const char *apInputData, bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • apInputData – the input data to load

  • aMoveToCentreFlag – a flag to move the polygon to the centre or not

  • anAutoComputeNormalFlag – a flag to compute normals or nor

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

Protected Attributes

std::vector<VEC3> m_gradient_tab
std::vector<int> m_permutation
std::vector<VEC2> m_texture_coordinates_2d
std::vector<VEC3> m_texture_coordinates_3d
std::vector<VEC2> m_margin_direction
unsigned int m_bump_map_texture
unsigned int m_bump_map_frame_buffer
Shader m_bump_map_shader
int m_has_tendon
int m_is_lung
int m_has_thin_bumps
int m_use_3D_bump_map
unsigned int m_texture_size_2d
unsigned int m_texture_size_3d
bool m_need_initialize
bool m_generation_texture_coord_are_set
bool m_optimize_texture_coordinates
int m_use_texture

1 if the mesh use texturing; default value is 0

int m_use_bump_map

1 if the mesh use bump mapping; default value is 0

std::string m_label

A label to determine the type of the mesh.

std::string m_filename

Name of the file that contains the polygon mesh.

RATIONAL_NUMBER m_file_scale

Unit of length of the file that contains the polygon mesh (if negative, then unknown)

std::auto_ptr<VBO> m_p_vbo

Vertex buffer object.

std::auto_ptr<PolygonMesh> m_p_face_normal_vbo
std::auto_ptr<PolygonMesh> m_p_vertex_normal_vbo
PhotonCrossSection m_photon_cross_section

Material properties, with respect to X-ray.

VEC3 m_local_min_corner

Lower corner of the bounding box.

VEC3 m_local_max_corner

Upper corner of the bounding box.

std::vector<RATIONAL_NUMBER> m_p_vertex_normal_set

Array containing the normal vectors (one per triangle)

Array containing the normal vectors (one per vertex)

void *m_p_vertex_set

Array containing the vertices.

void *m_p_index_set

Array containing the index.

unsigned int m_number_of_indices

Number of indices.

unsigned int m_number_of_vertices

Number of vertices.

int m_index_data_type

Data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

int m_vertex_data_type

Data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

int m_polygon_type

Polygon type; valid values are GL_TRIANGLES.

bool m_external_data_flag

A flag set to true if the memory is managed outside of this class instance; set to false if the memory is managed by this class instance

bool m_display_flag

A flag set to true if you want to display in the Xray image

Material m_material

Material of the object.

bool m_has_inverted_normal_vectors

A flag set to true if the normal vectors are inverted.

class Character

Character is a class to handle characters rendered using OpenGL and FreeType2.

Public Functions

inline Character(unsigned int aTextureID = 0, int aWidth = 0, int aHeight = 0, float aVX = 0, float aVY = 0, float aXOffset = 0, float aYOffset = 0)

Default constructor.

Parameters
  • aTextureID – the ID of the texture (default value: 0)

  • aWidth – the width of the bitmap (default value: 0)

  • aHeight – the height of the bitmap (default value: 0)

  • aVX – the horizontal alignment parameter (default value: 0)

  • aVY – the vertical alignment parameter (default value: 0)

  • aXOffset – the horizontal offset (default value: 0)

  • aYOffset – the vertical offset (default value: 0)

inline virtual ~Character()

Destructor.

inline void release()

Public Members

unsigned int m_texture_id

The ID of the texture.

int m_width

The width of the bitmap.

int m_height

The height of the bitmap.

float m_vx

The horizontal alignment parameter.

float m_vy

The vertical alignment parameter.

float m_x_offset

The horizontal offset.

float m_y_offset

The vertical offset.

class Context
#include <Context.h>

Context is a class to manage an OpenGL or Vulkan context.

Public Functions

Context()

Default Constructor.

Context(const std::string &aRenderer, int aRendererMajorVersion, int aRendererMinorVersion)

Default Constructor.

~Context()

Destructor.

void create(const std::string &aRenderer = "OpenGL", int aRendererMajorVersion = 3, int aRendererMinorVersion = 2)

Create a new context.

void release()

Destroy the context.

void destroy()

Destroy the context.

bool isReady() const

Public Static Functions

static unsigned int getNumberOfEGLDevices()

Accessor on the number of EGL devices.

static std::vector<std::string> findEGLClients()

Accessor on the list of supported EGL clients.

Private Functions

void createGLWithGLX()

Create an OpenGL context using GLX.

void createGLWithEGL()

Create an OpenGL context using EGL.

void createGLWithGLFW(int aVisibilityFlag = 0)

Create an OpenGL context using GLFW.

void createVulkanWithGLFW(int aVisibilityFlag = 0)

Create a Vulkan context using GLFW.

Private Members

std::string m_renderer
int m_major_version
int m_minor_version
bool m_ready
class CoordinateSystemMesh

CoordinateSystemMesh is a class to handle the display of coordinate system axes in the visualisation.

Public Functions

inline CoordinateSystemMesh(RATIONAL_NUMBER aLength = 1.0 * cm)

Default constructor.

inline ~CoordinateSystemMesh()

Destructor.

inline void release()

Release the data.

void display(GLuint aShaderID)

Display the coordinate system axes using OpenGL.

inline void setLength(const RATIONAL_NUMBER &aLength)

Set the length of axes (in units of length)

Parameters

aLength – the length

inline const RATIONAL_NUMBER &getLength() const

Accessor on the length of axes (in units of length)

Returns

the length

Private Functions

void updateVBOs()

Update the VBOs.

Private Members

RATIONAL_NUMBER m_length
LineMesh<float> m_x_axis_geometry

The triangle mesh corresponding to the X-axis.

LineMesh<float> m_y_axis_geometry

The triangle mesh corresponding to the Y-axis.

LineMesh<float> m_z_axis_geometry

The triangle mesh corresponding to the Z-axis.

template<typename T>
class CubeMesh : public gVirtualXRay::PolygonMesh
#include <CubeMesh.h>

CubeMesh is a class to handle 3D meshes of cubes.

Public Functions

CubeMesh(double aLength = 1.0 * cm, int anIndexDataType = 0)

Default constructor.

void create(double aLength = 1.0 * cm, int anIndexDataType = 0)

Create a new cube.

void reset()

Reset the data.

inline void resetVBOs()

Reset the VBOs only.

inline void setDisplayFlag(bool display)

Set if the mesh is displayed or not.

Parameters

display – true or false

inline bool getDisplayFlag() const

Accessor on the display flag of the polygon mesh.

Returns

display flag

void display()

Display the triangular mesh using OpenGL.

void displayWireFrame()

Display the triangular mesh in wireframe using OpenGL.

void displayFaceNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the face normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

void displayVertexNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the vertex normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

inline void setFilename(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFilename(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline const std::string &getFilename() const

Accessor on the name of the file that contains the polygon mesh.

Returns

the file name

inline const RATIONAL_NUMBER &getUnitOfLength() const

Accessor on the unit of length of the mesh.

Returns

the unit of length

void loadSTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void writeSTLFile(bool aBinaryFlag)

Write the STL file.

Parameters

aBinaryFlag – if true, save a binary file; if false save an ASCII file

inline void moveToCentre()

Move the polygon to the centre.

inline void moveToCenter()

Move the polygon to the center.

void computeNormalVectors()

Compute the normal vectors using the cross product method.

inline bool useVBO(int aBufferUsageHing, int aTypeOfPrimitive)

Use a vertex buffer object if possible.

Parameters
  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

Returns

true if the VBO can be used, false otherwise

inline void setHU(short HU)
inline void setHounsfieldUnit(short HU)
inline void setHounsfieldValue(short HU)
inline void setElement(unsigned short Z)
inline void setElement(const std::string &aName)
inline void setMixture(const Mixture &aMixture)
inline void setMixture(const std::map<int, double> &aMixture)
inline void setMixture(const std::map<std::string, double> &aMixture)
inline void setMixture(const std::string &aName)
inline void setCompound(const std::string &aName)
inline void setMassAttenuationCoefficient(double aCoefficient)
inline void setLinearAttenuationCoefficient(double aCoefficient)
inline void setDensity(double aDensity)
inline double getDensity()
inline const std::string &getMaterialLabel() const
inline std::string getCompound() const

Accessor on the compound description of the polygon mesh.

Returns

if the sample is made of a compound, then return the description of the compound (e.g. H2O for water), otherwise return an empty string

inline std::vector<int> getMixtureElementSet() const

Accessor on the element Z number set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element Z number set of the mixture, otherwise return an empty vector

inline std::vector<double> getMixtureWeightSet() const

Accessor on the element weight set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element weight set of the mixture, otherwise return an empty vector

inline const PhotonCrossSection &getPhotonCrossSection() const
inline void setPhotonCrossSection(const PhotonCrossSection &aPhotonCrossSection)
inline const VEC3 &getLocalMinCorner() const

Accessor on the bounding box lower corner.

Returns

the bounding box lower corner

inline const VEC3 &getLocalMaxCorner() const

Accessor on the bounding box upper corner.

Returns

the bounding box upper corner

inline void applyTranslation(const VEC3 &aTranslationVector)

Translate the polygon mesh given a translation vector, and update the VBO if needed.

Parameters

aTranslationVector – the translation vector

inline void applyScaling(RATIONAL_NUMBER x, RATIONAL_NUMBER y, RATIONAL_NUMBER z)

Scale the polygon mesh given scaling factors, and update the VBO if needed.

Parameters
  • x – the scaling factor along the X-axis

  • y – the scaling factor along the Y-axis

  • z – the scaling factor along the Z-axis

inline void applyRotation(const VEC3 &aRotationAxis, RATIONAL_NUMBER aRotationAngleInDegrees)

Rotate the polygon mesh given a rotation axis and angle, and update the VBO if needed.

Parameters
  • aRotationAxis – the rotation axis

  • aRotationAngleInDegrees – the rotation angle in degrees

inline void applyTransform(const MATRIX4 &aTransformationMatrix)

Transform the polygon mesh given a transformation matrix and update the VBO if needed.

Parameters

aTransformationMatrix – the transformation matrix

unsigned int getFaceNumber() const

Accessor on the number of faces.

Returns

the number of faces

unsigned int getTriangleNumber() const

Accessor on the number of triangles.

Returns

the number of triangles

inline unsigned int getFaceNormalNumber() const

Accessor on the number of face normal vectors.

Returns

the number of face normal vectors

inline unsigned int getVertexNormalNumber() const

Accessor on the number of vertex normal vectors.

Returns

the number of vertex normal vectors

inline unsigned int getVertexNumber() const

Accessor on the number of vertices.

Returns

the number of vertices

inline unsigned int getIndexNumber() const

Accessor on the number of indices.

Returns

the number of indices

void mergeVertices(bool aPrintDebugInfoFlag = false)

Merge the vertices of the mesh if the data is managed by the class instance, and if no index has been build.

void splitFaces(bool aPrintDebugInfoFlag = false)

Split each face into four faces.

VEC3 getVertex(unsigned int anIndex) const

Accessor on a given vertex.

Parameters

anIndex – the index of the vertex to access

Returns

the vertex

void setVertex(unsigned int anIndex, const VEC3 &aVertex)

Change the value of a given vertex.

Parameters
  • anIndex – the index of the vertex to access

  • aVertex – the new value of the vertex

inline void setFaceNormal(unsigned int anIndex, const VEC3 &aNormalVector)
inline void setVertexNormal(unsigned int anIndex, const VEC3 &aNormalVector)
int getIndex(unsigned int anIndex) const

Accessor on a given index.

Parameters

anIndex – the index of the index to access

Returns

the index

void setIndex(unsigned int anIndex, unsigned int aValue)

Set the value of a given index.

Parameters
  • anIndex – the index of the index to access

  • aValue – the new value of the index

inline VEC3 getFaceNormal(unsigned int anIndex) const

Accessor on a given face normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

inline VEC3 getVertexNormal(unsigned int anIndex) const

Accessor on a given vertex normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

void setExternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setVBOData(const void *aVertexArray, unsigned int aNumberOfVertices, unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO, unsigned int aNumberOfIndices, int anIndexDataType, const void *aIndexArray = NULL, const void *aNormalArray = NULL)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aIndexArray – array containing the index data

  • aNormalArray – array containing the normal data

void setInternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)
void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

inline void applyScale(const RATIONAL_NUMBER &aScale)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters

aScale – scaling factor

void applyScale(const RATIONAL_NUMBER &aScaleX, const RATIONAL_NUMBER &aScaleY, const RATIONAL_NUMBER &aScaleZ)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters
  • aScaleX – scaling factor alng the x-axis

  • aScaleY – scaling factor alng the y-axis

  • aScaleZ – scaling factor alng the z-axis

inline void invertNormalVectors()

Inverse the normal vectors.

virtual void updateVBO(int aTypeOfVBO, int aTypeOfPrimitive)

Update the VBO.

Parameters
  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

virtual void updateVBOs(unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO)

Update the VBOs with VBO already created.

Parameters
  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

inline const Material &getMaterial() const

Accessor on the material of the polygon mesh.

Returns

the material

inline Material &getMaterial()

Accessor on the material of the polygon mesh.

Returns

the material

void copyFrom(const PolygonMesh &aPolygonMesh)

Copy.

Parameters

aPolygonMesh – the polygon mesh to copy

virtual PolygonMesh operator+(const PolygonMesh &aPolygonMesh) const

operator+.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh operator+(const VEC3 &aTranslationVector) const

operator+.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const PolygonMesh &aPolygonMesh) const

operator-.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const VEC3 &aTranslationVector) const

operator-.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const PolygonMesh &aPolygonMesh)

operator+=.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const VEC3 &aTranslationVector)

operator+=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const PolygonMesh &aPolygonMesh)

operator-=.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const VEC3 &aTranslationVector)

operator-=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

std::map<RATIONAL_NUMBER, VEC3> rayIntersect(const VEC3 &aRayOrigin, const VEC3 &aRayDirection, const MATRIX4 &aTransformationMatrix) const
void getTriangleVertices(VEC3 &v0, VEC3 &v1, VEC3 &v2, unsigned int anIndex) const
inline bool hasNormalVectorsInverted() const

Check if the normal vectors have been inverted.

Returns

true if the normal vectors have been inverted; false otherwise.

Protected Functions

inline void computeBoundingBox()

Update the bounding box.

void normaliseNormals()

Normalise the normal vectors.

void destroyVertexData()

Release the memory held by the vertex data if needed.

void destroyIndexData()

Release the memory held by the index data if needed.

void removeIndex(bool aPrintDebugInfoFlag = false)

Remove the index.

void copyVertexSet(const void *apVertexSet)

Copy a vertex set.

void copyIndexSet(const void *apIndexSet)

Copy an index set.

void loadASCIISTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadBinarySTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadSTLDataFromBinaryStream(const char *apInputData, bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • apInputData – the input data to load

  • aMoveToCentreFlag – a flag to move the polygon to the centre or not

  • anAutoComputeNormalFlag – a flag to compute normals or nor

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

Protected Attributes

std::string m_filename

Name of the file that contains the polygon mesh.

RATIONAL_NUMBER m_file_scale

Unit of length of the file that contains the polygon mesh (if negative, then unknown)

std::auto_ptr<VBO> m_p_vbo

Vertex buffer object.

std::auto_ptr<PolygonMesh> m_p_face_normal_vbo
std::auto_ptr<PolygonMesh> m_p_vertex_normal_vbo
PhotonCrossSection m_photon_cross_section

Material properties, with respect to X-ray.

VEC3 m_local_min_corner

Lower corner of the bounding box.

VEC3 m_local_max_corner

Upper corner of the bounding box.

std::vector<RATIONAL_NUMBER> m_p_vertex_normal_set

Array containing the normal vectors (one per triangle)

Array containing the normal vectors (one per vertex)

void *m_p_vertex_set

Array containing the vertices.

void *m_p_index_set

Array containing the index.

unsigned int m_number_of_indices

Number of indices.

unsigned int m_number_of_vertices

Number of vertices.

int m_index_data_type

Data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

int m_vertex_data_type

Data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

int m_polygon_type

Polygon type; valid values are GL_TRIANGLES.

bool m_external_data_flag

A flag set to true if the memory is managed outside of this class instance; set to false if the memory is managed by this class instance

bool m_display_flag

A flag set to true if you want to display in the Xray image

Material m_material

Material of the object.

bool m_has_inverted_normal_vectors

A flag set to true if the normal vectors are inverted.

template<typename T>
class CuboidMesh : public gVirtualXRay::PolygonMesh
#include <CuboidMesh.h>

CuboidMesh is a class to handle 3D meshes of cuboids.

Public Functions

CuboidMesh(double aWidth = 1.0 * cm, double aHeight = 1.0 * cm, double aDepth = 1.0 * cm, int anIndexDataType = 0)

Default constructor.

void create(double aWidth = 1.0 * cm, double aHeight = 1.0 * cm, double aDepth = 1.0 * cm, int anIndexDataType = 0)

Create a new cuboid.

void reset()

Reset the data.

inline void resetVBOs()

Reset the VBOs only.

inline void setDisplayFlag(bool display)

Set if the mesh is displayed or not.

Parameters

display – true or false

inline bool getDisplayFlag() const

Accessor on the display flag of the polygon mesh.

Returns

display flag

void display()

Display the triangular mesh using OpenGL.

void displayWireFrame()

Display the triangular mesh in wireframe using OpenGL.

void displayFaceNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the face normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

void displayVertexNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the vertex normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

inline void setFilename(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFilename(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline const std::string &getFilename() const

Accessor on the name of the file that contains the polygon mesh.

Returns

the file name

inline const RATIONAL_NUMBER &getUnitOfLength() const

Accessor on the unit of length of the mesh.

Returns

the unit of length

void loadSTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void writeSTLFile(bool aBinaryFlag)

Write the STL file.

Parameters

aBinaryFlag – if true, save a binary file; if false save an ASCII file

inline void moveToCentre()

Move the polygon to the centre.

inline void moveToCenter()

Move the polygon to the center.

void computeNormalVectors()

Compute the normal vectors using the cross product method.

inline bool useVBO(int aBufferUsageHing, int aTypeOfPrimitive)

Use a vertex buffer object if possible.

Parameters
  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

Returns

true if the VBO can be used, false otherwise

inline void setHU(short HU)
inline void setHounsfieldUnit(short HU)
inline void setHounsfieldValue(short HU)
inline void setElement(unsigned short Z)
inline void setElement(const std::string &aName)
inline void setMixture(const Mixture &aMixture)
inline void setMixture(const std::map<int, double> &aMixture)
inline void setMixture(const std::map<std::string, double> &aMixture)
inline void setMixture(const std::string &aName)
inline void setCompound(const std::string &aName)
inline void setMassAttenuationCoefficient(double aCoefficient)
inline void setLinearAttenuationCoefficient(double aCoefficient)
inline void setDensity(double aDensity)
inline double getDensity()
inline const std::string &getMaterialLabel() const
inline std::string getCompound() const

Accessor on the compound description of the polygon mesh.

Returns

if the sample is made of a compound, then return the description of the compound (e.g. H2O for water), otherwise return an empty string

inline std::vector<int> getMixtureElementSet() const

Accessor on the element Z number set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element Z number set of the mixture, otherwise return an empty vector

inline std::vector<double> getMixtureWeightSet() const

Accessor on the element weight set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element weight set of the mixture, otherwise return an empty vector

inline const PhotonCrossSection &getPhotonCrossSection() const
inline void setPhotonCrossSection(const PhotonCrossSection &aPhotonCrossSection)
inline const VEC3 &getLocalMinCorner() const

Accessor on the bounding box lower corner.

Returns

the bounding box lower corner

inline const VEC3 &getLocalMaxCorner() const

Accessor on the bounding box upper corner.

Returns

the bounding box upper corner

inline void applyTranslation(const VEC3 &aTranslationVector)

Translate the polygon mesh given a translation vector, and update the VBO if needed.

Parameters

aTranslationVector – the translation vector

inline void applyScaling(RATIONAL_NUMBER x, RATIONAL_NUMBER y, RATIONAL_NUMBER z)

Scale the polygon mesh given scaling factors, and update the VBO if needed.

Parameters
  • x – the scaling factor along the X-axis

  • y – the scaling factor along the Y-axis

  • z – the scaling factor along the Z-axis

inline void applyRotation(const VEC3 &aRotationAxis, RATIONAL_NUMBER aRotationAngleInDegrees)

Rotate the polygon mesh given a rotation axis and angle, and update the VBO if needed.

Parameters
  • aRotationAxis – the rotation axis

  • aRotationAngleInDegrees – the rotation angle in degrees

inline void applyTransform(const MATRIX4 &aTransformationMatrix)

Transform the polygon mesh given a transformation matrix and update the VBO if needed.

Parameters

aTransformationMatrix – the transformation matrix

unsigned int getFaceNumber() const

Accessor on the number of faces.

Returns

the number of faces

unsigned int getTriangleNumber() const

Accessor on the number of triangles.

Returns

the number of triangles

inline unsigned int getFaceNormalNumber() const

Accessor on the number of face normal vectors.

Returns

the number of face normal vectors

inline unsigned int getVertexNormalNumber() const

Accessor on the number of vertex normal vectors.

Returns

the number of vertex normal vectors

inline unsigned int getVertexNumber() const

Accessor on the number of vertices.

Returns

the number of vertices

inline unsigned int getIndexNumber() const

Accessor on the number of indices.

Returns

the number of indices

void mergeVertices(bool aPrintDebugInfoFlag = false)

Merge the vertices of the mesh if the data is managed by the class instance, and if no index has been build.

void splitFaces(bool aPrintDebugInfoFlag = false)

Split each face into four faces.

VEC3 getVertex(unsigned int anIndex) const

Accessor on a given vertex.

Parameters

anIndex – the index of the vertex to access

Returns

the vertex

void setVertex(unsigned int anIndex, const VEC3 &aVertex)

Change the value of a given vertex.

Parameters
  • anIndex – the index of the vertex to access

  • aVertex – the new value of the vertex

inline void setFaceNormal(unsigned int anIndex, const VEC3 &aNormalVector)
inline void setVertexNormal(unsigned int anIndex, const VEC3 &aNormalVector)
int getIndex(unsigned int anIndex) const

Accessor on a given index.

Parameters

anIndex – the index of the index to access

Returns

the index

void setIndex(unsigned int anIndex, unsigned int aValue)

Set the value of a given index.

Parameters
  • anIndex – the index of the index to access

  • aValue – the new value of the index

inline VEC3 getFaceNormal(unsigned int anIndex) const

Accessor on a given face normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

inline VEC3 getVertexNormal(unsigned int anIndex) const

Accessor on a given vertex normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

void setExternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setVBOData(const void *aVertexArray, unsigned int aNumberOfVertices, unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO, unsigned int aNumberOfIndices, int anIndexDataType, const void *aIndexArray = NULL, const void *aNormalArray = NULL)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aIndexArray – array containing the index data

  • aNormalArray – array containing the normal data

void setInternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)
void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

inline void applyScale(const RATIONAL_NUMBER &aScale)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters

aScale – scaling factor

void applyScale(const RATIONAL_NUMBER &aScaleX, const RATIONAL_NUMBER &aScaleY, const RATIONAL_NUMBER &aScaleZ)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters
  • aScaleX – scaling factor alng the x-axis

  • aScaleY – scaling factor alng the y-axis

  • aScaleZ – scaling factor alng the z-axis

inline void invertNormalVectors()

Inverse the normal vectors.

virtual void updateVBO(int aTypeOfVBO, int aTypeOfPrimitive)

Update the VBO.

Parameters
  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

virtual void updateVBOs(unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO)

Update the VBOs with VBO already created.

Parameters
  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

inline const Material &getMaterial() const

Accessor on the material of the polygon mesh.

Returns

the material

inline Material &getMaterial()

Accessor on the material of the polygon mesh.

Returns

the material

void copyFrom(const PolygonMesh &aPolygonMesh)

Copy.

Parameters

aPolygonMesh – the polygon mesh to copy

virtual PolygonMesh operator+(const PolygonMesh &aPolygonMesh) const

operator+.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh operator+(const VEC3 &aTranslationVector) const

operator+.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const PolygonMesh &aPolygonMesh) const

operator-.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const VEC3 &aTranslationVector) const

operator-.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const PolygonMesh &aPolygonMesh)

operator+=.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const VEC3 &aTranslationVector)

operator+=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const PolygonMesh &aPolygonMesh)

operator-=.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const VEC3 &aTranslationVector)

operator-=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

std::map<RATIONAL_NUMBER, VEC3> rayIntersect(const VEC3 &aRayOrigin, const VEC3 &aRayDirection, const MATRIX4 &aTransformationMatrix) const
void getTriangleVertices(VEC3 &v0, VEC3 &v1, VEC3 &v2, unsigned int anIndex) const
inline bool hasNormalVectorsInverted() const

Check if the normal vectors have been inverted.

Returns

true if the normal vectors have been inverted; false otherwise.

Protected Functions

inline void computeBoundingBox()

Update the bounding box.

void normaliseNormals()

Normalise the normal vectors.

void destroyVertexData()

Release the memory held by the vertex data if needed.

void destroyIndexData()

Release the memory held by the index data if needed.

void removeIndex(bool aPrintDebugInfoFlag = false)

Remove the index.

void copyVertexSet(const void *apVertexSet)

Copy a vertex set.

void copyIndexSet(const void *apIndexSet)

Copy an index set.

void loadASCIISTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadBinarySTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadSTLDataFromBinaryStream(const char *apInputData, bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • apInputData – the input data to load

  • aMoveToCentreFlag – a flag to move the polygon to the centre or not

  • anAutoComputeNormalFlag – a flag to compute normals or nor

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

Protected Attributes

std::string m_filename

Name of the file that contains the polygon mesh.

RATIONAL_NUMBER m_file_scale

Unit of length of the file that contains the polygon mesh (if negative, then unknown)

std::auto_ptr<VBO> m_p_vbo

Vertex buffer object.

std::auto_ptr<PolygonMesh> m_p_face_normal_vbo
std::auto_ptr<PolygonMesh> m_p_vertex_normal_vbo
PhotonCrossSection m_photon_cross_section

Material properties, with respect to X-ray.

VEC3 m_local_min_corner

Lower corner of the bounding box.

VEC3 m_local_max_corner

Upper corner of the bounding box.

std::vector<RATIONAL_NUMBER> m_p_vertex_normal_set

Array containing the normal vectors (one per triangle)

Array containing the normal vectors (one per vertex)

void *m_p_vertex_set

Array containing the vertices.

void *m_p_index_set

Array containing the index.

unsigned int m_number_of_indices

Number of indices.

unsigned int m_number_of_vertices

Number of vertices.

int m_index_data_type

Data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

int m_vertex_data_type

Data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

int m_polygon_type

Polygon type; valid values are GL_TRIANGLES.

bool m_external_data_flag

A flag set to true if the memory is managed outside of this class instance; set to false if the memory is managed by this class instance

bool m_display_flag

A flag set to true if you want to display in the Xray image

Material m_material

Material of the object.

bool m_has_inverted_normal_vectors

A flag set to true if the normal vectors are inverted.

template<typename T>
class CylinderMesh : public gVirtualXRay::PolygonMesh
#include <CylinderMesh.h>

CylinderMesh is a class to handle 3D meshes of cylinders.

Public Functions

CylinderMesh(unsigned int aNumberOfSectors = 10, double aHeight = 1.0 * cm, double aRadius = 0.5 * cm, int anIndexDataType = 0)

Default constructor.

Parameters
  • aNumberOfSectors – the number of sectors (default value: 10)

  • aHeight – the height (default value: 1.0 cm)

  • aRadius – the radius (default value: 0.5 cm)

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

void create(unsigned int aNumberOfSectors = 10, double aHeight = 1.0 * cm, double aRadius = 0.5 * cm, int anIndexDataType = 0)

Create a new sphere.

Parameters
  • aNumberOfSectors – the number of sectors (default value: 10)

  • aHeight – the height (default value: 1.0 cm)

  • aRadius – the radius (default value: 0.5 cm)

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

void reset()

Reset the data.

inline void resetVBOs()

Reset the VBOs only.

inline void setDisplayFlag(bool display)

Set if the mesh is displayed or not.

Parameters

display – true or false

inline bool getDisplayFlag() const

Accessor on the display flag of the polygon mesh.

Returns

display flag

void display()

Display the triangular mesh using OpenGL.

void displayWireFrame()

Display the triangular mesh in wireframe using OpenGL.

void displayFaceNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the face normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

void displayVertexNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the vertex normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

inline void setFilename(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFilename(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline const std::string &getFilename() const

Accessor on the name of the file that contains the polygon mesh.

Returns

the file name

inline const RATIONAL_NUMBER &getUnitOfLength() const

Accessor on the unit of length of the mesh.

Returns

the unit of length

void loadSTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void writeSTLFile(bool aBinaryFlag)

Write the STL file.

Parameters

aBinaryFlag – if true, save a binary file; if false save an ASCII file

inline void moveToCentre()

Move the polygon to the centre.

inline void moveToCenter()

Move the polygon to the center.

void computeNormalVectors()

Compute the normal vectors using the cross product method.

inline bool useVBO(int aBufferUsageHing, int aTypeOfPrimitive)

Use a vertex buffer object if possible.

Parameters
  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

Returns

true if the VBO can be used, false otherwise

inline void setHU(short HU)
inline void setHounsfieldUnit(short HU)
inline void setHounsfieldValue(short HU)
inline void setElement(unsigned short Z)
inline void setElement(const std::string &aName)
inline void setMixture(const Mixture &aMixture)
inline void setMixture(const std::map<int, double> &aMixture)
inline void setMixture(const std::map<std::string, double> &aMixture)
inline void setMixture(const std::string &aName)
inline void setCompound(const std::string &aName)
inline void setMassAttenuationCoefficient(double aCoefficient)
inline void setLinearAttenuationCoefficient(double aCoefficient)
inline void setDensity(double aDensity)
inline double getDensity()
inline const std::string &getMaterialLabel() const
inline std::string getCompound() const

Accessor on the compound description of the polygon mesh.

Returns

if the sample is made of a compound, then return the description of the compound (e.g. H2O for water), otherwise return an empty string

inline std::vector<int> getMixtureElementSet() const

Accessor on the element Z number set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element Z number set of the mixture, otherwise return an empty vector

inline std::vector<double> getMixtureWeightSet() const

Accessor on the element weight set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element weight set of the mixture, otherwise return an empty vector

inline const PhotonCrossSection &getPhotonCrossSection() const
inline void setPhotonCrossSection(const PhotonCrossSection &aPhotonCrossSection)
inline const VEC3 &getLocalMinCorner() const

Accessor on the bounding box lower corner.

Returns

the bounding box lower corner

inline const VEC3 &getLocalMaxCorner() const

Accessor on the bounding box upper corner.

Returns

the bounding box upper corner

inline void applyTranslation(const VEC3 &aTranslationVector)

Translate the polygon mesh given a translation vector, and update the VBO if needed.

Parameters

aTranslationVector – the translation vector

inline void applyScaling(RATIONAL_NUMBER x, RATIONAL_NUMBER y, RATIONAL_NUMBER z)

Scale the polygon mesh given scaling factors, and update the VBO if needed.

Parameters
  • x – the scaling factor along the X-axis

  • y – the scaling factor along the Y-axis

  • z – the scaling factor along the Z-axis

inline void applyRotation(const VEC3 &aRotationAxis, RATIONAL_NUMBER aRotationAngleInDegrees)

Rotate the polygon mesh given a rotation axis and angle, and update the VBO if needed.

Parameters
  • aRotationAxis – the rotation axis

  • aRotationAngleInDegrees – the rotation angle in degrees

inline void applyTransform(const MATRIX4 &aTransformationMatrix)

Transform the polygon mesh given a transformation matrix and update the VBO if needed.

Parameters

aTransformationMatrix – the transformation matrix

unsigned int getFaceNumber() const

Accessor on the number of faces.

Returns

the number of faces

unsigned int getTriangleNumber() const

Accessor on the number of triangles.

Returns

the number of triangles

inline unsigned int getFaceNormalNumber() const

Accessor on the number of face normal vectors.

Returns

the number of face normal vectors

inline unsigned int getVertexNormalNumber() const

Accessor on the number of vertex normal vectors.

Returns

the number of vertex normal vectors

inline unsigned int getVertexNumber() const

Accessor on the number of vertices.

Returns

the number of vertices

inline unsigned int getIndexNumber() const

Accessor on the number of indices.

Returns

the number of indices

void mergeVertices(bool aPrintDebugInfoFlag = false)

Merge the vertices of the mesh if the data is managed by the class instance, and if no index has been build.

void splitFaces(bool aPrintDebugInfoFlag = false)

Split each face into four faces.

VEC3 getVertex(unsigned int anIndex) const

Accessor on a given vertex.

Parameters

anIndex – the index of the vertex to access

Returns

the vertex

void setVertex(unsigned int anIndex, const VEC3 &aVertex)

Change the value of a given vertex.

Parameters
  • anIndex – the index of the vertex to access

  • aVertex – the new value of the vertex

inline void setFaceNormal(unsigned int anIndex, const VEC3 &aNormalVector)
inline void setVertexNormal(unsigned int anIndex, const VEC3 &aNormalVector)
int getIndex(unsigned int anIndex) const

Accessor on a given index.

Parameters

anIndex – the index of the index to access

Returns

the index

void setIndex(unsigned int anIndex, unsigned int aValue)

Set the value of a given index.

Parameters
  • anIndex – the index of the index to access

  • aValue – the new value of the index

inline VEC3 getFaceNormal(unsigned int anIndex) const

Accessor on a given face normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

inline VEC3 getVertexNormal(unsigned int anIndex) const

Accessor on a given vertex normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

void setExternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setVBOData(const void *aVertexArray, unsigned int aNumberOfVertices, unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO, unsigned int aNumberOfIndices, int anIndexDataType, const void *aIndexArray = NULL, const void *aNormalArray = NULL)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aIndexArray – array containing the index data

  • aNormalArray – array containing the normal data

void setInternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)
void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

inline void applyScale(const RATIONAL_NUMBER &aScale)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters

aScale – scaling factor

void applyScale(const RATIONAL_NUMBER &aScaleX, const RATIONAL_NUMBER &aScaleY, const RATIONAL_NUMBER &aScaleZ)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters
  • aScaleX – scaling factor alng the x-axis

  • aScaleY – scaling factor alng the y-axis

  • aScaleZ – scaling factor alng the z-axis

inline void invertNormalVectors()

Inverse the normal vectors.

virtual void updateVBO(int aTypeOfVBO, int aTypeOfPrimitive)

Update the VBO.

Parameters
  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

virtual void updateVBOs(unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO)

Update the VBOs with VBO already created.

Parameters
  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

inline const Material &getMaterial() const

Accessor on the material of the polygon mesh.

Returns

the material

inline Material &getMaterial()

Accessor on the material of the polygon mesh.

Returns

the material

void copyFrom(const PolygonMesh &aPolygonMesh)

Copy.

Parameters

aPolygonMesh – the polygon mesh to copy

virtual PolygonMesh operator+(const PolygonMesh &aPolygonMesh) const

operator+.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh operator+(const VEC3 &aTranslationVector) const

operator+.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const PolygonMesh &aPolygonMesh) const

operator-.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const VEC3 &aTranslationVector) const

operator-.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const PolygonMesh &aPolygonMesh)

operator+=.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const VEC3 &aTranslationVector)

operator+=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const PolygonMesh &aPolygonMesh)

operator-=.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const VEC3 &aTranslationVector)

operator-=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

std::map<RATIONAL_NUMBER, VEC3> rayIntersect(const VEC3 &aRayOrigin, const VEC3 &aRayDirection, const MATRIX4 &aTransformationMatrix) const
void getTriangleVertices(VEC3 &v0, VEC3 &v1, VEC3 &v2, unsigned int anIndex) const
inline bool hasNormalVectorsInverted() const

Check if the normal vectors have been inverted.

Returns

true if the normal vectors have been inverted; false otherwise.

Protected Functions

inline void computeBoundingBox()

Update the bounding box.

void normaliseNormals()

Normalise the normal vectors.

void destroyVertexData()

Release the memory held by the vertex data if needed.

void destroyIndexData()

Release the memory held by the index data if needed.

void removeIndex(bool aPrintDebugInfoFlag = false)

Remove the index.

void copyVertexSet(const void *apVertexSet)

Copy a vertex set.

void copyIndexSet(const void *apIndexSet)

Copy an index set.

void loadASCIISTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadBinarySTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadSTLDataFromBinaryStream(const char *apInputData, bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • apInputData – the input data to load

  • aMoveToCentreFlag – a flag to move the polygon to the centre or not

  • anAutoComputeNormalFlag – a flag to compute normals or nor

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

Protected Attributes

std::string m_filename

Name of the file that contains the polygon mesh.

RATIONAL_NUMBER m_file_scale

Unit of length of the file that contains the polygon mesh (if negative, then unknown)

std::auto_ptr<VBO> m_p_vbo

Vertex buffer object.

std::auto_ptr<PolygonMesh> m_p_face_normal_vbo
std::auto_ptr<PolygonMesh> m_p_vertex_normal_vbo
PhotonCrossSection m_photon_cross_section

Material properties, with respect to X-ray.

VEC3 m_local_min_corner

Lower corner of the bounding box.

VEC3 m_local_max_corner

Upper corner of the bounding box.

std::vector<RATIONAL_NUMBER> m_p_vertex_normal_set

Array containing the normal vectors (one per triangle)

Array containing the normal vectors (one per vertex)

void *m_p_vertex_set

Array containing the vertices.

void *m_p_index_set

Array containing the index.

unsigned int m_number_of_indices

Number of indices.

unsigned int m_number_of_vertices

Number of vertices.

int m_index_data_type

Data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

int m_vertex_data_type

Data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

int m_polygon_type

Polygon type; valid values are GL_TRIANGLES.

bool m_external_data_flag

A flag set to true if the memory is managed outside of this class instance; set to false if the memory is managed by this class instance

bool m_display_flag

A flag set to true if you want to display in the Xray image

Material m_material

Material of the object.

bool m_has_inverted_normal_vectors

A flag set to true if the normal vectors are inverted.

Private Functions

void subdivision()

Private Members

double m_height
double m_radius
class DensityFunctionParameterType
#include <ImplicitSurface.h>

Type of density function parameter.

Public Functions

inline DensityFunctionParameterType(const DensityFunctionType aDensityFunctionType = BLOBBY_MOLECULE, RATIONAL_NUMBER a = 1, RATIONAL_NUMBER b = 1)

Default constructor.

Parameters
  • aDensityFunctionType – the type of density function (default value: BLOBBY_MOLECULE)

  • a – the first parameter (default value: 1)

  • b – the second parameter (default value: 1)

Returns

the density

Public Members

DensityFunctionType m_density_function

Type of density function.

RATIONAL_NUMBER m_a

First parameter of the density function.

RATIONAL_NUMBER m_b

Secnd parameter of the density function (not used if m_density_function is SPHERE)

class DepthMap
#include <DepthMap.h>

DepthMap is a class to render to a buffer in order to create, for exemple, a shadow map.

Public Functions

DepthMap(int map_size = 8192)

default constructor

~DepthMap()

destructor

void release()
void initialize()

Initialize the buffers.

void render(std::vector<PolygonMesh*> &mesh_set, Matrix4x4<float> const &proj_matrix)

render to the frame buffer, call initialize() if it has never been called before/ Use this overload in case there is one model matrixes for all the meshes

Parameters
  • mesh_set – the Polygon mesh set to be rendered

  • proj_matrix – the projection matrix

void render(std::vector<PolygonMesh*> &mesh_set, Matrix4x4<float> const &proj_matrix, std::vector<Matrix4x4<float>> const &model_matrix_set)

render to the frame buffer, call initialize() if it has never been called before. Use this overload in case there are different model matrixes

Parameters
  • mesh_set – the Polygon mesh set to be rendered

  • proj_matrix – the projection matrix

  • model_matrix_set – the model matrix set

unsigned int getMapTexture() const

Get the texture.

Private Functions

DepthMap(DepthMap const&)

No copy constructor.

Private Members

bool m_is_initialized

to know if initialize() has been called

Shader m_depth_shader
unsigned int m_map_frame_buffer

To create a buffer for the scene map.

unsigned int m_map_texture
int m_map_size
class DiaphragmMesh : public gVirtualXRay::SoftTissueMesh
#include <DiaphragmMesh.h>

DiaphragmMesh is a class to handle a polygon mesh for a diaphragm.

Public Functions

DiaphragmMesh(bool optimize_texture_coordinates = true, unsigned int texture_size = 2048)

Default Constructor.

virtual ~DiaphragmMesh()

Destructor.

virtual bool isSoftTissue() const

return true if the mesh represent a soft tissue

virtual void updateVBO(int aTypeOfVBO, int aTypeOfPrimitive)

Update the VBO.

Parameters
  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

virtual void defineDisplayShaderInput(int aShaderID)

Link the attributes to their id in the shader.

virtual void defineDisplayShaderInput(unsigned int aShaderID)

Link the attributes to their id in the shader.

virtual void initialize()

initialize the shaders, the buffers, the normal vectors and the textures

virtual bool isTransparent() const

return true if the mesh has to be displayed with transparency

virtual void splitFaces()

Split each face into four faces.

void splitFaces(bool aPrintDebugInfoFlag = false)

Split each face into four faces.

void copyFrom(const InternalOrganMesh &aPolygonMesh)
void copyFrom(const AnatomicalMesh &aPolygonMesh)
void copyFrom(const PolygonMesh &aPolygonMesh)

Copy.

Parameters

aPolygonMesh – the polygon mesh to copy

virtual const std::string &getLabel() const

Accessor on the label that determines the type of the mesh.

void reset()

Reset the data.

inline void resetVBOs()

Reset the VBOs only.

inline void setDisplayFlag(bool display)

Set if the mesh is displayed or not.

Parameters

display – true or false

inline bool getDisplayFlag() const

Accessor on the display flag of the polygon mesh.

Returns

display flag

void display()

Display the triangular mesh using OpenGL.

void displayWireFrame()

Display the triangular mesh in wireframe using OpenGL.

void displayFaceNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the face normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

void displayVertexNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the vertex normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

inline void setFilename(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFilename(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline const std::string &getFilename() const

Accessor on the name of the file that contains the polygon mesh.

Returns

the file name

inline const RATIONAL_NUMBER &getUnitOfLength() const

Accessor on the unit of length of the mesh.

Returns

the unit of length

void loadSTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void writeSTLFile(bool aBinaryFlag)

Write the STL file.

Parameters

aBinaryFlag – if true, save a binary file; if false save an ASCII file

inline void moveToCentre()

Move the polygon to the centre.

inline void moveToCenter()

Move the polygon to the center.

void computeNormalVectors()

Compute the normal vectors using the cross product method.

inline bool useVBO(int aBufferUsageHing, int aTypeOfPrimitive)

Use a vertex buffer object if possible.

Parameters
  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

Returns

true if the VBO can be used, false otherwise

inline void setHU(short HU)
inline void setHounsfieldUnit(short HU)
inline void setHounsfieldValue(short HU)
inline void setElement(unsigned short Z)
inline void setElement(const std::string &aName)
inline void setMixture(const Mixture &aMixture)
inline void setMixture(const std::map<int, double> &aMixture)
inline void setMixture(const std::map<std::string, double> &aMixture)
inline void setMixture(const std::string &aName)
inline void setCompound(const std::string &aName)
inline void setMassAttenuationCoefficient(double aCoefficient)
inline void setLinearAttenuationCoefficient(double aCoefficient)
inline void setDensity(double aDensity)
inline double getDensity()
inline const std::string &getMaterialLabel() const
inline std::string getCompound() const

Accessor on the compound description of the polygon mesh.

Returns

if the sample is made of a compound, then return the description of the compound (e.g. H2O for water), otherwise return an empty string

inline std::vector<int> getMixtureElementSet() const

Accessor on the element Z number set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element Z number set of the mixture, otherwise return an empty vector

inline std::vector<double> getMixtureWeightSet() const

Accessor on the element weight set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element weight set of the mixture, otherwise return an empty vector

inline const PhotonCrossSection &getPhotonCrossSection() const
inline void setPhotonCrossSection(const PhotonCrossSection &aPhotonCrossSection)
inline const VEC3 &getLocalMinCorner() const

Accessor on the bounding box lower corner.

Returns

the bounding box lower corner

inline const VEC3 &getLocalMaxCorner() const

Accessor on the bounding box upper corner.

Returns

the bounding box upper corner

inline void applyTranslation(const VEC3 &aTranslationVector)

Translate the polygon mesh given a translation vector, and update the VBO if needed.

Parameters

aTranslationVector – the translation vector

inline void applyScaling(RATIONAL_NUMBER x, RATIONAL_NUMBER y, RATIONAL_NUMBER z)

Scale the polygon mesh given scaling factors, and update the VBO if needed.

Parameters
  • x – the scaling factor along the X-axis

  • y – the scaling factor along the Y-axis

  • z – the scaling factor along the Z-axis

inline void applyRotation(const VEC3 &aRotationAxis, RATIONAL_NUMBER aRotationAngleInDegrees)

Rotate the polygon mesh given a rotation axis and angle, and update the VBO if needed.

Parameters
  • aRotationAxis – the rotation axis

  • aRotationAngleInDegrees – the rotation angle in degrees

inline void applyTransform(const MATRIX4 &aTransformationMatrix)

Transform the polygon mesh given a transformation matrix and update the VBO if needed.

Parameters

aTransformationMatrix – the transformation matrix

unsigned int getFaceNumber() const

Accessor on the number of faces.

Returns

the number of faces

unsigned int getTriangleNumber() const

Accessor on the number of triangles.

Returns

the number of triangles

inline unsigned int getFaceNormalNumber() const

Accessor on the number of face normal vectors.

Returns

the number of face normal vectors

inline unsigned int getVertexNormalNumber() const

Accessor on the number of vertex normal vectors.

Returns

the number of vertex normal vectors

inline unsigned int getVertexNumber() const

Accessor on the number of vertices.

Returns

the number of vertices

inline unsigned int getIndexNumber() const

Accessor on the number of indices.

Returns

the number of indices

void mergeVertices(bool aPrintDebugInfoFlag = false)

Merge the vertices of the mesh if the data is managed by the class instance, and if no index has been build.

VEC3 getVertex(unsigned int anIndex) const

Accessor on a given vertex.

Parameters

anIndex – the index of the vertex to access

Returns

the vertex

void setVertex(unsigned int anIndex, const VEC3 &aVertex)

Change the value of a given vertex.

Parameters
  • anIndex – the index of the vertex to access

  • aVertex – the new value of the vertex

inline void setFaceNormal(unsigned int anIndex, const VEC3 &aNormalVector)
inline void setVertexNormal(unsigned int anIndex, const VEC3 &aNormalVector)
int getIndex(unsigned int anIndex) const

Accessor on a given index.

Parameters

anIndex – the index of the index to access

Returns

the index

void setIndex(unsigned int anIndex, unsigned int aValue)

Set the value of a given index.

Parameters
  • anIndex – the index of the index to access

  • aValue – the new value of the index

inline VEC3 getFaceNormal(unsigned int anIndex) const

Accessor on a given face normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

inline VEC3 getVertexNormal(unsigned int anIndex) const

Accessor on a given vertex normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

void setExternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setVBOData(const void *aVertexArray, unsigned int aNumberOfVertices, unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO, unsigned int aNumberOfIndices, int anIndexDataType, const void *aIndexArray = NULL, const void *aNormalArray = NULL)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aIndexArray – array containing the index data

  • aNormalArray – array containing the normal data

void setInternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)
void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

inline void applyScale(const RATIONAL_NUMBER &aScale)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters

aScale – scaling factor

void applyScale(const RATIONAL_NUMBER &aScaleX, const RATIONAL_NUMBER &aScaleY, const RATIONAL_NUMBER &aScaleZ)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters
  • aScaleX – scaling factor alng the x-axis

  • aScaleY – scaling factor alng the y-axis

  • aScaleZ – scaling factor alng the z-axis

inline void invertNormalVectors()

Inverse the normal vectors.

virtual void updateVBOs(unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO)

Update the VBOs with VBO already created.

Parameters
  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

inline const Material &getMaterial() const

Accessor on the material of the polygon mesh.

Returns

the material

inline Material &getMaterial()

Accessor on the material of the polygon mesh.

Returns

the material

virtual PolygonMesh operator+(const PolygonMesh &aPolygonMesh) const

operator+.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh operator+(const VEC3 &aTranslationVector) const

operator+.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const PolygonMesh &aPolygonMesh) const

operator-.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const VEC3 &aTranslationVector) const

operator-.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const PolygonMesh &aPolygonMesh)

operator+=.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const VEC3 &aTranslationVector)

operator+=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const PolygonMesh &aPolygonMesh)

operator-=.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const VEC3 &aTranslationVector)

operator-=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

std::map<RATIONAL_NUMBER, VEC3> rayIntersect(const VEC3 &aRayOrigin, const VEC3 &aRayDirection, const MATRIX4 &aTransformationMatrix) const
void getTriangleVertices(VEC3 &v0, VEC3 &v1, VEC3 &v2, unsigned int anIndex) const
inline bool hasNormalVectorsInverted() const

Check if the normal vectors have been inverted.

Returns

true if the normal vectors have been inverted; false otherwise.

Protected Types

enum ToCreate

To know if a bump map or a colour texture has to be created.

Values:

enumerator TO_CREATE_BUMP_MAP
enumerator TO_CREATE_COLOUR_TEXTURE

Protected Functions

virtual void defineBumpMapShaderInput(int shader_id)

Link the attributes to their id in the shader bump map generation.

virtual void defineColourTextureShaderInput(int shader_id)

Link the attributes to their ID in the shader for colour texture generation

virtual void generateTextures()

generates the textures

virtual void generate2DTexture(Shader const &shader, unsigned int &frame_buffer, ToCreate to_create)

generates a 2D texture

virtual void generate3DTexture(Shader const &shader, unsigned int &frame_buffer, unsigned int &texture, ToCreate to_create)

generates a 3D texture

virtual void initialize2DBuffer(unsigned int &aTexture, unsigned int &aFrameBuffer)

initialize a 2D frame buffer and bind a texture to it

virtual void initialize3DBuffer(unsigned int &aTexture, unsigned int &aFrameBuffer, bool has_colours)

initialize a 3D frame buffer and bind a texture to its layer 0

virtual void load2DBumpShader()

Load the shader to create the 2D bump map.

virtual void load3DBumpShader()

Load the shader to create the 3D bump map.

virtual void initialize2DTextureCoordinates()

Initialise optimised texture coordinates by sharing an hypothenuse in the texture for two adjacent polygons.

virtual void initialize3DTextureCoordinates()

Initialise 3D texture coordinates.

virtual void shareNormalVectors()

Compute a normal vector per vertex for a smoother display.

virtual void deleteIndices()

delete the indices and calculate new normal vectors

virtual void initGradientTab()

initialize gradient tab for gnoise

virtual void initPermutation()

initialize permutation tab for all noises

inline void computeBoundingBox()

Update the bounding box.

void normaliseNormals()

Normalise the normal vectors.

void destroyVertexData()

Release the memory held by the vertex data if needed.

void destroyIndexData()

Release the memory held by the index data if needed.

void removeIndex(bool aPrintDebugInfoFlag = false)

Remove the index.

void copyVertexSet(const void *apVertexSet)

Copy a vertex set.

void copyIndexSet(const void *apIndexSet)

Copy an index set.

void loadASCIISTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadBinarySTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadSTLDataFromBinaryStream(const char *apInputData, bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • apInputData – the input data to load

  • aMoveToCentreFlag – a flag to move the polygon to the centre or not

  • anAutoComputeNormalFlag – a flag to compute normals or nor

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

Protected Attributes

unsigned int m_colour_texture
unsigned int m_colour_texture_frame_buffer
int m_use_3D_colour_texture
Shader m_colour_texture_shader
std::vector<VEC3> m_gradient_tab
std::vector<int> m_permutation
std::vector<VEC2> m_texture_coordinates_2d
std::vector<VEC3> m_texture_coordinates_3d
std::vector<VEC2> m_margin_direction
unsigned int m_bump_map_texture
unsigned int m_bump_map_frame_buffer
Shader m_bump_map_shader
int m_has_tendon
int m_is_lung
int m_has_thin_bumps
int m_use_3D_bump_map
unsigned int m_texture_size_2d
unsigned int m_texture_size_3d
bool m_need_initialize
bool m_generation_texture_coord_are_set
bool m_optimize_texture_coordinates
int m_use_texture

1 if the mesh use texturing; default value is 0

int m_use_bump_map

1 if the mesh use bump mapping; default value is 0

std::string m_label

A label to determine the type of the mesh.

std::string m_filename

Name of the file that contains the polygon mesh.

RATIONAL_NUMBER m_file_scale

Unit of length of the file that contains the polygon mesh (if negative, then unknown)

std::auto_ptr<VBO> m_p_vbo

Vertex buffer object.

std::auto_ptr<PolygonMesh> m_p_face_normal_vbo
std::auto_ptr<PolygonMesh> m_p_vertex_normal_vbo
PhotonCrossSection m_photon_cross_section

Material properties, with respect to X-ray.

VEC3 m_local_min_corner

Lower corner of the bounding box.

VEC3 m_local_max_corner

Upper corner of the bounding box.

std::vector<RATIONAL_NUMBER> m_p_vertex_normal_set

Array containing the normal vectors (one per triangle)

Array containing the normal vectors (one per vertex)

void *m_p_vertex_set

Array containing the vertices.

void *m_p_index_set

Array containing the index.

unsigned int m_number_of_indices

Number of indices.

unsigned int m_number_of_vertices

Number of vertices.

int m_index_data_type

Data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

int m_vertex_data_type

Data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

int m_polygon_type

Polygon type; valid values are GL_TRIANGLES.

bool m_external_data_flag

A flag set to true if the memory is managed outside of this class instance; set to false if the memory is managed by this class instance

bool m_display_flag

A flag set to true if you want to display in the Xray image

Material m_material

Material of the object.

bool m_has_inverted_normal_vectors

A flag set to true if the normal vectors are inverted.

class ElementSet
#include <ElementSet.h>

ElementSet is a class to manage a table of elements in material.

Public Functions

inline ~ElementSet()

Destructor.

void loadFromFile(const std::string &aFileName)

Load a file containing elements.

void loadElementSetFromMemory()

Load the table of elements.

void addElement(const AtomicElement &anElement)

Add an element to the list.

AtomicElement &getElement(unsigned short anAtomicNumber)

Get a given element.

const AtomicElement &getElement(unsigned short anAtomicNumber) const

Get a given element.

AtomicElement &getElement(const std::string &aName)

Get a given element.

const AtomicElement &getElement(const std::string &aName) const

Get a given element.

float getMolarMass(unsigned short anAtomicNumber) const

Accessor on the molar mass of the element.

float getDensity(unsigned short anAtomicNumber) const

Accessor on the density of the element.

inline unsigned int getElementSetSize() const

Accessor on the number of elements in the set.

std::map<unsigned short, AtomicElement>::const_iterator begin() const

Accessor on the begin const_iterator of m_element_set.

std::map<unsigned short, AtomicElement>::const_iterator end() const

Accessor on the end const_iterator of m_element_set.

Public Static Functions

static ElementSet &getInstance()

Private Functions

inline ElementSet()

Default Constructor.

ElementSet(const ElementSet&)

Copy constructor.

ElementSet &operator=(const ElementSet&)

Copy operator.

inline void clearMemory()

Clear all the memory.

void clearDynamicallyMemory()

Clear the dynamically allocated memory.

Private Members

std::map<unsigned short, AtomicElement> m_element_set

An indexed table containing elements.

class Exception : public std::exception
#include <Exception.h>

Exception is a class to handle exceptions.

Subclassed by gVirtualXRay::FBOException, gVirtualXRay::FileDoesNotExistException, gVirtualXRay::InvalidImageSizeException, gVirtualXRay::InvalidInternalFormalException, gVirtualXRay::NoBeamException, gVirtualXRay::NoDetectorException, gVirtualXRay::NotImplementedException, gVirtualXRay::OpenGLException, gVirtualXRay::OutOfBoundsException, gVirtualXRay::OutOfMemoryException

Public Functions

inline Exception(const char *aFileName = 0, const char *aFunctionName = 0, int anErrorLine = 0, const char *anErrorMessage = 0)

Default constructor.

Parameters
  • aFileName – name of the source file where the exception was thrown (default value: 0)

  • aFunctionName – name of the function where the exception was thrown (default value: 0)

  • anErrorLine – name at which the exception was thrown (default value: 0)

  • anErrorMessage – error message corresponding to the exception (default value: 0)

inline Exception(const char *aFileName, const char *aFunctionName, int anErrorLine, const std::string &anErrorMessage)

Constructor.

Parameters
  • aFileName – name of the source file where the exception was thrown

  • aFunctionName – name of the function where the exception was thrown

  • anErrorLine – name at which the exception was thrown

  • anErrorMessage – error message corresponding to the exception

inline virtual ~Exception()

Destructor.

inline virtual const char *what() const

Accessor on the error message.

Returns

the error message

Protected Attributes

std::string m_error_message

The error message.

class FBOException : public gVirtualXRay::Exception
#include <FBOException.h>

FBOException is a class to handle exceptions related to FBOs.

Public Functions

FBOException(const char *aFileName, const char *aFunctionName, int anErrorLine, int anErrorCode)

Default constructor.

Parameters
  • aFileName – name of the source file where the exception was thrown

  • aFunctionName – name of the function where the exception was thrown

  • anErrorLine – name at which the exception was thrown

  • anErrorCode – FBO error code

inline virtual const char *what() const

Accessor on the error message.

Returns

the error message

Protected Attributes

std::string m_error_message

The error message.

template<typename T>
class FFT
#include <FFT.h>

FFT is a class to compute the FFT of a greyscale image.

Public Functions

FFT()

Default constructor.

FFT(const FFT<T> &aFFT)

Copy constructor.

Parameters

aFFT – the FFT to copy

FFT(unsigned int aWidth, unsigned int aHeight)

Constructor to build a FFT.

Parameters
  • aWidth – the width of the FFT

  • aHeight – the height of the FFT

FFT<T> &operator=(const FFT<T> &aFFT)

Assignment operator (also called copy operator).

Parameters

aFFT – the FFT to copy

Returns

the updated version of the current FFT

Image<T> getInverseFFT() const
FFT<T> filterRamp() const
FFT<T> rhoFilter(const std::string &aFilterType, float aScalingFactor)
FFT<T> rhoFilter(const char *aFilterType, float aScalingFactor)
Image<T> getMagnitude() const
Image<T> getPhase() const

Public Static Functions

static FFT<T> computeFFT(const Image<T> &anImage)

Private Members

Image<T> m_real
Image<T> m_img
unsigned int m_origin_image_width
unsigned int m_origin_image_height

Private Static Functions

static unsigned int powerOfTwo(unsigned int i)
static Image<T> swapQuadrants(const Image<T> &anImage)
class FileDoesNotExistException : public gVirtualXRay::Exception

FileDoesNotExistException is a class to handle exceptions when trying to open a read-only file that is not accessible.

Public Functions

inline FileDoesNotExistException(const char *aFileName, const char *aFunctionName, int anErrorLine, const char *aNameOfFileToOpen)

Constructor.

Parameters
  • aFileName – name of the source file where the exception was thrown

  • aFunctionName – name of the function where the exception was thrown

  • anErrorLine – name at which the exception was thrown

  • aNameOfFileToOpen – the name of the file to open

inline FileDoesNotExistException(const char *aFileName, const char *aFunctionName, int anErrorLine, const std::string &aNameOfFileToOpen)

Constructor.

Parameters
  • aFileName – name of the source file where the exception was thrown

  • aFunctionName – name of the function where the exception was thrown

  • anErrorLine – name at which the exception was thrown

  • aNameOfFileToOpen – the name of the file to open

inline virtual const char *what() const

Accessor on the error message.

Returns

the error message

Protected Attributes

std::string m_error_message

The error message.

class FramebufferObject

FramebufferObject Class. This class encapsulates the FramebufferObject (FBO) OpenGL spec. See the official spec at: http://oss.sgi.com/projects/ogl-sample/registry/EXT/framebuffer_object.txt

for details.

A framebuffer object (FBO) is conceptually a structure containing pointers to GPU memory. The memory pointed to is either an OpenGL texture or an OpenGL RenderBuffer. FBOs can be used to render to one or more textures, share depth buffers between multiple sets of color buffers/textures and are a complete replacement for pbuffers.

Performance Notes: 1) It is more efficient (but not required) to call Bind() on an FBO before making multiple method calls. For example:

FramebufferObject fbo; fbo.Bind(); fbo.AttachTexture(GL_TEXTURE_2D, texId0, GL_COLOR_ATTACHMENT0_EXT); fbo.AttachTexture(GL_TEXTURE_2D, texId1, GL_COLOR_ATTACHMENT1_EXT); fbo.IsValid();

To provide a complete encapsulation, the following usage pattern works correctly but is less efficient:

FramebufferObject fbo; NOTE : No Bind() call fbo.AttachTexture(GL_TEXTURE_2D, texId0, GL_COLOR_ATTACHMENT0_EXT); fbo.AttachTexture(GL_TEXTURE_2D, texId1, GL_COLOR_ATTACHMENT1_EXT); fbo.IsValid();

The first usage pattern binds the FBO only once, whereas the second usage binds/unbinds the FBO for each method call.

2) Use FramebufferObject::Disable() sparingly. We have intentionally left out an “Unbind()” method because it is largely unnecessary and encourages rendundant Bind/Unbind coding. Binding an FBO is usually much faster than enabling/disabling a pbuffer, but is still a costly operation. When switching between multiple FBOs and a visible OpenGL framebuffer, the following usage pattern is recommended:

FramebufferObject fbo1, fbo2; fbo1.Bind(); … Render … NOTE : No Unbind/Disable here…

  fbo2.Bind();
    ... Render ...

Disable FBO rendering and return to visible window OpenGL framebuffer. FramebufferObject::Disable();

Public Functions

FramebufferObject()

Ctor/Dtor.

virtual ~FramebufferObject()
void destroy()

Destroy the framebuffer.

void reset()

Create a new framebuffer.

void Bind()

Bind this FBO as current render target.

virtual void AttachTexture(GLenum texTarget, GLuint texId, GLenum attachment = GL_COLOR_ATTACHMENT0, int mipLevel = 0, int zSlice = 0)

Bind a texture to the “attachment” point of this FBO.

virtual void AttachTextures(int numTextures, GLenum texTarget[], GLuint texId[], GLenum attachment[] = NULL, int mipLevel[] = NULL, int zSlice[] = NULL)

Bind an array of textures to multiple “attachment” points of this FBO

  • By default, the first ‘numTextures’ attachments are used, starting with GL_COLOR_ATTACHMENT0_EXT

virtual void AttachRenderBuffer(GLuint buffId, GLenum attachment = GL_COLOR_ATTACHMENT0)

Bind a render buffer to the “attachment” point of this FBO.

virtual void AttachRenderBuffers(int numBuffers, GLuint buffId[], GLenum attachment[] = NULL)

Bind an array of render buffers to corresponding “attachment” points of this FBO.

  • By default, the first ‘numBuffers’ attachments are used, starting with GL_COLOR_ATTACHMENT0_EXT

void Unattach(GLenum attachment)

Free any resource bound to the “attachment” point of this FBO.

void UnattachAll()

Free any resources bound to any attachment points of this FBO.

bool IsValid(std::ostream &ostr = std::cerr)

Is this FBO currently a valid render target?

  • Sends output to std::cerr by default but can be a user-defined C++ stream

NOTE : This function works correctly in debug build mode but always returns “true” if NDEBUG is is defined (optimized builds)

GLenum GetAttachedType(GLenum attachment)

Is attached type GL_RENDERBUFFER_EXT or GL_TEXTURE?

BEGIN : Accessors

GLuint GetAttachedId(GLenum attachment)

What is the Id of Renderbuffer/texture currently attached to “attachement?”

GLint GetAttachedMipLevel(GLenum attachment)

Which mipmap level is currently attached to “attachement?”.

GLint GetAttachedCubeFace(GLenum attachment)

Which cube face is currently attached to “attachment?”.

inline GLuint getID() const

END : Static methods global to all FBOs.

Public Static Functions

static int GetMaxColorAttachments()

Which z-slice is currently attached to “attachment?”.

END : Accessors BEGIN : Static methods global to all FBOs Return number of color attachments permitted

static void Disable()

Disable all FBO rendering and return to traditional, windowing-system controlled framebuffer NOTE: This is NOT an “unbind” for this specific FBO, but rather disables all FBO rendering. This call is intentionally “static” and named “Disable” instead of “Unbind” for this reason. The motivation for this strange semantic is performance. Providing “Unbind” would likely lead to a large number of unnecessary FBO enablings/disabling.

Protected Functions

void _GuardedBind()
void _GuardedUnbind()
void _FramebufferTextureND(GLenum attachment, GLenum texTarget, GLuint texId, int mipLevel, int zSlice)

Protected Static Functions

static GLuint _GenerateFboId()

Private Members

GLuint m_fboId
GLint m_savedFboId
template<typename T>
class Image
#include <Image.h>

Image is a class to manage a greyscale image.

Subclassed by gVirtualXRay::Sinogram< T >

Public Functions

Image()

Default constructor.

Image(const Image<T> &anImage)

Copy constructor.

Parameters

anImage – the image to copy

Image(const char *aFileName)

Constructor.

Parameters

aFileName – the name of the file to load

Image(const std::string &aFileName)

Constructor.

Parameters

aFileName – the name of the file to load

Image(const T *apData, unsigned int aWidth, unsigned int aHeight, unsigned int aNumberOfSlices = 1, const VEC3 &aVoxelSize = VEC3(1, 1, 1))

Constructor from an array.

Parameters
  • apData – the array to copy

  • aWidth – the width of the image

  • aHeight – the height of the image

  • aNumberOfSlices – the number of slices (default value: 1)

  • aVoxelSize – the physical distance between the centres of each three-dimensional voxel, specified by three numeric values (default value: 1, 1, 1)

Image(unsigned int aWidth, unsigned int aHeight, unsigned int aNumberOfSlices = 1, T aDefaultValue = 0, const VEC3 &aVoxelSize = VEC3(1, 1, 1))

Constructor to build a black image.

Parameters
  • aWidth – the width of the image

  • aHeight – the height of the image

  • aNumberOfSlices – the number of slices (default value: 1)

  • aDefaultValue – the pixel value (default value: 0)

  • aVoxelSize – the physical distance between the centres of each three-dimensional voxel, specified by three numeric values (default value: 1, 1, 1)

~Image()

Destructor.

void makeBlank(const T &aDefaultColour = 0)

Replace all the pixels of an image with a default value.

Parameters

aDefaultColour – the pixel value (default value: 0)

Image getROI(unsigned int i, unsigned int j, unsigned int k, unsigned int aWidth, unsigned int aHeight, unsigned int aDepth) const

Compute a region of interest (ROI).

Parameters
  • i – the position of the first pixel of the ROI along the horizontal axis

  • j – the position of the first pixel of the ROI along the vertical axis

  • k – the position of the first pixel of the ROI along the depth axis

  • aWidth – the width of the ROI (in number of pixels)

  • aHeight – the height of the ROI (in number of pixels)

  • aDepth – the depth of the ROI (in number of pixels)

Returns

the ROI

void setPixel(unsigned int i, unsigned int j, unsigned int k, T aValue)

Set a pixel.

Parameters
  • i – the position of the pixel along the x-axis

  • j – the position of the pixel along the y-axis

  • k – the position of the pixel along the z-axis

  • aValue – the new pixel value

T &getPixel(unsigned int i, unsigned int j, unsigned int k = 0)

Accessor on a pixel value.

Parameters
  • i – the position of the pixel along the x-axis

  • j – the position of the pixel along the y-axis

  • k – the position of the pixel along the z-axis (default value: 0)

Returns

the pixel value

const T &getPixel(unsigned int i, unsigned int j, unsigned int k = 0) const

Accessor on a pixel value.

Parameters
  • i – the position of the pixel along the x-axis

  • j – the position of the pixel along the y-axis

  • k – the position of the pixel along the z-axis (default value: 0)

Returns

the pixel value

T &getPixelValue(unsigned int i, unsigned int j, unsigned int k = 0)

Accessor on a pixel value.

Parameters
  • i – the position of the pixel along the x-axis

  • j – the position of the pixel along the y-axis

  • k – the position of the pixel along the z-axis (default value: 0)

Returns

the pixel value

const T &getPixelValue(unsigned int i, unsigned int j, unsigned int k = 0) const

Accessor on a pixel value.

Parameters
  • i – the position of the pixel along the x-axis

  • j – the position of the pixel along the y-axis

  • k – the position of the pixel along the z-axis (default value: 0)

Returns

the pixel value

VEC3 getPixelPosition(unsigned int i, unsigned int j, unsigned int k = 0) const

Accessor on a pixel position.

Parameters
  • i – the position of the pixel along the x-axis

  • j – the position of the pixel along the y-axis

  • k – the position of the pixel along the z-axis (default value: 0)

Returns

the pixel position

T &operator[](unsigned anIndex)
const T &operator[](unsigned anIndex) const
T &operator()(unsigned int i, unsigned int j, unsigned int k)
const T &operator()(unsigned int i, unsigned int j, unsigned int k) const
Image<T> &operator=(const Image<T> &anImage)

Assignment operator (also called copy operator).

Parameters

anImage – the image to copy

Returns

the updated version of the current image

Image<T> &operator=(const T *apImage)

Assignment operator (also called copy operator).

Parameters

apImage – the data to copy

Returns

the updated version of the current image

void destroy()

Release the memory.

T *getRawData()

Accessor on the raw data.

Returns

the raw data

const T *getRawData() const

Accessor on the raw data.

Returns

the raw data

unsigned int getWidth() const

Number of pixels along the horizontal axis.

Returns

the width

unsigned int getHeight() const

Number of pixels along the vertical axis.

Returns

the height

unsigned int getDepth() const

Number of pixels along the Z axis.

Returns

the depth

void setSpacing(const VEC3 &aPixelSize)
void setSpacing(const double &aPixelWidth, const double &aPixelHeight = 0.0, const double &aPixelDepth = 0.0)
const VEC3 &getSpacing() const
T getMinValue() const

Compute the minimum pixel value in the image.

Returns

the minimum pixel

T getMaxValue() const

Compute the maximum pixel value in the image.

Returns

the maximum pixel

T getMinValue(unsigned int aSliceID) const

Compute the minimum pixel value in a given slice.

Parameters

aSliceID – the slice ID

Returns

the minimum pixel

T getMaxValue(unsigned int aSliceID) const

Compute the maximum pixel value in a given slice.

Parameters

aSliceID – the slice ID

Returns

the maximum pixel

Image shiftScaleFilter(double aShiftValue, double aScaleValue, bool aRunOnGPUFlag = true) const

Add aShiftValue to every pixel, then multiply every pixel by aScaleValue

Parameters
  • aShiftValue – the shift parameter of the filter

  • aScaleValue – the scale parameter of the filter

Image<unsigned char> threshold(const T &aLowerThreshold, const T &aUpperThreshold, unsigned char anInValue, unsigned char anOutValue, bool aRunOnGPUFlag = true) const
Image<T> convolution1D(const std::vector<float> &aKernel) const
Image<T> convolution2D(const Image<float> &aKernel) const
Image<T> convolution2D(const Image<double> &aKernel) const
Image<unsigned char> opening(unsigned int aRadius) const
Image<unsigned char> closing(unsigned int aRadius) const
Image<float> getIsoTropic() const
Image<float> antiAliasBinaryImageFilter(double aMaximumRMSChange, unsigned int aNumberOfIterations, double aVariance) const
Image constantPadFilter(const T &aPadValue) const
Image<unsigned char> threshold(const T &aThreshold, unsigned char aValueIn = 1, unsigned char aValueOut = 0) const
Image<unsigned char> threshold(const T &aLowerThreshold, const T &aUpperThreshold, unsigned char aValueIn = 1, unsigned char aValueOut = 0) const
Image normalised(bool aRunOnGPUFlag = true) const

Normalise the image between 0 and 1.

Image normalized(bool aRunOnGPUFlag = true) const

Normalize the image between 0 and 1.

void load(const char *aFileName)
void load(const std::string &aFileName)
void loadUsingITK(const char *aFileName)
void loadUsingITK(const std::string &aFileName)
void loadSeries(const char *aPattern, int aFirstSliceIndex, int aLastSliceIndex, int anIncrementIndex = 1)
void loadSeries(const std::string &aPattern, int aFirstSliceIndex, int aLastSliceIndex, int anIncrementIndex = 1)
void loadDicomSeries(const char *aDirectory)
void loadDicomSeries(const std::string &aDirectory)
void loadASCII(const char *aFileName)
void loadASCII(const std::string &aFileName)
void loadASCII(const char *aFileName, unsigned int aWidth, unsigned int aHeight, unsigned int aDepth, const VEC3 &aVoxelSize)
void loadASCII(const std::string &aFileName, unsigned int aWidth, unsigned int aHeight, unsigned int aDepth, const VEC3 &aVoxelSize)
void loadMHD(const char *aFileName)
void loadMHD(const std::string &aFileName)
void loadMHA(const char *aFileName)
void loadMHA(const std::string &aFileName)
unsigned int sizeOf(const char *anElementType) const
unsigned int sizeOf(const std::string &anElementType) const
void loadRAW(const char *aFileName, unsigned int aWidth, unsigned int aHeight, unsigned int aNumberOfSlices = 1, bool aChangeEndianessFlag = false, const char *anElementType = 0)
void loadRAW(const std::string &aFileName, unsigned int aWidth, unsigned int aHeight, unsigned int aNumberOfSlices = 1, bool aChangeEndianessFlag = false, const std::string &anElementType = "")
void loadTIFF(const char *aFileName)
void loadTIFF(const std::string &aFileName)
void save(const char *aFileName, bool anInvertLUTFlag = false, const char *aComment = "", bool useDeflateCompressionIfPossible = false) const

Save the image in a file.

Parameters
  • aFileName – the name of the file to write

  • anInvertLUTFlag – invert the LUT if it is supported by the file format (default value: false)

  • aComment – add a comment if it is supported by the file format (default value: “”)

  • useDeflateCompressionIfPossible – use compression if possible (default value: false)

void save(const std::string &aFileName, bool anInvertLUTFlag = false, const std::string &aComment = "", bool useDeflateCompressionIfPossible = false) const

Save the image in a file.

Parameters
  • aFileName – the name of the file to write

  • anInvertLUTFlag – invert the LUT if it is supported by the file format (default value: false)

  • aComment – add a comment if it is supported by the file format (default value: “”)

  • useDeflateCompressionIfPossible – use compression if possible (default value: false)

void savePGM(const char *aFileName) const

Save the image in a PGM file.

Parameters

aFileName – the name of the file to write

void savePGM(const std::string &aFileName) const

Save the image in a PGM file.

Parameters

aFileName – the name of the file to write

void saveRaw(const char *aFileName, bool useDeflateCompressionIfPossible) const

Save the image in a Raw file.

Parameters
  • aFileName – the name of the file to write

  • useDeflateCompressionIfPossible – use compression (default value: false)

void saveRaw(const std::string &aFileName, bool useDeflateCompressionIfPossible) const

Save the image in a Raw file.

Parameters
  • aFileName – the name of the file to write

  • useDeflateCompressionIfPossible – use compression (default value: false)

void saveRAW(const char *aFileName, bool useDeflateCompressionIfPossible) const

Save the image in a Raw file.

Parameters
  • aFileName – the name of the file to write

  • useDeflateCompressionIfPossible – use compression (default value: false)

void saveRAW(const std::string &aFileName, bool useDeflateCompressionIfPossible) const

Save the image in a Raw file.

Parameters
  • aFileName – the name of the file to write

  • useDeflateCompressionIfPossible – use compression (default value: false)

void saveASCII(const char *aFileName) const

Save the image in an ASCII file.

Parameters

aFileName – the name of the file to write

void saveASCII(const std::string &aFileName) const

Save the image in an ASCII file.

Parameters

aFileName – the name of the file to write

void saveMHD(const char *aFileName, bool useDeflateCompressionIfPossible = false) const

Save the image in a MHD+RAW file.

Parameters
  • aFileName – the name of the file to write

  • useDeflateCompressionIfPossible – use compression (default value: false)

void saveMHD(const std::string &aFileName, bool useDeflateCompressionIfPossible = false) const

Save the image in a MHD+RAW file.

Parameters
  • aFileName – the name of the file to write

  • useDeflateCompressionIfPossible – use compression (default value: false)

void saveMHA(const char *aFileName, bool useDeflateCompressionIfPossible = false) const

Save the image in a MHA+RAW file.

Parameters
  • aFileName – the name of the file to write

  • useDeflateCompressionIfPossible – use compression (default value: false)

void saveMHA(const std::string &aFileName, bool useDeflateCompressionIfPossible = false) const

Save the image in a MHA+RAW file.

Parameters
  • aFileName – the name of the file to write

  • useDeflateCompressionIfPossible – use compression (default value: false)

void saveDCM(const char *aFileName, bool anInvertLUTFlag = false, const char *aComment = "") const

Save the image in a DICOM file.

Parameters
  • aFileName – the name of the file to write

  • anInvertLUTFlag – invert the LUT (default value: false)

  • aComment – add a comment (default value: “”)

void saveDCM(const std::string &aFileName, bool anInvertLUTFlag = false, const std::string &aComment = "") const

Save the image in a DICOM file.

Parameters
  • aFileName – the name of the file to write

  • anInvertLUTFlag – invert the LUT (default value: false)

  • aComment – add a comment (default value: “”)

void saveTIFF(const char *aFileName, bool anInvertLUTFlag = false) const

Save the image in a TIFF file.

Parameters
  • aFileName – the name of the file to write

  • anInvertLUTFlag – invert the LUT (default value: false)

void saveTIFF(const std::string &aFileName, bool anInvertLUTFlag = false) const

Save the image in a TIFF file.

Parameters
  • aFileName – the name of the file to write

  • anInvertLUTFlag – invert the LUT (default value: false)

void saveUsingITK(const char *aFileName, bool useDeflateCompressionIfPossible = false) const

Save the image in a file using ITK.

Parameters
  • aFileName – the name of the file to write

  • useDeflateCompressionIfPossible – use compression (default value: false)

void saveUsingITK(const std::string &aFileName, bool useDeflateCompressionIfPossible = false) const

Save the image in a file using ITK.

Parameters
  • aFileName – the name of the file to write

  • useDeflateCompressionIfPossible – use compression (default value: false)

bool operator==(const Image<T> &anImage) const

Operator Equal to.

Parameters

anImage – the image to compare with

Returns

true if the images are similar, false if they are different

bool operator!=(const Image<T> &anImage) const

Operator Not equal to.

Parameters

anImage – the image to compare with

Returns

true if the images are different, false if they are similar

Image operator+(const Image<T> &anImage) const

Addition operator. Add anImage.

Parameters

anImage – the image to add

Returns

the resulting image

Image operator-(const Image<T> &anImage) const

Subtraction operator. Add anImage.

Parameters

anImage – the image to subtract

Returns

the resulting image

Image operator*(const Image<T> &anImage) const

Multiplication operator. Add anImage.

Parameters

anImage – the image to add

Returns

the resulting image

Image operator/(const Image<T> &anImage) const

Division operator. Add anImage.

Parameters

anImage – the image to subtract

Returns

the resulting image

Image<T> &operator+=(const Image<T> &anImage)

Addition assignment operator. Add anImage.

Parameters

anImage – the image to add

Returns

the updated version of the current image

Image<T> &operator-=(const Image<T> &anImage)

Subraction assignment operator. Add anImage.

Parameters

anImage – the image to subtract

Returns

the updated version of the current image

Image<T> &operator*=(const Image<T> &anImage)

Multiplication assignment operator. Add anImage.

Parameters

anImage – the image to add

Returns

the updated version of the current image

Image<T> &operator/=(const Image<T> &anImage)

Division assignment operator. Add anImage.

Parameters

anImage – the image to subtract

Returns

the updated version of the current image

Image operator+(T aValue) const

Addition operator. Add aValue to every pixel of the image.

Parameters

aValue – the value to add

Returns

the resulting image

Image operator-(T aValue) const

Subtraction operator. Subtract aValue to every pixel of the image.

Parameters

aValue – the value to subtract

Returns

the resulting image

Image operator*(T aValue) const

Multiplication operator. Multiply every pixel of the image by aValue.

Parameters

aValue – the value for the multiplication

Returns

the resulting image

Image operator/(T aValue) const

Division operator. Divide every pixel of the image by aValue.

Parameters

aValue – the value for the division

Returns

the resulting image

Image<T> &operator+=(T aValue)

Addition operator. Add aValue to every pixel of the image.

Parameters

aValue – the value to add

Returns

the updated version of the current image

Image<T> &operator-=(T aValue)

Subtraction operator. Subtract aValue to every pixel of the image.

Parameters

aValue – the value to subtract

Returns

the updated version of the current image

Image<T> &operator*=(T aValue)

Multiplication operator. Multiply every pixel of the image by aValue.

Parameters

aValue – the value for the multiplication

Returns

the updated version of the current image

Image<T> &operator/=(T aValue)

Division operator. Divide every pixel of the image by aValue.

Parameters

aValue – the value for the division

Returns

the updated version of the current image

Image operator!() const

Negation operator. Compute the negative of the current image.

Returns

the negative image

Image<T> abs() const
Image<T> log() const
Image<T> flipVertically() const
Image<T> flipHorizontally() const
double getSum() const
double getAverage() const
double getVariance() const
double getStandardDeviation() const
double computeSAE(const Image<T> &anImage) const
double computeMAE(const Image<T> &anImage) const
double computeSSE(const Image<T> &anImage) const
double computeMSE(const Image<T> &anImage) const
double computeRMSE(const Image<T> &anImage) const
double computeNCC(const Image<T> &anImage) const
gVirtualXRay::FFT<T> getFFT() const
Image<T> transpose() const
Image<T> resize(unsigned int aNewWidth, unsigned int aNewHeightunsigned, unsigned int aNewNumberOfSlices) const
Image<T> rotate(float anAngleInDegrees) const
Image<T> setCanvasSize(unsigned int aNewWidth, unsigned int aNewHeight, unsigned int aNewNumberOfSlices) const
gVirtualXRay::Sinogram<T> radonTransform(double aFirstAngle, double anAngleStep, double aLastAngle) const
PolygonMesh marchingCubes(const T &aFirstThresholdValue, const T &aSecondThresholdValue = 0, bool aTwoThresholdFlag = false, unsigned char aVerboseLevel = 0) const

Apply the marching cubes algorithm to extract the polygon mesh corresponding to voxel values in the range between aFirstThresholdValue and aSecondThresholdValue.

Parameters
  • aFirstThresholdValue – the first threshold

  • aSecondThresholdValue – the second threshold (optional)

  • aTwoThresholdFlag – if the flag is false, then use aFirstThresholdValue as iso-value. If the flag is true, then use voxel values in the range between aFirstThresholdValue and aSecondThresholdValue. (default value: false)

  • aVerboseLevel – the level of statements in the standard output. For no output, use 0 (default value: 0)

Returns

the polygon mesh

void convertVoxelsToCubes(std::map<T, PolygonMesh> &aPolygonMeshSet, T aThreshold = -1000, unsigned char aVerboseLevel = 0) const

Convert every voxel into a cube.

Parameters
  • aPolygonMeshSet – the set of polygon mesh

  • aThreshold – the iso-value. Any voxel above the iso-value is part of the selected object. Other voxels are ignored.

  • aVerboseLevel – the level of statements in the standard output. For no output, use 0 (default value: 0)

Image<T> convertHU2mu(double anEnergy) const
void allocateHostMemory()
void transferHostToDevice()
void transferDeviceToHost()
void destroyOpenGLTexture()
unsigned int getTextureId() const

Protected Functions

VEC3 VertexInterp(const T &aThresholdValue, const VEC3 &p0, const VEC3 &p1, const T &v0, const T &v1) const

Protected Attributes

unsigned int m_width

Number of pixel along the horizontal axis.

unsigned int m_height

Number of pixel along the vertical axis.

unsigned int m_number_of_slices

Number of slices.

VEC3 m_spacing

The space between two successive pixels.

T *m_p_image

The pixel data.

unsigned int m_texture_id

OpenGL texture ID.

Protected Static Attributes

static unsigned int g_mesh_type
static unsigned int g_vbo_type

Private Functions

void loadMetaHeader(const char *aFileName)
void loadMetaHeader(const std::string &aFileName)
void loadRAW(std::ifstream &anInputStream, unsigned int aWidth, unsigned int aHeight, unsigned int aNumberOfSlices, bool aChangeEndianessFlag, const char *aFileName, const char *anElementType)
void saveMetaHeader(const char *aFileName, bool useDeflateCompressionIfPossible) const
void saveMetaHeader(const std::string &aFileName, bool useDeflateCompressionIfPossible) const
class ImplicitSurface
#include <ImplicitSurface.h>

ImplicitSurface is a class to build 3D implicit surfaces.

Public Types

enum DensityFunctionType

Type of density function.

Values:

enumerator SPHERE

Sphere.

enumerator BLOBBY_MOLECULE

Blobby molecule, first created by Jim Blinn and modelled after electron density fields

enumerator META_BALL

Meta balls.

enumerator SOFT_OBJECT

Soft Objects, first created by the Wyvill brothers

Public Functions

ImplicitSurface()

Default constructor.

~ImplicitSurface()

Destructor.

inline RATIONAL_NUMBER evaluate(RATIONAL_NUMBER r, const DensityFunctionParameterType &aParameter) const

Evaluate the density function for the distance r.

Parameters
  • r – the distance

  • aParameter – the parameter of the density function

Returns

the density

inline void resetControlPoints()

Remove all the control points.

inline void resetControlLines()

Remove all the control lines.

inline void addControlPoint(const DensityFunctionParameterType &aParameter, const VEC3 &aControlPoint)

Add a control point.

Parameters
  • aParameter – the parameter of the density function

  • aControlPoint – the control point to add

inline void addControlLine(const DensityFunctionParameterType &aParameter, const VEC3 &aControlPoint1, const VEC3 &aControlPoint2)

Add a control line.

Parameters
  • aParameter – the parameter of the density function

  • aControlPoint1 – the first point that defines the line segment

  • aControlPoint2 – the second point that defines the line segment

inline unsigned int getNumberOfControlPoints() const

Accessor on the number of control points.

Returns

the number of control points

inline unsigned int getNumberOfControlLineSegments() const

Accessor on the number of control line segments.

Returns

the number of control line segments

inline void setControlPointParameters(unsigned int aPointID, DensityFunctionType aDentityFunction, float aParameter1, float aParameter2 = 0.0)
inline void setControlLineSegmentParameters(unsigned int aLineSegmentID, DensityFunctionType aDentityFunction, float aParameter1, float aParameter2 = 0.0)
inline const VEC3 &getControlPoint(unsigned int anIndex) const

Accessor on a given control point.

Parameters

anIndex – the index of the control point

Returns

the corresponding control point

inline VEC3 &getControlPoint(unsigned int anIndex)

Accessor on a given control point.

Parameters

anIndex – the index of the control point

Returns

the corresponding control point

inline const std::pair<VEC3, VEC3> &getControlLine(unsigned int anIndex) const

Accessor on a given control line.

Parameters

anIndex – the index of the control point

Returns

the corresponding control line segment

inline std::pair<VEC3, VEC3> &getControlLine(unsigned int anIndex)

Accessor on a given control line.

Parameters

anIndex – the index of the control point

Returns

the corresponding control line segment

void voxelise(const Vec3ui &aNumberOfVoxels, const VEC3 &aCenter, const VEC3 &aVoxelSize, unsigned char aVerboseLevel = 0)

Accessor on a given control line.

Parameters
  • aNumberOfVoxels – the number of voxels

  • aCenter – the 3D position of the centre of the dataset

  • aVoxelSize – the size of voxels

  • aVerboseLevel – the level of statements in the standard output. For no output, use 0 (default value: 0)

inline void voxelize(const Vec3ui &aNumberOfVoxels, const VEC3 &aCenter, const VEC3 &aVoxelSize, unsigned char aVerboseLevel = 0)

Accessor on a given control line.

Parameters
  • aNumberOfVoxels – the number of voxels

  • aCenter – the 3D position of the centre of the dataset

  • aVoxelSize – the size of voxels

  • aVerboseLevel – the level of statements in the standard output. For no output, use 0 (default value: 0)

void writeVoxelData(const char *aFileName) const

Write the current voxel data into a file.

Parameters

aFileName – the name of the file where to save the voxel data

inline void writeVoxelData(const std::string &aFileName) const

Write the current voxel data into a file.

Parameters

aFileName – the name of the file where to save the voxel data

void writePolygonMesh(const char *aFileName, bool aBinaryFlag)

Write the polygon data.

Parameters
  • aFileName – the name of the file where to save the polygon data

  • aBinaryFlag – if true, save a binary file; if false save an ASCII file

inline void writePolygonMesh(const std::string &aFileName)

Write the polygon data.

Parameters

aFileName – the name of the file where to save the polygon data

void extractIsoSurface(const RATIONAL_NUMBER &aThreshold = 0, unsigned char aVerboseLevel = 0)

Extract the surface from the voxel data corresponding to a given iso-value.

Parameters
  • aThreshold – the threshold value

  • aVerboseLevel – the level of statements in the standard output. For no output, use 0 (default value: 0)

void extractIsoSurface(const RATIONAL_NUMBER &aLowerThreshold, const RATIONAL_NUMBER &anUpperThreshold, unsigned char aVerboseLevel = 0)

Extract the surface from the voxel data corresponding to a given iso-value.

Parameters
  • aLowerThreshold – the lower threshold value

  • anUpperThreshold – the upper threshold value

  • aVerboseLevel – the level of statements in the standard output. For no output, use 0 (default value: 0)

inline PolygonMesh &getPolygonMesh()

Accessor on the polygon data.

Returns

the polygon data

inline const PolygonMesh &getPolygonMesh() const

Accessor on the polygon data.

Returns

the polygon data

inline const Image<RATIONAL_NUMBER> &getVolume() const
inline Image<RATIONAL_NUMBER> &getVolume()

Protected Functions

inline RATIONAL_NUMBER evaluateSphere(RATIONAL_NUMBER r) const
inline RATIONAL_NUMBER evaluateBlobbyMolecule(RATIONAL_NUMBER r, RATIONAL_NUMBER a, RATIONAL_NUMBER b) const
inline RATIONAL_NUMBER evaluateMetaBall(RATIONAL_NUMBER r, RATIONAL_NUMBER a, RATIONAL_NUMBER b) const
inline RATIONAL_NUMBER evaluateSoftObject(RATIONAL_NUMBER r, RATIONAL_NUMBER a, RATIONAL_NUMBER b) const

Protected Attributes

Image<RATIONAL_NUMBER> m_volume
PolygonMesh m_mesh_data
VEC3 m_centre
std::vector<std::pair<DensityFunctionParameterType, VEC3>> m_control_point_set
std::vector<std::pair<DensityFunctionParameterType, std::pair<VEC3, VEC3>>> m_control_line_set
class InternalOrganMesh : public gVirtualXRay::AnatomicalMesh

InternalOrganMesh is a class to handle a polygon mesh for an internal organ. Internal organs use bump mapping.

Subclassed by gVirtualXRay::BoneMesh, gVirtualXRay::SoftTissueMesh

Public Functions

InternalOrganMesh(bool optimize_texture_coordinates = true, unsigned int texture_2D_size = 1024, unsigned int texture_3D_size = 64)

Default Constructor.

virtual ~InternalOrganMesh()

Destructor.

virtual bool isTransparent() const

return true if the mesh has to be displayed with transparency

virtual bool isSoftTissue() const = 0

return true if the mesh represent a soft tissue

virtual void defineDisplayShaderInput(int shader_id)

Link the attributes to their id in the shader.

virtual void initialize() = 0

initialise the shaders, the buffers, the normal vectors and the textures. Merge vertices for a smoother display if only using 3D textures.

virtual void splitFaces()

Split each face into four faces.

void copyFrom(const InternalOrganMesh &aPolygonMesh)
InternalOrganMesh &operator=(const InternalOrganMesh &aPolygonMesh)
virtual void defineDisplayShaderInput(unsigned int aShaderID)

Link the attributes to their id in the shader.

void copyFrom(const AnatomicalMesh &aPolygonMesh)
void copyFrom(const PolygonMesh &aPolygonMesh)

Copy.

Parameters

aPolygonMesh – the polygon mesh to copy

virtual const std::string &getLabel() const

Accessor on the label that determines the type of the mesh.

void reset()

Reset the data.

inline void resetVBOs()

Reset the VBOs only.

inline void setDisplayFlag(bool display)

Set if the mesh is displayed or not.

Parameters

display – true or false

inline bool getDisplayFlag() const

Accessor on the display flag of the polygon mesh.

Returns

display flag

void display()

Display the triangular mesh using OpenGL.

void displayWireFrame()

Display the triangular mesh in wireframe using OpenGL.

void displayFaceNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the face normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

void displayVertexNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the vertex normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

inline void setFilename(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFilename(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline const std::string &getFilename() const

Accessor on the name of the file that contains the polygon mesh.

Returns

the file name

inline const RATIONAL_NUMBER &getUnitOfLength() const

Accessor on the unit of length of the mesh.

Returns

the unit of length

void loadSTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void writeSTLFile(bool aBinaryFlag)

Write the STL file.

Parameters

aBinaryFlag – if true, save a binary file; if false save an ASCII file

inline void moveToCentre()

Move the polygon to the centre.

inline void moveToCenter()

Move the polygon to the center.

void computeNormalVectors()

Compute the normal vectors using the cross product method.

inline bool useVBO(int aBufferUsageHing, int aTypeOfPrimitive)

Use a vertex buffer object if possible.

Parameters
  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

Returns

true if the VBO can be used, false otherwise

inline void setHU(short HU)
inline void setHounsfieldUnit(short HU)
inline void setHounsfieldValue(short HU)
inline void setElement(unsigned short Z)
inline void setElement(const std::string &aName)
inline void setMixture(const Mixture &aMixture)
inline void setMixture(const std::map<int, double> &aMixture)
inline void setMixture(const std::map<std::string, double> &aMixture)
inline void setMixture(const std::string &aName)
inline void setCompound(const std::string &aName)
inline void setMassAttenuationCoefficient(double aCoefficient)
inline void setLinearAttenuationCoefficient(double aCoefficient)
inline void setDensity(double aDensity)
inline double getDensity()
inline const std::string &getMaterialLabel() const
inline std::string getCompound() const

Accessor on the compound description of the polygon mesh.

Returns

if the sample is made of a compound, then return the description of the compound (e.g. H2O for water), otherwise return an empty string

inline std::vector<int> getMixtureElementSet() const

Accessor on the element Z number set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element Z number set of the mixture, otherwise return an empty vector

inline std::vector<double> getMixtureWeightSet() const

Accessor on the element weight set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element weight set of the mixture, otherwise return an empty vector

inline const PhotonCrossSection &getPhotonCrossSection() const
inline void setPhotonCrossSection(const PhotonCrossSection &aPhotonCrossSection)
inline const VEC3 &getLocalMinCorner() const

Accessor on the bounding box lower corner.

Returns

the bounding box lower corner

inline const VEC3 &getLocalMaxCorner() const

Accessor on the bounding box upper corner.

Returns

the bounding box upper corner

inline void applyTranslation(const VEC3 &aTranslationVector)

Translate the polygon mesh given a translation vector, and update the VBO if needed.

Parameters

aTranslationVector – the translation vector

inline void applyScaling(RATIONAL_NUMBER x, RATIONAL_NUMBER y, RATIONAL_NUMBER z)

Scale the polygon mesh given scaling factors, and update the VBO if needed.

Parameters
  • x – the scaling factor along the X-axis

  • y – the scaling factor along the Y-axis

  • z – the scaling factor along the Z-axis

inline void applyRotation(const VEC3 &aRotationAxis, RATIONAL_NUMBER aRotationAngleInDegrees)

Rotate the polygon mesh given a rotation axis and angle, and update the VBO if needed.

Parameters
  • aRotationAxis – the rotation axis

  • aRotationAngleInDegrees – the rotation angle in degrees

inline void applyTransform(const MATRIX4 &aTransformationMatrix)

Transform the polygon mesh given a transformation matrix and update the VBO if needed.

Parameters

aTransformationMatrix – the transformation matrix

unsigned int getFaceNumber() const

Accessor on the number of faces.

Returns

the number of faces

unsigned int getTriangleNumber() const

Accessor on the number of triangles.

Returns

the number of triangles

inline unsigned int getFaceNormalNumber() const

Accessor on the number of face normal vectors.

Returns

the number of face normal vectors

inline unsigned int getVertexNormalNumber() const

Accessor on the number of vertex normal vectors.

Returns

the number of vertex normal vectors

inline unsigned int getVertexNumber() const

Accessor on the number of vertices.

Returns

the number of vertices

inline unsigned int getIndexNumber() const

Accessor on the number of indices.

Returns

the number of indices

void mergeVertices(bool aPrintDebugInfoFlag = false)

Merge the vertices of the mesh if the data is managed by the class instance, and if no index has been build.

void splitFaces(bool aPrintDebugInfoFlag = false)

Split each face into four faces.

VEC3 getVertex(unsigned int anIndex) const

Accessor on a given vertex.

Parameters

anIndex – the index of the vertex to access

Returns

the vertex

void setVertex(unsigned int anIndex, const VEC3 &aVertex)

Change the value of a given vertex.

Parameters
  • anIndex – the index of the vertex to access

  • aVertex – the new value of the vertex

inline void setFaceNormal(unsigned int anIndex, const VEC3 &aNormalVector)
inline void setVertexNormal(unsigned int anIndex, const VEC3 &aNormalVector)
int getIndex(unsigned int anIndex) const

Accessor on a given index.

Parameters

anIndex – the index of the index to access

Returns

the index

void setIndex(unsigned int anIndex, unsigned int aValue)

Set the value of a given index.

Parameters
  • anIndex – the index of the index to access

  • aValue – the new value of the index

inline VEC3 getFaceNormal(unsigned int anIndex) const

Accessor on a given face normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

inline VEC3 getVertexNormal(unsigned int anIndex) const

Accessor on a given vertex normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

void setExternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setVBOData(const void *aVertexArray, unsigned int aNumberOfVertices, unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO, unsigned int aNumberOfIndices, int anIndexDataType, const void *aIndexArray = NULL, const void *aNormalArray = NULL)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aIndexArray – array containing the index data

  • aNormalArray – array containing the normal data

void setInternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)
void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

inline void applyScale(const RATIONAL_NUMBER &aScale)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters

aScale – scaling factor

void applyScale(const RATIONAL_NUMBER &aScaleX, const RATIONAL_NUMBER &aScaleY, const RATIONAL_NUMBER &aScaleZ)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters
  • aScaleX – scaling factor alng the x-axis

  • aScaleY – scaling factor alng the y-axis

  • aScaleZ – scaling factor alng the z-axis

inline void invertNormalVectors()

Inverse the normal vectors.

virtual void updateVBO(int aTypeOfVBO, int aTypeOfPrimitive)

Update the VBO.

Parameters
  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

virtual void updateVBOs(unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO)

Update the VBOs with VBO already created.

Parameters
  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

inline const Material &getMaterial() const

Accessor on the material of the polygon mesh.

Returns

the material

inline Material &getMaterial()

Accessor on the material of the polygon mesh.

Returns

the material

virtual PolygonMesh operator+(const PolygonMesh &aPolygonMesh) const

operator+.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh operator+(const VEC3 &aTranslationVector) const

operator+.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const PolygonMesh &aPolygonMesh) const

operator-.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const VEC3 &aTranslationVector) const

operator-.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const PolygonMesh &aPolygonMesh)

operator+=.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const VEC3 &aTranslationVector)

operator+=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const PolygonMesh &aPolygonMesh)

operator-=.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const VEC3 &aTranslationVector)

operator-=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

std::map<RATIONAL_NUMBER, VEC3> rayIntersect(const VEC3 &aRayOrigin, const VEC3 &aRayDirection, const MATRIX4 &aTransformationMatrix) const
void getTriangleVertices(VEC3 &v0, VEC3 &v1, VEC3 &v2, unsigned int anIndex) const
inline bool hasNormalVectorsInverted() const

Check if the normal vectors have been inverted.

Returns

true if the normal vectors have been inverted; false otherwise.

Protected Types

enum ToCreate

To know if a bump map or a colour texture has to be created.

Values:

enumerator TO_CREATE_BUMP_MAP
enumerator TO_CREATE_COLOUR_TEXTURE

Protected Functions

virtual void generateTextures() = 0

generates the textures

virtual void generate2DTexture(Shader const &shader, unsigned int &frame_buffer, ToCreate to_create)

generates a 2D texture

virtual void generate3DTexture(Shader const &shader, unsigned int &frame_buffer, unsigned int &texture, ToCreate to_create)

generates a 3D texture

virtual void defineBumpMapShaderInput(int shader_id)

Link the attributes to their id in the shader bump map generation.

virtual void defineColourTextureShaderInput(int shader_id) = 0

Link the attributes to their id in the shader for colour texture generation

virtual void initialize2DBuffer(unsigned int &aTexture, unsigned int &aFrameBuffer)

initialize a 2D frame buffer and bind a texture to it

virtual void initialize3DBuffer(unsigned int &aTexture, unsigned int &aFrameBuffer, bool has_colours)

initialize a 3D frame buffer and bind a texture to its layer 0

virtual void load2DBumpShader()

Load the shader to create the 2D bump map.

virtual void load3DBumpShader()

Load the shader to create the 3D bump map.

virtual void initialize2DTextureCoordinates()

Initialise optimised texture coordinates by sharing an hypothenuse in the texture for two adjacent polygons.

virtual void initialize3DTextureCoordinates()

Initialise 3D texture coordinates.

virtual void shareNormalVectors()

Compute a normal vector per vertex for a smoother display.

virtual void deleteIndices()

delete the indices and calculate new normal vectors

virtual void initGradientTab()

initialize gradient tab for gnoise

virtual void initPermutation()

initialize permutation tab for all noises

inline void computeBoundingBox()

Update the bounding box.

void normaliseNormals()

Normalise the normal vectors.

void destroyVertexData()

Release the memory held by the vertex data if needed.

void destroyIndexData()

Release the memory held by the index data if needed.

void removeIndex(bool aPrintDebugInfoFlag = false)

Remove the index.

void copyVertexSet(const void *apVertexSet)

Copy a vertex set.

void copyIndexSet(const void *apIndexSet)

Copy an index set.

void loadASCIISTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadBinarySTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadSTLDataFromBinaryStream(const char *apInputData, bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • apInputData – the input data to load

  • aMoveToCentreFlag – a flag to move the polygon to the centre or not

  • anAutoComputeNormalFlag – a flag to compute normals or nor

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

Protected Attributes

std::vector<VEC3> m_gradient_tab
std::vector<int> m_permutation
std::vector<VEC2> m_texture_coordinates_2d
std::vector<VEC3> m_texture_coordinates_3d
std::vector<VEC2> m_margin_direction
unsigned int m_bump_map_texture
unsigned int m_bump_map_frame_buffer
Shader m_bump_map_shader
int m_has_tendon
int m_is_lung
int m_has_thin_bumps
int m_use_3D_bump_map
unsigned int m_texture_size_2d
unsigned int m_texture_size_3d
bool m_need_initialize
bool m_generation_texture_coord_are_set
bool m_optimize_texture_coordinates
int m_use_texture

1 if the mesh use texturing; default value is 0

int m_use_bump_map

1 if the mesh use bump mapping; default value is 0

std::string m_label

A label to determine the type of the mesh.

std::string m_filename

Name of the file that contains the polygon mesh.

RATIONAL_NUMBER m_file_scale

Unit of length of the file that contains the polygon mesh (if negative, then unknown)

std::auto_ptr<VBO> m_p_vbo

Vertex buffer object.

std::auto_ptr<PolygonMesh> m_p_face_normal_vbo
std::auto_ptr<PolygonMesh> m_p_vertex_normal_vbo
PhotonCrossSection m_photon_cross_section

Material properties, with respect to X-ray.

VEC3 m_local_min_corner

Lower corner of the bounding box.

VEC3 m_local_max_corner

Upper corner of the bounding box.

std::vector<RATIONAL_NUMBER> m_p_vertex_normal_set

Array containing the normal vectors (one per triangle)

Array containing the normal vectors (one per vertex)

void *m_p_vertex_set

Array containing the vertices.

void *m_p_index_set

Array containing the index.

unsigned int m_number_of_indices

Number of indices.

unsigned int m_number_of_vertices

Number of vertices.

int m_index_data_type

Data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

int m_vertex_data_type

Data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

int m_polygon_type

Polygon type; valid values are GL_TRIANGLES.

bool m_external_data_flag

A flag set to true if the memory is managed outside of this class instance; set to false if the memory is managed by this class instance

bool m_display_flag

A flag set to true if you want to display in the Xray image

Material m_material

Material of the object.

bool m_has_inverted_normal_vectors

A flag set to true if the normal vectors are inverted.

class InvalidImageSizeException : public gVirtualXRay::Exception

InvalidImageSizeException is a class to handle exceptions when the image size is wrong.

Public Functions

inline InvalidImageSizeException(int aWidth, int aHeight, const char *aFileName = 0, const char *aFunctionName = 0, int anErrorLine = 0)

Default constructor.

Parameters
  • aWidth – the image width

  • aHeight – the image height

  • aFileName – name of the source file where the exception was thrown (default value: 0)

  • aFunctionName – name of the function where the exception was thrown (default value: 0)

  • anErrorLine – name at which the exception was thrown (default value: 0)

inline virtual const char *what() const

Accessor on the error message.

Returns

the error message

Protected Attributes

std::string m_error_message

The error message.

class InvalidInternalFormalException : public gVirtualXRay::Exception

InvalidInternalFormalException is a class to handle exceptions when an invalid internal format has been specified.

Public Functions

inline InvalidInternalFormalException(const char *aFileName = 0, const char *aFunctionName = 0, int anErrorLine = 0)

Default constructor.

Parameters
  • aFileName – name of the source file where the exception was thrown (default value: 0)

  • aFunctionName – name of the function where the exception was thrown (default value: 0)

  • anErrorLine – name at which the exception was thrown (default value: 0)

inline virtual const char *what() const

Accessor on the error message.

Returns

the error message

Protected Attributes

std::string m_error_message

The error message.

template<typename T>
class LineMesh : public gVirtualXRay::PolygonMesh
#include <LineMesh.h>

Public Functions

LineMesh(const VEC3 &aStartPoint = VEC3(0, 0, 0), const VEC3 &anEndPoint = VEC3(1.0 * cm, 0, 0))

Default constructor.

void create(const VEC3 &aStartPoint = VEC3(0, 0, 0), const VEC3 &anEndPoint = VEC3(1.0 * cm, 0, 0))

Create a new line segment.

void reset()

Reset the data.

inline void resetVBOs()

Reset the VBOs only.

inline void setDisplayFlag(bool display)

Set if the mesh is displayed or not.

Parameters

display – true or false

inline bool getDisplayFlag() const

Accessor on the display flag of the polygon mesh.

Returns

display flag

void display()

Display the triangular mesh using OpenGL.

void displayWireFrame()

Display the triangular mesh in wireframe using OpenGL.

void displayFaceNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the face normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

void displayVertexNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the vertex normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

inline void setFilename(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFilename(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline const std::string &getFilename() const

Accessor on the name of the file that contains the polygon mesh.

Returns

the file name

inline const RATIONAL_NUMBER &getUnitOfLength() const

Accessor on the unit of length of the mesh.

Returns

the unit of length

void loadSTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void writeSTLFile(bool aBinaryFlag)

Write the STL file.

Parameters

aBinaryFlag – if true, save a binary file; if false save an ASCII file

inline void moveToCentre()

Move the polygon to the centre.

inline void moveToCenter()

Move the polygon to the center.

void computeNormalVectors()

Compute the normal vectors using the cross product method.

inline bool useVBO(int aBufferUsageHing, int aTypeOfPrimitive)

Use a vertex buffer object if possible.

Parameters
  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

Returns

true if the VBO can be used, false otherwise

inline void setHU(short HU)
inline void setHounsfieldUnit(short HU)
inline void setHounsfieldValue(short HU)
inline void setElement(unsigned short Z)
inline void setElement(const std::string &aName)
inline void setMixture(const Mixture &aMixture)
inline void setMixture(const std::map<int, double> &aMixture)
inline void setMixture(const std::map<std::string, double> &aMixture)
inline void setMixture(const std::string &aName)
inline void setCompound(const std::string &aName)
inline void setMassAttenuationCoefficient(double aCoefficient)
inline void setLinearAttenuationCoefficient(double aCoefficient)
inline void setDensity(double aDensity)
inline double getDensity()
inline const std::string &getMaterialLabel() const
inline std::string getCompound() const

Accessor on the compound description of the polygon mesh.

Returns

if the sample is made of a compound, then return the description of the compound (e.g. H2O for water), otherwise return an empty string

inline std::vector<int> getMixtureElementSet() const

Accessor on the element Z number set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element Z number set of the mixture, otherwise return an empty vector

inline std::vector<double> getMixtureWeightSet() const

Accessor on the element weight set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element weight set of the mixture, otherwise return an empty vector

inline const PhotonCrossSection &getPhotonCrossSection() const
inline void setPhotonCrossSection(const PhotonCrossSection &aPhotonCrossSection)
inline const VEC3 &getLocalMinCorner() const

Accessor on the bounding box lower corner.

Returns

the bounding box lower corner

inline const VEC3 &getLocalMaxCorner() const

Accessor on the bounding box upper corner.

Returns

the bounding box upper corner

inline void applyTranslation(const VEC3 &aTranslationVector)

Translate the polygon mesh given a translation vector, and update the VBO if needed.

Parameters

aTranslationVector – the translation vector

inline void applyScaling(RATIONAL_NUMBER x, RATIONAL_NUMBER y, RATIONAL_NUMBER z)

Scale the polygon mesh given scaling factors, and update the VBO if needed.

Parameters
  • x – the scaling factor along the X-axis

  • y – the scaling factor along the Y-axis

  • z – the scaling factor along the Z-axis

inline void applyRotation(const VEC3 &aRotationAxis, RATIONAL_NUMBER aRotationAngleInDegrees)

Rotate the polygon mesh given a rotation axis and angle, and update the VBO if needed.

Parameters
  • aRotationAxis – the rotation axis

  • aRotationAngleInDegrees – the rotation angle in degrees

inline void applyTransform(const MATRIX4 &aTransformationMatrix)

Transform the polygon mesh given a transformation matrix and update the VBO if needed.

Parameters

aTransformationMatrix – the transformation matrix

unsigned int getFaceNumber() const

Accessor on the number of faces.

Returns

the number of faces

unsigned int getTriangleNumber() const

Accessor on the number of triangles.

Returns

the number of triangles

inline unsigned int getFaceNormalNumber() const

Accessor on the number of face normal vectors.

Returns

the number of face normal vectors

inline unsigned int getVertexNormalNumber() const

Accessor on the number of vertex normal vectors.

Returns

the number of vertex normal vectors

inline unsigned int getVertexNumber() const

Accessor on the number of vertices.

Returns

the number of vertices

inline unsigned int getIndexNumber() const

Accessor on the number of indices.

Returns

the number of indices

void mergeVertices(bool aPrintDebugInfoFlag = false)

Merge the vertices of the mesh if the data is managed by the class instance, and if no index has been build.

void splitFaces(bool aPrintDebugInfoFlag = false)

Split each face into four faces.

VEC3 getVertex(unsigned int anIndex) const

Accessor on a given vertex.

Parameters

anIndex – the index of the vertex to access

Returns

the vertex

void setVertex(unsigned int anIndex, const VEC3 &aVertex)

Change the value of a given vertex.

Parameters
  • anIndex – the index of the vertex to access

  • aVertex – the new value of the vertex

inline void setFaceNormal(unsigned int anIndex, const VEC3 &aNormalVector)
inline void setVertexNormal(unsigned int anIndex, const VEC3 &aNormalVector)
int getIndex(unsigned int anIndex) const

Accessor on a given index.

Parameters

anIndex – the index of the index to access

Returns

the index

void setIndex(unsigned int anIndex, unsigned int aValue)

Set the value of a given index.

Parameters
  • anIndex – the index of the index to access

  • aValue – the new value of the index

inline VEC3 getFaceNormal(unsigned int anIndex) const

Accessor on a given face normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

inline VEC3 getVertexNormal(unsigned int anIndex) const

Accessor on a given vertex normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

void setExternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setVBOData(const void *aVertexArray, unsigned int aNumberOfVertices, unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO, unsigned int aNumberOfIndices, int anIndexDataType, const void *aIndexArray = NULL, const void *aNormalArray = NULL)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aIndexArray – array containing the index data

  • aNormalArray – array containing the normal data

void setInternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)
void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

inline void applyScale(const RATIONAL_NUMBER &aScale)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters

aScale – scaling factor

void applyScale(const RATIONAL_NUMBER &aScaleX, const RATIONAL_NUMBER &aScaleY, const RATIONAL_NUMBER &aScaleZ)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters
  • aScaleX – scaling factor alng the x-axis

  • aScaleY – scaling factor alng the y-axis

  • aScaleZ – scaling factor alng the z-axis

inline void invertNormalVectors()

Inverse the normal vectors.

virtual void updateVBO(int aTypeOfVBO, int aTypeOfPrimitive)

Update the VBO.

Parameters
  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

virtual void updateVBOs(unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO)

Update the VBOs with VBO already created.

Parameters
  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

inline const Material &getMaterial() const

Accessor on the material of the polygon mesh.

Returns

the material

inline Material &getMaterial()

Accessor on the material of the polygon mesh.

Returns

the material

void copyFrom(const PolygonMesh &aPolygonMesh)

Copy.

Parameters

aPolygonMesh – the polygon mesh to copy

virtual PolygonMesh operator+(const PolygonMesh &aPolygonMesh) const

operator+.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh operator+(const VEC3 &aTranslationVector) const

operator+.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const PolygonMesh &aPolygonMesh) const

operator-.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const VEC3 &aTranslationVector) const

operator-.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const PolygonMesh &aPolygonMesh)

operator+=.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const VEC3 &aTranslationVector)

operator+=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const PolygonMesh &aPolygonMesh)

operator-=.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const VEC3 &aTranslationVector)

operator-=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

std::map<RATIONAL_NUMBER, VEC3> rayIntersect(const VEC3 &aRayOrigin, const VEC3 &aRayDirection, const MATRIX4 &aTransformationMatrix) const
void getTriangleVertices(VEC3 &v0, VEC3 &v1, VEC3 &v2, unsigned int anIndex) const
inline bool hasNormalVectorsInverted() const

Check if the normal vectors have been inverted.

Returns

true if the normal vectors have been inverted; false otherwise.

Protected Functions

inline void computeBoundingBox()

Update the bounding box.

void normaliseNormals()

Normalise the normal vectors.

void destroyVertexData()

Release the memory held by the vertex data if needed.

void destroyIndexData()

Release the memory held by the index data if needed.

void removeIndex(bool aPrintDebugInfoFlag = false)

Remove the index.

void copyVertexSet(const void *apVertexSet)

Copy a vertex set.

void copyIndexSet(const void *apIndexSet)

Copy an index set.

void loadASCIISTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadBinarySTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadSTLDataFromBinaryStream(const char *apInputData, bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • apInputData – the input data to load

  • aMoveToCentreFlag – a flag to move the polygon to the centre or not

  • anAutoComputeNormalFlag – a flag to compute normals or nor

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

Protected Attributes

std::string m_filename

Name of the file that contains the polygon mesh.

RATIONAL_NUMBER m_file_scale

Unit of length of the file that contains the polygon mesh (if negative, then unknown)

std::auto_ptr<VBO> m_p_vbo

Vertex buffer object.

std::auto_ptr<PolygonMesh> m_p_face_normal_vbo
std::auto_ptr<PolygonMesh> m_p_vertex_normal_vbo
PhotonCrossSection m_photon_cross_section

Material properties, with respect to X-ray.

VEC3 m_local_min_corner

Lower corner of the bounding box.

VEC3 m_local_max_corner

Upper corner of the bounding box.

std::vector<RATIONAL_NUMBER> m_p_vertex_normal_set

Array containing the normal vectors (one per triangle)

Array containing the normal vectors (one per vertex)

void *m_p_vertex_set

Array containing the vertices.

void *m_p_index_set

Array containing the index.

unsigned int m_number_of_indices

Number of indices.

unsigned int m_number_of_vertices

Number of vertices.

int m_index_data_type

Data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

int m_vertex_data_type

Data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

int m_polygon_type

Polygon type; valid values are GL_TRIANGLES.

bool m_external_data_flag

A flag set to true if the memory is managed outside of this class instance; set to false if the memory is managed by this class instance

bool m_display_flag

A flag set to true if you want to display in the Xray image

Material m_material

Material of the object.

bool m_has_inverted_normal_vectors

A flag set to true if the normal vectors are inverted.

class LiverMesh : public gVirtualXRay::SoftTissueMesh
#include <LiverMesh.h>

LiverMesh is a class to handle a polygon mesh for a liver. It uses 3D texture for the bump map and 2D texture for the colour.

Public Functions

LiverMesh(bool optimize_texture_coordinates = true, unsigned int texture_2D_size = 512, unsigned int texture_3D_size = 32)

Default Constructor.

virtual ~LiverMesh()

Destructor.

virtual bool isSoftTissue() const

return true if the mesh represent a soft tissue

virtual void updateVBO(int aTypeOfVBO, int aTypeOfPrimitive)

Update the VBO.

Parameters
  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

virtual void defineDisplayShaderInput(int aShaderID)

Link the attributes to their id in the shader.

virtual void defineDisplayShaderInput(unsigned int aShaderID)

Link the attributes to their id in the shader.

virtual void initialize()

initialize the shaders, the buffers, the normal vectors and the textures

virtual bool isTransparent() const

return true if the mesh has to be displayed with transparency

virtual void splitFaces()

Split each face into four faces.

void splitFaces(bool aPrintDebugInfoFlag = false)

Split each face into four faces.

void copyFrom(const InternalOrganMesh &aPolygonMesh)
void copyFrom(const AnatomicalMesh &aPolygonMesh)
void copyFrom(const PolygonMesh &aPolygonMesh)

Copy.

Parameters

aPolygonMesh – the polygon mesh to copy

virtual const std::string &getLabel() const

Accessor on the label that determines the type of the mesh.

void reset()

Reset the data.

inline void resetVBOs()

Reset the VBOs only.

inline void setDisplayFlag(bool display)

Set if the mesh is displayed or not.

Parameters

display – true or false

inline bool getDisplayFlag() const

Accessor on the display flag of the polygon mesh.

Returns

display flag

void display()

Display the triangular mesh using OpenGL.

void displayWireFrame()

Display the triangular mesh in wireframe using OpenGL.

void displayFaceNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the face normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

void displayVertexNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the vertex normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

inline void setFilename(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFilename(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline const std::string &getFilename() const

Accessor on the name of the file that contains the polygon mesh.

Returns

the file name

inline const RATIONAL_NUMBER &getUnitOfLength() const

Accessor on the unit of length of the mesh.

Returns

the unit of length

void loadSTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void writeSTLFile(bool aBinaryFlag)

Write the STL file.

Parameters

aBinaryFlag – if true, save a binary file; if false save an ASCII file

inline void moveToCentre()

Move the polygon to the centre.

inline void moveToCenter()

Move the polygon to the center.

void computeNormalVectors()

Compute the normal vectors using the cross product method.

inline bool useVBO(int aBufferUsageHing, int aTypeOfPrimitive)

Use a vertex buffer object if possible.

Parameters
  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

Returns

true if the VBO can be used, false otherwise

inline void setHU(short HU)
inline void setHounsfieldUnit(short HU)
inline void setHounsfieldValue(short HU)
inline void setElement(unsigned short Z)
inline void setElement(const std::string &aName)
inline void setMixture(const Mixture &aMixture)
inline void setMixture(const std::map<int, double> &aMixture)
inline void setMixture(const std::map<std::string, double> &aMixture)
inline void setMixture(const std::string &aName)
inline void setCompound(const std::string &aName)
inline void setMassAttenuationCoefficient(double aCoefficient)
inline void setLinearAttenuationCoefficient(double aCoefficient)
inline void setDensity(double aDensity)
inline double getDensity()
inline const std::string &getMaterialLabel() const
inline std::string getCompound() const

Accessor on the compound description of the polygon mesh.

Returns

if the sample is made of a compound, then return the description of the compound (e.g. H2O for water), otherwise return an empty string

inline std::vector<int> getMixtureElementSet() const

Accessor on the element Z number set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element Z number set of the mixture, otherwise return an empty vector

inline std::vector<double> getMixtureWeightSet() const

Accessor on the element weight set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element weight set of the mixture, otherwise return an empty vector

inline const PhotonCrossSection &getPhotonCrossSection() const
inline void setPhotonCrossSection(const PhotonCrossSection &aPhotonCrossSection)
inline const VEC3 &getLocalMinCorner() const

Accessor on the bounding box lower corner.

Returns

the bounding box lower corner

inline const VEC3 &getLocalMaxCorner() const

Accessor on the bounding box upper corner.

Returns

the bounding box upper corner

inline void applyTranslation(const VEC3 &aTranslationVector)

Translate the polygon mesh given a translation vector, and update the VBO if needed.

Parameters

aTranslationVector – the translation vector

inline void applyScaling(RATIONAL_NUMBER x, RATIONAL_NUMBER y, RATIONAL_NUMBER z)

Scale the polygon mesh given scaling factors, and update the VBO if needed.

Parameters
  • x – the scaling factor along the X-axis

  • y – the scaling factor along the Y-axis

  • z – the scaling factor along the Z-axis

inline void applyRotation(const VEC3 &aRotationAxis, RATIONAL_NUMBER aRotationAngleInDegrees)

Rotate the polygon mesh given a rotation axis and angle, and update the VBO if needed.

Parameters
  • aRotationAxis – the rotation axis

  • aRotationAngleInDegrees – the rotation angle in degrees

inline void applyTransform(const MATRIX4 &aTransformationMatrix)

Transform the polygon mesh given a transformation matrix and update the VBO if needed.

Parameters

aTransformationMatrix – the transformation matrix

unsigned int getFaceNumber() const

Accessor on the number of faces.

Returns

the number of faces

unsigned int getTriangleNumber() const

Accessor on the number of triangles.

Returns

the number of triangles

inline unsigned int getFaceNormalNumber() const

Accessor on the number of face normal vectors.

Returns

the number of face normal vectors

inline unsigned int getVertexNormalNumber() const

Accessor on the number of vertex normal vectors.

Returns

the number of vertex normal vectors

inline unsigned int getVertexNumber() const

Accessor on the number of vertices.

Returns

the number of vertices

inline unsigned int getIndexNumber() const

Accessor on the number of indices.

Returns

the number of indices

void mergeVertices(bool aPrintDebugInfoFlag = false)

Merge the vertices of the mesh if the data is managed by the class instance, and if no index has been build.

VEC3 getVertex(unsigned int anIndex) const

Accessor on a given vertex.

Parameters

anIndex – the index of the vertex to access

Returns

the vertex

void setVertex(unsigned int anIndex, const VEC3 &aVertex)

Change the value of a given vertex.

Parameters
  • anIndex – the index of the vertex to access

  • aVertex – the new value of the vertex

inline void setFaceNormal(unsigned int anIndex, const VEC3 &aNormalVector)
inline void setVertexNormal(unsigned int anIndex, const VEC3 &aNormalVector)
int getIndex(unsigned int anIndex) const

Accessor on a given index.

Parameters

anIndex – the index of the index to access

Returns

the index

void setIndex(unsigned int anIndex, unsigned int aValue)

Set the value of a given index.

Parameters
  • anIndex – the index of the index to access

  • aValue – the new value of the index

inline VEC3 getFaceNormal(unsigned int anIndex) const

Accessor on a given face normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

inline VEC3 getVertexNormal(unsigned int anIndex) const

Accessor on a given vertex normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

void setExternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setVBOData(const void *aVertexArray, unsigned int aNumberOfVertices, unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO, unsigned int aNumberOfIndices, int anIndexDataType, const void *aIndexArray = NULL, const void *aNormalArray = NULL)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aIndexArray – array containing the index data

  • aNormalArray – array containing the normal data

void setInternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)
void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

inline void applyScale(const RATIONAL_NUMBER &aScale)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters

aScale – scaling factor

void applyScale(const RATIONAL_NUMBER &aScaleX, const RATIONAL_NUMBER &aScaleY, const RATIONAL_NUMBER &aScaleZ)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters
  • aScaleX – scaling factor alng the x-axis

  • aScaleY – scaling factor alng the y-axis

  • aScaleZ – scaling factor alng the z-axis

inline void invertNormalVectors()

Inverse the normal vectors.

virtual void updateVBOs(unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO)

Update the VBOs with VBO already created.

Parameters
  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

inline const Material &getMaterial() const

Accessor on the material of the polygon mesh.

Returns

the material

inline Material &getMaterial()

Accessor on the material of the polygon mesh.

Returns

the material

virtual PolygonMesh operator+(const PolygonMesh &aPolygonMesh) const

operator+.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh operator+(const VEC3 &aTranslationVector) const

operator+.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const PolygonMesh &aPolygonMesh) const

operator-.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const VEC3 &aTranslationVector) const

operator-.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const PolygonMesh &aPolygonMesh)

operator+=.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const VEC3 &aTranslationVector)

operator+=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const PolygonMesh &aPolygonMesh)

operator-=.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const VEC3 &aTranslationVector)

operator-=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

std::map<RATIONAL_NUMBER, VEC3> rayIntersect(const VEC3 &aRayOrigin, const VEC3 &aRayDirection, const MATRIX4 &aTransformationMatrix) const
void getTriangleVertices(VEC3 &v0, VEC3 &v1, VEC3 &v2, unsigned int anIndex) const
inline bool hasNormalVectorsInverted() const

Check if the normal vectors have been inverted.

Returns

true if the normal vectors have been inverted; false otherwise.

Protected Types

enum ToCreate

To know if a bump map or a colour texture has to be created.

Values:

enumerator TO_CREATE_BUMP_MAP
enumerator TO_CREATE_COLOUR_TEXTURE

Protected Functions

virtual void generateTextures()

generates the textures

virtual void defineBumpMapShaderInput(int shader_id)

Link the attributes to their id in the shader bump map generation.

virtual void defineColourTextureShaderInput(int shader_id)

Link the attributes to their id in the shader for colour texture generation

virtual void generate2DTexture(Shader const &shader, unsigned int &frame_buffer, ToCreate to_create)

generates a 2D texture

virtual void generate3DTexture(Shader const &shader, unsigned int &frame_buffer, unsigned int &texture, ToCreate to_create)

generates a 3D texture

virtual void initialize2DBuffer(unsigned int &aTexture, unsigned int &aFrameBuffer)

initialize a 2D frame buffer and bind a texture to it

virtual void initialize3DBuffer(unsigned int &aTexture, unsigned int &aFrameBuffer, bool has_colours)

initialize a 3D frame buffer and bind a texture to its layer 0

virtual void load2DBumpShader()

Load the shader to create the 2D bump map.

virtual void load3DBumpShader()

Load the shader to create the 3D bump map.

virtual void initialize2DTextureCoordinates()

Initialise optimised texture coordinates by sharing an hypothenuse in the texture for two adjacent polygons.

virtual void initialize3DTextureCoordinates()

Initialise 3D texture coordinates.

virtual void shareNormalVectors()

Compute a normal vector per vertex for a smoother display.

virtual void deleteIndices()

delete the indices and calculate new normal vectors

virtual void initGradientTab()

initialize gradient tab for gnoise

virtual void initPermutation()

initialize permutation tab for all noises

inline void computeBoundingBox()

Update the bounding box.

void normaliseNormals()

Normalise the normal vectors.

void destroyVertexData()

Release the memory held by the vertex data if needed.

void destroyIndexData()

Release the memory held by the index data if needed.

void removeIndex(bool aPrintDebugInfoFlag = false)

Remove the index.

void copyVertexSet(const void *apVertexSet)

Copy a vertex set.

void copyIndexSet(const void *apIndexSet)

Copy an index set.

void loadASCIISTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadBinarySTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadSTLDataFromBinaryStream(const char *apInputData, bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • apInputData – the input data to load

  • aMoveToCentreFlag – a flag to move the polygon to the centre or not

  • anAutoComputeNormalFlag – a flag to compute normals or nor

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

Protected Attributes

unsigned int m_colour_texture
unsigned int m_colour_texture_frame_buffer
int m_use_3D_colour_texture
Shader m_colour_texture_shader
std::vector<VEC3> m_gradient_tab
std::vector<int> m_permutation
std::vector<VEC2> m_texture_coordinates_2d
std::vector<VEC3> m_texture_coordinates_3d
std::vector<VEC2> m_margin_direction
unsigned int m_bump_map_texture
unsigned int m_bump_map_frame_buffer
Shader m_bump_map_shader
int m_has_tendon
int m_is_lung
int m_has_thin_bumps
int m_use_3D_bump_map
unsigned int m_texture_size_2d
unsigned int m_texture_size_3d
bool m_need_initialize
bool m_generation_texture_coord_are_set
bool m_optimize_texture_coordinates
int m_use_texture

1 if the mesh use texturing; default value is 0

int m_use_bump_map

1 if the mesh use bump mapping; default value is 0

std::string m_label

A label to determine the type of the mesh.

std::string m_filename

Name of the file that contains the polygon mesh.

RATIONAL_NUMBER m_file_scale

Unit of length of the file that contains the polygon mesh (if negative, then unknown)

std::auto_ptr<VBO> m_p_vbo

Vertex buffer object.

std::auto_ptr<PolygonMesh> m_p_face_normal_vbo
std::auto_ptr<PolygonMesh> m_p_vertex_normal_vbo
PhotonCrossSection m_photon_cross_section

Material properties, with respect to X-ray.

VEC3 m_local_min_corner

Lower corner of the bounding box.

VEC3 m_local_max_corner

Upper corner of the bounding box.

std::vector<RATIONAL_NUMBER> m_p_vertex_normal_set

Array containing the normal vectors (one per triangle)

Array containing the normal vectors (one per vertex)

void *m_p_vertex_set

Array containing the vertices.

void *m_p_index_set

Array containing the index.

unsigned int m_number_of_indices

Number of indices.

unsigned int m_number_of_vertices

Number of vertices.

int m_index_data_type

Data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

int m_vertex_data_type

Data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

int m_polygon_type

Polygon type; valid values are GL_TRIANGLES.

bool m_external_data_flag

A flag set to true if the memory is managed outside of this class instance; set to false if the memory is managed by this class instance

bool m_display_flag

A flag set to true if you want to display in the Xray image

Material m_material

Material of the object.

bool m_has_inverted_normal_vectors

A flag set to true if the normal vectors are inverted.

class Logger
#include <Logger.h>

Public Functions

Logger(const char *aFileName = "gvxr.log")
Logger(const std::string &aFileName = "gvxr.log")
~Logger()
bool is_open() const
void open(const std::string &aFileName)
void close()
void flush()
const std::string &getFilename() const
const std::string &getFname() const
std::ostream &logNow(const std::string &aMessage = "")
std::ostream &logError(const std::string &aMessage = "")
std::ostream &logWarning(const std::string &aMessage = "")
void progressBar(float aPercentage, bool aNewLineFlag = false)
void progressBar(unsigned int aProgress, unsigned int aTotal, bool aNewLineFlag = false)

Protected Functions

std::string getNow() const
Logger &operator=(const Logger &aLogger)
Logger(const Logger &aLogger)

Protected Attributes

std::ofstream m_output
std::string m_filename
int m_last_progress_as_int
class LungsMesh : public gVirtualXRay::SoftTissueMesh
#include <LungsMesh.h>

LungsMesh is a class to handle a polygon mesh for a lung. It uses 2D texture for the bump map and 3D texture for the colour.

Public Functions

LungsMesh(bool x_mirror = false, bool y_mirror = false, bool z_mirror = false, bool optimize_texture_coordinates = true, unsigned int texture_2D_size = 2048, unsigned int texture_3D_size = 32)

Constructor.

virtual ~LungsMesh()

Destructor.

virtual bool isSoftTissue() const

return true if the mesh represent a soft tissue

virtual void updateVBO(int aTypeOfVBO, int aTypeOfPrimitive)

Update the VBO.

Parameters
  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

virtual void defineDisplayShaderInput(int aShaderID)

Link the attributes to their id in the shader.

virtual void defineDisplayShaderInput(unsigned int aShaderID)

Link the attributes to their id in the shader.

virtual void initialize()

initialize the shaders, the buffers, the normal vectors and the textures

virtual bool isTransparent() const

return true if the mesh has to be displayed with transparency

virtual void splitFaces()

Split each face into four faces.

void splitFaces(bool aPrintDebugInfoFlag = false)

Split each face into four faces.

void copyFrom(const InternalOrganMesh &aPolygonMesh)
void copyFrom(const AnatomicalMesh &aPolygonMesh)
void copyFrom(const PolygonMesh &aPolygonMesh)

Copy.

Parameters

aPolygonMesh – the polygon mesh to copy

virtual const std::string &getLabel() const

Accessor on the label that determines the type of the mesh.

void reset()

Reset the data.

inline void resetVBOs()

Reset the VBOs only.

inline void setDisplayFlag(bool display)

Set if the mesh is displayed or not.

Parameters

display – true or false

inline bool getDisplayFlag() const

Accessor on the display flag of the polygon mesh.

Returns

display flag

void display()

Display the triangular mesh using OpenGL.

void displayWireFrame()

Display the triangular mesh in wireframe using OpenGL.

void displayFaceNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the face normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

void displayVertexNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the vertex normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

inline void setFilename(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFilename(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline const std::string &getFilename() const

Accessor on the name of the file that contains the polygon mesh.

Returns

the file name

inline const RATIONAL_NUMBER &getUnitOfLength() const

Accessor on the unit of length of the mesh.

Returns

the unit of length

void loadSTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void writeSTLFile(bool aBinaryFlag)

Write the STL file.

Parameters

aBinaryFlag – if true, save a binary file; if false save an ASCII file

inline void moveToCentre()

Move the polygon to the centre.

inline void moveToCenter()

Move the polygon to the center.

void computeNormalVectors()

Compute the normal vectors using the cross product method.

inline bool useVBO(int aBufferUsageHing, int aTypeOfPrimitive)

Use a vertex buffer object if possible.

Parameters
  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

Returns

true if the VBO can be used, false otherwise

inline void setHU(short HU)
inline void setHounsfieldUnit(short HU)
inline void setHounsfieldValue(short HU)
inline void setElement(unsigned short Z)
inline void setElement(const std::string &aName)
inline void setMixture(const Mixture &aMixture)
inline void setMixture(const std::map<int, double> &aMixture)
inline void setMixture(const std::map<std::string, double> &aMixture)
inline void setMixture(const std::string &aName)
inline void setCompound(const std::string &aName)
inline void setMassAttenuationCoefficient(double aCoefficient)
inline void setLinearAttenuationCoefficient(double aCoefficient)
inline void setDensity(double aDensity)
inline double getDensity()
inline const std::string &getMaterialLabel() const
inline std::string getCompound() const

Accessor on the compound description of the polygon mesh.

Returns

if the sample is made of a compound, then return the description of the compound (e.g. H2O for water), otherwise return an empty string

inline std::vector<int> getMixtureElementSet() const

Accessor on the element Z number set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element Z number set of the mixture, otherwise return an empty vector

inline std::vector<double> getMixtureWeightSet() const

Accessor on the element weight set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element weight set of the mixture, otherwise return an empty vector

inline const PhotonCrossSection &getPhotonCrossSection() const
inline void setPhotonCrossSection(const PhotonCrossSection &aPhotonCrossSection)
inline const VEC3 &getLocalMinCorner() const

Accessor on the bounding box lower corner.

Returns

the bounding box lower corner

inline const VEC3 &getLocalMaxCorner() const

Accessor on the bounding box upper corner.

Returns

the bounding box upper corner

inline void applyTranslation(const VEC3 &aTranslationVector)

Translate the polygon mesh given a translation vector, and update the VBO if needed.

Parameters

aTranslationVector – the translation vector

inline void applyScaling(RATIONAL_NUMBER x, RATIONAL_NUMBER y, RATIONAL_NUMBER z)

Scale the polygon mesh given scaling factors, and update the VBO if needed.

Parameters
  • x – the scaling factor along the X-axis

  • y – the scaling factor along the Y-axis

  • z – the scaling factor along the Z-axis

inline void applyRotation(const VEC3 &aRotationAxis, RATIONAL_NUMBER aRotationAngleInDegrees)

Rotate the polygon mesh given a rotation axis and angle, and update the VBO if needed.

Parameters
  • aRotationAxis – the rotation axis

  • aRotationAngleInDegrees – the rotation angle in degrees

inline void applyTransform(const MATRIX4 &aTransformationMatrix)

Transform the polygon mesh given a transformation matrix and update the VBO if needed.

Parameters

aTransformationMatrix – the transformation matrix

unsigned int getFaceNumber() const

Accessor on the number of faces.

Returns

the number of faces

unsigned int getTriangleNumber() const

Accessor on the number of triangles.

Returns

the number of triangles

inline unsigned int getFaceNormalNumber() const

Accessor on the number of face normal vectors.

Returns

the number of face normal vectors

inline unsigned int getVertexNormalNumber() const

Accessor on the number of vertex normal vectors.

Returns

the number of vertex normal vectors

inline unsigned int getVertexNumber() const

Accessor on the number of vertices.

Returns

the number of vertices

inline unsigned int getIndexNumber() const

Accessor on the number of indices.

Returns

the number of indices

void mergeVertices(bool aPrintDebugInfoFlag = false)

Merge the vertices of the mesh if the data is managed by the class instance, and if no index has been build.

VEC3 getVertex(unsigned int anIndex) const

Accessor on a given vertex.

Parameters

anIndex – the index of the vertex to access

Returns

the vertex

void setVertex(unsigned int anIndex, const VEC3 &aVertex)

Change the value of a given vertex.

Parameters
  • anIndex – the index of the vertex to access

  • aVertex – the new value of the vertex

inline void setFaceNormal(unsigned int anIndex, const VEC3 &aNormalVector)
inline void setVertexNormal(unsigned int anIndex, const VEC3 &aNormalVector)
int getIndex(unsigned int anIndex) const

Accessor on a given index.

Parameters

anIndex – the index of the index to access

Returns

the index

void setIndex(unsigned int anIndex, unsigned int aValue)

Set the value of a given index.

Parameters
  • anIndex – the index of the index to access

  • aValue – the new value of the index

inline VEC3 getFaceNormal(unsigned int anIndex) const

Accessor on a given face normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

inline VEC3 getVertexNormal(unsigned int anIndex) const

Accessor on a given vertex normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

void setExternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setVBOData(const void *aVertexArray, unsigned int aNumberOfVertices, unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO, unsigned int aNumberOfIndices, int anIndexDataType, const void *aIndexArray = NULL, const void *aNormalArray = NULL)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aIndexArray – array containing the index data

  • aNormalArray – array containing the normal data

void setInternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)
void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

inline void applyScale(const RATIONAL_NUMBER &aScale)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters

aScale – scaling factor

void applyScale(const RATIONAL_NUMBER &aScaleX, const RATIONAL_NUMBER &aScaleY, const RATIONAL_NUMBER &aScaleZ)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters
  • aScaleX – scaling factor alng the x-axis

  • aScaleY – scaling factor alng the y-axis

  • aScaleZ – scaling factor alng the z-axis

inline void invertNormalVectors()

Inverse the normal vectors.

virtual void updateVBOs(unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO)

Update the VBOs with VBO already created.

Parameters
  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

inline const Material &getMaterial() const

Accessor on the material of the polygon mesh.

Returns

the material

inline Material &getMaterial()

Accessor on the material of the polygon mesh.

Returns

the material

virtual PolygonMesh operator+(const PolygonMesh &aPolygonMesh) const

operator+.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh operator+(const VEC3 &aTranslationVector) const

operator+.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const PolygonMesh &aPolygonMesh) const

operator-.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const VEC3 &aTranslationVector) const

operator-.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const PolygonMesh &aPolygonMesh)

operator+=.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const VEC3 &aTranslationVector)

operator+=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const PolygonMesh &aPolygonMesh)

operator-=.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const VEC3 &aTranslationVector)

operator-=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

std::map<RATIONAL_NUMBER, VEC3> rayIntersect(const VEC3 &aRayOrigin, const VEC3 &aRayDirection, const MATRIX4 &aTransformationMatrix) const
void getTriangleVertices(VEC3 &v0, VEC3 &v1, VEC3 &v2, unsigned int anIndex) const
inline bool hasNormalVectorsInverted() const

Check if the normal vectors have been inverted.

Returns

true if the normal vectors have been inverted; false otherwise.

Protected Types

enum ToCreate

To know if a bump map or a colour texture has to be created.

Values:

enumerator TO_CREATE_BUMP_MAP
enumerator TO_CREATE_COLOUR_TEXTURE

Protected Functions

virtual void defineBumpMapShaderInput(int shader_id)

Link the attributes to their id in the shader bump map generation.

virtual void defineColourTextureShaderInput(int shader_id)

Link the attributes to their id in the shader for colour texture generation

virtual void generateTextures()

generates the textures

virtual void generate2DTexture(Shader const &shader, unsigned int &frame_buffer, ToCreate to_create)

generates a 2D texture

virtual void generate3DTexture(Shader const &shader, unsigned int &frame_buffer, unsigned int &texture, ToCreate to_create)

generates a 3D texture

virtual void initialize2DBuffer(unsigned int &aTexture, unsigned int &aFrameBuffer)

initialize a 2D frame buffer and bind a texture to it

virtual void initialize3DBuffer(unsigned int &aTexture, unsigned int &aFrameBuffer, bool has_colours)

initialize a 3D frame buffer and bind a texture to its layer 0

virtual void load2DBumpShader()

Load the shader to create the 2D bump map.

virtual void load3DBumpShader()

Load the shader to create the 3D bump map.

virtual void initialize2DTextureCoordinates()

Initialise optimised texture coordinates by sharing an hypothenuse in the texture for two adjacent polygons.

virtual void initialize3DTextureCoordinates()

Initialise 3D texture coordinates.

virtual void shareNormalVectors()

Compute a normal vector per vertex for a smoother display.

virtual void deleteIndices()

delete the indices and calculate new normal vectors

virtual void initGradientTab()

initialize gradient tab for gnoise

virtual void initPermutation()

initialize permutation tab for all noises

inline void computeBoundingBox()

Update the bounding box.

void normaliseNormals()

Normalise the normal vectors.

void destroyVertexData()

Release the memory held by the vertex data if needed.

void destroyIndexData()

Release the memory held by the index data if needed.

void removeIndex(bool aPrintDebugInfoFlag = false)

Remove the index.

void copyVertexSet(const void *apVertexSet)

Copy a vertex set.

void copyIndexSet(const void *apIndexSet)

Copy an index set.

void loadASCIISTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadBinarySTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadSTLDataFromBinaryStream(const char *apInputData, bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • apInputData – the input data to load

  • aMoveToCentreFlag – a flag to move the polygon to the centre or not

  • anAutoComputeNormalFlag – a flag to compute normals or nor

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

Protected Attributes

bool m_x_mirror
bool m_y_mirror
bool m_z_mirror
unsigned int m_colour_texture
unsigned int m_colour_texture_frame_buffer
int m_use_3D_colour_texture
Shader m_colour_texture_shader
std::vector<VEC3> m_gradient_tab
std::vector<int> m_permutation
std::vector<VEC2> m_texture_coordinates_2d
std::vector<VEC3> m_texture_coordinates_3d
std::vector<VEC2> m_margin_direction
unsigned int m_bump_map_texture
unsigned int m_bump_map_frame_buffer
Shader m_bump_map_shader
int m_has_tendon
int m_is_lung
int m_has_thin_bumps
int m_use_3D_bump_map
unsigned int m_texture_size_2d
unsigned int m_texture_size_3d
bool m_need_initialize
bool m_generation_texture_coord_are_set
bool m_optimize_texture_coordinates
int m_use_texture

1 if the mesh use texturing; default value is 0

int m_use_bump_map

1 if the mesh use bump mapping; default value is 0

std::string m_label

A label to determine the type of the mesh.

std::string m_filename

Name of the file that contains the polygon mesh.

RATIONAL_NUMBER m_file_scale

Unit of length of the file that contains the polygon mesh (if negative, then unknown)

std::auto_ptr<VBO> m_p_vbo

Vertex buffer object.

std::auto_ptr<PolygonMesh> m_p_face_normal_vbo
std::auto_ptr<PolygonMesh> m_p_vertex_normal_vbo
PhotonCrossSection m_photon_cross_section

Material properties, with respect to X-ray.

VEC3 m_local_min_corner

Lower corner of the bounding box.

VEC3 m_local_max_corner

Upper corner of the bounding box.

std::vector<RATIONAL_NUMBER> m_p_vertex_normal_set

Array containing the normal vectors (one per triangle)

Array containing the normal vectors (one per vertex)

void *m_p_vertex_set

Array containing the vertices.

void *m_p_index_set

Array containing the index.

unsigned int m_number_of_indices

Number of indices.

unsigned int m_number_of_vertices

Number of vertices.

int m_index_data_type

Data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

int m_vertex_data_type

Data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

int m_polygon_type

Polygon type; valid values are GL_TRIANGLES.

bool m_external_data_flag

A flag set to true if the memory is managed outside of this class instance; set to false if the memory is managed by this class instance

bool m_display_flag

A flag set to true if you want to display in the Xray image

Material m_material

Material of the object.

bool m_has_inverted_normal_vectors

A flag set to true if the normal vectors are inverted.

class Material
#include <Material.h>

Material is a class to handle materials.

Public Functions

inline Material()

Default constructor.

inline Material(const Material &aMaterial)

Copy constructor.

inline ~Material()

Destructor.

inline Material &operator=(const Material &aMaterial)

Copy operator.

inline void setAmbientColour(float aRedChannel, float aGreenChannel, float aBlueChannel, float aAlphaChannel)

Set the ambient colour.

Parameters
  • aRedChannel – red channel of the colour

  • aGreenChannel – green channel of the colour

  • aBlueChannel – blue channel of the colour

  • aAlphaChannel – alpha channel of the colour

inline void setDiffuseColour(float aRedChannel, float aGreenChannel, float aBlueChannel, float aAlphaChannel)

Set the diffuse colour.

Parameters
  • aRedChannel – red channel of the colour

  • aGreenChannel – green channel of the colour

  • aBlueChannel – blue channel of the colour

  • aAlphaChannel – alpha channel of the colour

inline void setSpecularColour(float aRedChannel, float aGreenChannel, float aBlueChannel, float aAlphaChannel)

Set the specular colour.

Parameters
  • aRedChannel – red channel of the colour

  • aGreenChannel – green channel of the colour

  • aBlueChannel – blue channel of the colour

  • aAlphaChannel – alpha channel of the colour

inline void setShininess(float aShininessValue)

Set the shininess of the material.

Parameters

aShininessValue – amount of shininess

inline const float *getAmbientColour() const

Accessor on the ambient colour.

Returns

the ambient colour

inline const float *getDiffuseColour() const

Accessor on the diffuse colour.

Returns

the diffuse colour

inline const float *getSpecularColour() const

Accessor on the specular colour.

Returns

the specular colour

inline float getShininess() const

Accessor on the shininess of the material.

Returns

the amount of shininess

Protected Attributes

float m_p_ambient_colour[4]

Ambient colour.

float m_p_diffuse_colour[4]

Diffuse colour.

float m_p_specular_colour[4]

Specular colour.

float m_shininess

Shininess.

class MaterialSet
#include <MaterialSet.h>

MaterialSet is a class to manage a table of materials.

Public Functions

inline ~MaterialSet()

Destructor.

inline void clearMemory()

Clear all the memory.

void loadFromFile(const std::string &aFileName)

Load a file containing materials.

void loadMaterialSetFromMemory()

Load the table of materials.

void addMaterial(const TissueMaterial &aMaterial)

Add a material to the list.

const TissueMaterial &getMaterial(short aHUValue) const

Get the material corresponding to a given HU value.

inline float getMuMinEnergy() const

Accessor on the lower energy cutoff for attenuation coefficient.

inline float getMuMaxEnergy() const

Accessor on the higher energy cutoff for attenuation coefficient.

inline short getMinHU() const

Accessor on the minimum Hounsfield unit that the material set can handle.

inline short getMaxHU() const

Accessor on the maximum Hounsfield unit that the material set can handle.

inline unsigned int getMaterialNumber() const

Accessor on the number of materials in the set.

Public Static Functions

static MaterialSet &getInstance()

Private Functions

inline MaterialSet()

Default Constructor (prevent instanciation).

MaterialSet(const MaterialSet&)

Copy constructor (prevent copy-construction).

MaterialSet(const std::string &aFileName)

Constructor (prevent instanciation).

MaterialSet &operator=(const MaterialSet&)

Copy operator (prevent assignment)

Private Members

std::map<std::pair<short, short>, TissueMaterial> m_material_set

An indexed table containing elements.

float m_mu_min_energy

The lower energy cutoff for attenuation coefficient.

float m_mu_max_energy

The higher energy cutoff for attenuation coefficient.

float m_min_S

The lower cutoff for Compton scattering cross section samples.

float m_max_S

The higher cutoff for Compton scattering cross section samples.

short m_min_HU

The minimum Hounsfield unit that the material set can handle.

short m_max_HU

The maximum Hounsfield unit that the material set can handle.

Friends

friend std::ostream &operator<<(std::ostream &anOutputSream, const MaterialSet &anMaterialSet)

operator <<

template<typename T>
class Matrix4x4
#include <Matrix4x4.h>

Matrix4x4 is a template class to handle a 4 by 4 matrix.

Public Functions

Matrix4x4(const T &a1 = 1.0f, const T &a2 = 0.0f, const T &a3 = 0.0f, const T &a4 = 0.0f, const T &a5 = 0.0f, const T &a6 = 1.0f, const T &a7 = 0.0f, const T &a8 = 0.0f, const T &a9 = 0.0f, const T &a10 = 0.0f, const T &a11 = 1.0f, const T &a12 = 0.0f, const T &a13 = 0.0f, const T &a14 = 0.0f, const T &a15 = 0.0f, const T &a16 = 1.0f)

Default Constructor (create an identity matrix).

Parameters
  • a1 – the 1st element of the matrix

  • a2 – the 2nd element of the matrix

  • a3 – the 3rd element of the matrix

  • a4 – the 4th element of the matrix

  • a5 – the 5th element of the matrix

  • a6 – the 6th element of the matrix

  • a7 – the 7th element of the matrix

  • a8 – the 8th element of the matrix

  • a9 – the 9th element of the matrix

  • a10 – the 10th element of the matrix

  • a11 – the 11th element of the matrix

  • a12 – the 12th element of the matrix

  • a13 – the 13th element of the matrix

  • a14 – the 14th element of the matrix

  • a15 – the 15th element of the matrix

  • a16 – the 16th element of the matrix

Matrix4x4(const Matrix4x4 &aMatrix)

Copy Constructor.

Parameters

aMatrix – the matrix to copy

Matrix4x4(const Matrix4x4 *apMatrix)

Copy Constructor.

Parameters

apMatrix – the matrix to copy

Matrix4x4(const T *apMatrix)

Copy Constructor.

Parameters

apMatrix – the matrix to copy

Matrix4x4(const std::vector<double> &apMatrix)

Copy Constructor.

Parameters

apMatrix – the matrix to copy

void loadIdentity()

Load identity matrix.

void setFromVector(const std::vector<double> &apMatrix)

Load the matrix.

Parameters

apMatrix – the matrix to copy

void rotate(const double anAngle, const Vec3<T> &aVector)

Multiply the current matrix by a rotation matrix.

Parameters
  • anAngle – the angle of rotation in degrees

  • aVector – the axis of rotation

void yawPitchRollRotate(double yaw, double pitch, double roll)

Multiply the current matrix by a yaw, pitch, roll rotation matrix.

Parameters
  • yaw – a counterclockwise rotation of yaw degrees about the z-axis

  • pitch – a counterclockwise rotation of yaw degrees about the y-axis

  • roll – a counterclockwise rotation of yaw degrees about the x-axis

void translate(const Vec3<T> &aVector)

Multiply the current matrix by a translation matrix.

Parameters

aVector – the translation vector

void translate(T x, T y, T z)

Multiply the current matrix by a translation matrix.

Parameters
  • x – the x-component of the translation vector

  • y – the y-component of the translation vector

  • z – the z-component of the translation vector

void scale(T x, T y, T z)

Multiply the current matrix by a scaling matrix.

Parameters
  • x – the scaling factor along the X-axis

  • y – the scaling factor along the Y-axis

  • z – the scaling factor along the Z-axis

Matrix4x4 getTranspose() const

Get the transpose of the current matrix.

Returns

the transpose matrix

T determinant() const

Compute the determinant of the current matrix.

Returns

the determinant

Matrix4x4 getInverse() const

Get the inverse of the current matrix.

Returns

the inverse matrix

Matrix4x4 &operator=(const Matrix4x4 &aMatrix)

Copy operator.

Parameters

aMatrix – the matrix to copy

Returns

the copied matrix

const T *get() const

Accessor on the 4x4 matrix data.

Returns

the matrix raw data

const T *get4x4() const

Accessor on the 4x4 matrix data.

Returns

the matrix raw data

const T *get3x3()

Accessor on the 3x3 matrix data.

Returns

the matrix raw data

std::vector<double> getAsVector() const

Accessor on the 4x4 matrix data.

Returns

the matrix raw data

Vec3<T> operator*(const Vec3<T> &aVector) const

Operator * to multiply the current matrix by a vector.

Parameters

aVector – the vector to transform

Returns

the transformed vector

Matrix4x4 operator*(const Matrix4x4 &aMatrix) const

Operator * to multiply the current matrix by another matrix.

Parameters

aMatrix – the other matrix

Returns

the transformed matrix

Matrix4x4 &operator*=(const Matrix4x4 &aMatrix)

Operator *= to multiply the current matrix by another matrix, and modify the current matrix.

Parameters

aMatrix – the other matrix

Returns

the transformed matrix

void print() const

Print the matrix in the console.

void print(std::ostream &anOutputStream) const

Print the matrix in the console.

Parameters

anOutputStream – the stream in which the matrix will be printed

Public Static Functions

static Matrix4x4 buildIdentityMatrix()

Build an identity matrix.

Returns

the identity matrix

static Matrix4x4 buildTranslationMatrix(const Vec3<T> &aVector)

Build a tranlation matrix.

Parameters

aVector – the translation vector

Returns

the corresponding translation matrix

static Matrix4x4 buildRotationMatrix(T anAngle, T x, T y, T z)

Build a rotation matrix.

Parameters
  • anAngle – the angle of rotation in degrees

  • x – the x-component of the axis of rotation

  • y – the y-component of the axis of rotation

  • z – the z-component of the axis of rotation

Returns

the corresponding rotation matrix

static Matrix4x4 buildYawPitchRollRotationMatrix(T yaw, T pitch, T roll)

Build a rotation matrix.

Parameters
  • yaw – a counterclockwise rotation of yaw degrees about the z-axis

  • pitch – a counterclockwise rotation of yaw degrees about the y-axis

  • roll – a counterclockwise rotation of yaw degrees about the x-axis

Returns

the corresponding rotation matrix

static Matrix4x4 buildScaleMatrix(const Vec3<T> &aVector)

Build a scale matrix.

Parameters

aVector – the scale vector

Returns

the corresponding scale matrix

static Matrix4x4 buildScaleMatrix(T x, T y, T z)

Build a scale matrix.

Parameters
  • x – the x-component of the axis of scale

  • y – the y-component of the axis of scale

  • z – the z-component of the axis of scale

Returns

the corresponding scale matrix

static Matrix4x4 buildRotationMatrix(T anAngle, const Vec3<T> &aVector)

Build a rotation matrix.

Parameters
  • anAngle – the angle of rotation in degrees

  • aVector – the axis of rotation

Returns

the corresponding translation matrix

static Matrix4x4 buildTranslationMatrix(T x, T y, T z)

Build a rotation matrix.

Parameters
  • x – the x-component of the translation vector

  • y – the y-component of the translation vector

  • z – the z-component of the translation vector

Returns

the corresponding translation matrix

Protected Attributes

T m_p_4x4_data[4 * 4]

the matrix data

T m_p_3x3_data[3 * 3]

the matrix data

bool m_small_matrix_up_to_date

A flag to check if the 3x3 matrix is up-to-date. It is used for lazy evaluation.

class Mixture
#include <Mixture.h>

Mixture is a class to manage a mixture (e.g. Ti90Al6V4).

Public Functions

inline Mixture()

Default Constructor.

inline Mixture(const std::map<int, double> &aWeightSet)
inline Mixture(const std::map<std::string, double> &aWeightSet)
inline Mixture(const std::map<int, double> &aWeightSet, double aMolarMass)
inline Mixture(const std::map<std::string, double> &aWeightSet, double aMolarMass)
inline Mixture(const Mixture &aMixture)

Copy constructor.

inline void clear()
inline void setMixture(const std::map<int, double> &aWeightSet)
inline void setMixture(const std::map<std::string, double> &aWeightSet)
inline void setMixture(const std::map<int, double> &aWeightSet, double aMolarMass)
inline void setMixture(const std::map<std::string, double> &aWeightSet, double aMolarMass)
void addElement(const std::string &aName, double aPercentage)
void normaliseWeightSet()

Normalise the weight set.

double computeMolarMass()

Update the value of the molar mass of the material.

inline double getMolarMass() const

Accessor on the molar mass of the material.

inline void setDensity(double aDensity)
inline double getDensity() const

Get the density of the material.

double getMassAttenuationTotal(double anEnergy) const

Get the mass attenuation coefficient at a given energy (values are interpolated).

inline double getLinearAttenuationTotal(double anEnergy) const

Get the linear attenuation coefficient at a given energy (in mm-1) (values are interpolated).

inline double getMu(double anEnergy) const

Get the linear attenuation coefficient at a given energy (in mm-1) (values are interpolated).

double getEffectiveAtomicNumber() const

Get the effective atomic number.

inline double getZ() const

Get the effective atomic number.

double getS(double x) const

Get the Compton scattering cross section sample (values are interpolated).

inline const std::string &getLabel() const
inline Mixture &operator=(const Mixture &aMixture)

Copy operator.

bool operator==(const Mixture &aMixture) const
inline bool operator!=(const Mixture &aMixture) const
inline const std::map<int, double> &getMassWeightSet() const
inline const std::map<int, double> &getElectronWeightSet() const

Private Functions

void setLabel()

Private Members

std::map<int, double> m_p_mass_weight_set
std::map<int, double> m_p_electron_weight_set
double m_molar_mass
double m_density
std::string m_label
class NoBeamException : public gVirtualXRay::Exception
#include <NoBeamException.h>

NoBeamException is a class to handle exceptions when no beam spectrum has been registered.

Public Functions

inline NoBeamException(const char *aFileName = 0, const char *aFunctionName = 0, int anErrorLine = 0)

Default constructor.

Parameters
  • aFileName – name of the source file where the exception was thrown (default value: 0)

  • aFunctionName – name of the function where the exception was thrown (default value: 0)

  • anErrorLine – name at which the exception was thrown (default value: 0)

inline virtual const char *what() const

Accessor on the error message.

Returns

the error message

Protected Attributes

std::string m_error_message

The error message.

class NoDetectorException : public gVirtualXRay::Exception

NoDetectorException is a class to handle exceptions when no detector has been registered.

Public Functions

inline NoDetectorException(const char *aFileName = 0, const char *aFunctionName = 0, int anErrorLine = 0)

Default constructor.

Parameters
  • aFileName – name of the source file where the exception was thrown (default value: 0)

  • aFunctionName – name of the function where the exception was thrown (default value: 0)

  • anErrorLine – name at which the exception was thrown (default value: 0)

inline virtual const char *what() const

Accessor on the error message.

Returns

the error message

Protected Attributes

std::string m_error_message

The error message.

class NotImplementedException : public gVirtualXRay::Exception

NotImplementedException is a class to handle exceptions when accessing a function that is not implemented.

Public Functions

inline NotImplementedException(const char *aFileName = 0, const char *aFunctionName = 0, int anErrorLine = 0)

Default constructor.

Parameters
  • aFileName – name of the source file where the exception was thrown (default value: 0)

  • aFunctionName – name of the function where the exception was thrown (default value: 0)

  • anErrorLine – name at which the exception was thrown (default value: 0)

inline virtual const char *what() const

Accessor on the error message.

Returns

the error message

Protected Attributes

std::string m_error_message

The error message.

class OpenGL2VBO : public gVirtualXRay::VBO
#include <OpenGL2VBO.h>

OpenGL2VBO is a class to handle a vertex buffer object (VBO) in OpenGL 2.x.

Public Functions

OpenGL2VBO()

Default constructor.

virtual ~OpenGL2VBO()

Destructor.

virtual void setVertexData(int aPrimitiveType, const unsigned int aNumberOfVertices = 0, unsigned int aNumberOfCompontentsPerVertex = 0, int aVertexDataType = 0, const void *apVertices = 0, const unsigned int aNumberOfNormals = 0, unsigned int aNumberOfCompontentsPerNormal = 0, int aNormalDataType = 0, const void *apNormals = 0, const unsigned int aNumberOfTextureCoordinates = 0, unsigned int aNumberOfCompontentsPerCoord = 0, int aCoordDataType = 0, const void *apTextureCoordinates = 0, const unsigned int aNumberOfAdditionalData = 0, unsigned int aNumberOfCompontentsPerAdditionalData = 0, int anAdditionalDataType = 0, const void *apAdditionalData = 0)

Set the vertex data.

Parameters
  • aPrimitiveType – the primitive type; valid values are: GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP, GL_LINES, GL_LINE_STRIP_ADJACENCY, GL_LINES_ADJACENCY, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES, GL_TRIANGLE_STRIP_ADJACENCY, GL_TRIANGLES_ADJACENCY and GL_PATCHES

  • aNumberOfVertices – number of vertices (default: 0)

  • aNumberOfCompontentsPerVertex – the number of component per vertex (default: 0)

  • aVertexDataType – the data type of vertices; valid values are GL_FLOAT and GL_DOUBLE (default: 0)

  • apVertices – address of the first component of the first vertex (default: 0)

  • aNumberOfNormals – number of normal vectors (default: 0)

  • aNumberOfCompontentsPerNormal – the number of component per normal vector (default: 0)

  • aNormalDataType – the data type of normal vectors; valid values are GL_FLOAT and GL_DOUBLE (default: 0)

  • apNormals – address of the first component of the firth normal vector (default: 0)

  • aNumberOfTextureCoordinates – number of texture coordinates (default: 0)

  • aNumberOfCompontentsPerCoord – the number of component per texture coordinate (default: 0)

  • aCoordDataType – the data type of texture coordinates; valid values are GL_FLOAT and GL_DOUBLE (default: 0)

  • apTextureCoordinates – address of the first component of the first texture coordinate (default: 0)

  • aNumberOfAdditionalData – number of additional data (default: 0)

  • aNumberOfCompontentsPerAdditionalData – the number of component per additional data (default: 0)

  • anAdditionalDataType – the data type of additional data; valid values are GL_FLOAT and GL_DOUBLE (default: 0)

  • apAdditionalData – address of the first component of the first additional data (default: 0)

virtual void setIndexData(const unsigned int aNumberOfIndexes, int anIndexDataType, const void *apIndexSet)

Set the index.

Parameters
  • aNumberOfIndexes – number of indices

  • anIndexDataType – the data type of indices; valid values are GL_UNSGINED_BYTE, GL_UNSGINED_SHORT and GL_UNSGINED_INT

  • apIndexSet – the index set

virtual void display() const

Display the triangular mesh using OpenGL.

virtual void destroy()

Release the data on the GPU.

void reset()

Reset the data.

inline bool isReady() const

Check if the vertex buffer object is ready.

Returns

true if the VBO is ready to use, false if it is not

inline void setBufferUsageHint(int aFlag)

Set the buffer usage hint. Accepted values are: GL_STATIC_DRAW is for vertex buffers that are rendered many times, and whose contents are specified once and never change. GL_DYNAMIC_DRAW is for vertex buffers that are rendered many times, and whose contents change during the rendering loop. GL_STREAM_DRAW is for vertex buffers that are rendered a small number of times and then discarded.

Parameters

aFlag – the buffer usage hint to set

inline int getBufferUsageHint() const

Accessor on the buffer usage hint.

Returns

the buffer usage hint

inline int getPrimitiveType() const

Accessor on the primitive type.

Returns

the primitive type

inline unsigned int getOpenglMajorVersion() const

Accessor on the major version of OpenGL that was used to create the VBO.

Returns

the major version of OpenGL

Protected Attributes

unsigned int m_id_set[5]

ID of VBOs.

unsigned int m_number_of_normals

Number of normal vectors.

unsigned int m_number_of_compontents_per_normal

Number of components per normal.

unsigned int m_number_of_additional_data

Number of additional data.

unsigned int m_number_of_compontents_per_additional_data

Number of components per additional data.

unsigned int m_number_of_texture_coordinates

Number of texture coordinates.

unsigned int m_number_of_compontents_per_texture_coord

Number of components per texture coordinate.

unsigned int m_number_of_vertices

Number of vertices.

unsigned int m_number_of_compontents_per_vertex

Number of components per vertex.

unsigned int m_number_of_indices

Number of indices.

unsigned int m_normal_size

Size in bytes of the array of normal vectors.

unsigned int m_additional_data_size

Size in bytes of the array of additional data.

unsigned int m_texture_coordinate_size

Size in bytes of the array of texture coordinates.

unsigned int m_vertex_size

Size in bytes of the array of vertices.

unsigned int m_index_size

Size in bytes of the array of indices.

int m_normal_data_type

Data type of normal vectors; valid values are GL_FLOAT and GL_DOUBLE.

int m_additional_data_type

Data type of additional data; valid values are GL_FLOAT and GL_DOUBLE.

int m_texture_coordinate_data_type

Data type of texture coordinates; valid values are GL_FLOAT and GL_DOUBLE

int m_vertex_data_type

Data type of vertices; valid values are GL_FLOAT and GL_DOUBLE.

int m_index_data_type

Data type of indices; valid values are GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT and GL_UNSIGNED_INT

int m_primitive_type

Type of primitive to draw; valid values are GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP, GL_LINES, GL_LINE_STRIP_ADJACENCY, GL_LINES_ADJACENCY, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES, GL_TRIANGLE_STRIP_ADJACENCY, GL_TRIANGLES_ADJACENCY and GL_PATCHES

int m_storage_type

The buffer usage hint; valid values are GL_DYNAMIC_DRAW, GL_STATIC_DRAW and GL_STREAM_DRAW

unsigned int m_opengl_major_version

The major number of the OpenGL version used to create the VBO. 2 or 3 are supported. We do not distinguish at this level between 3 and 4.

class OpenGL3VBO : public gVirtualXRay::VBO
#include <OpenGL3VBO.h>

OpenGL3VBO is a class to handle a vertex buffer object (VBO) in OpenGL 3.x or 4.x.

Public Functions

OpenGL3VBO()

Default constructor.

virtual ~OpenGL3VBO()

Destructor.

virtual void destroy()

Release the data on the GPU.

virtual void setVertexData(int aPrimitiveType, const unsigned int aNumberOfVertices = 0, unsigned int aNumberOfCompontentsPerVertex = 0, int aVertexDataType = 0, const void *apVertices = 0, const unsigned int aNumberOfNormals = 0, unsigned int aNumberOfCompontentsPerNormal = 0, int aNormalDataType = 0, const void *apNormals = 0, const unsigned int aNumberOfTextureCoordinates = 0, unsigned int aNumberOfCompontentsPerCoord = 0, int aCoordDataType = 0, const void *apTextureCoordinates = 0, const unsigned int aNumberOfAdditionalData = 0, unsigned int aNumberOfCompontentsPerAdditionalData = 0, int anAdditionalDataType = 0, const void *apAdditionalData = 0)

Set the vertex data.

Parameters
  • aPrimitiveType – the primitive type; valid values are: GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP, GL_LINES, GL_LINE_STRIP_ADJACENCY, GL_LINES_ADJACENCY, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES, GL_TRIANGLE_STRIP_ADJACENCY, GL_TRIANGLES_ADJACENCY and GL_PATCHES

  • aNumberOfVertices – number of vertices (default: 0)

  • aNumberOfCompontentsPerVertex – the number of component per vertex (default: 0)

  • aVertexDataType – the data type of vertices; valid values are GL_FLOAT and GL_DOUBLE (default: 0)

  • apVertices – address of the first component of the first vertex (default: 0)

  • aNumberOfNormals – number of normal vectors (default: 0)

  • aNumberOfCompontentsPerNormal – the number of component per normal vector (default: 0)

  • aNormalDataType – the data type of normal vectors; valid values are GL_FLOAT and GL_DOUBLE (default: 0)

  • apNormals – address of the first component of the firth normal vector (default: 0)

  • aNumberOfTextureCoordinates – number of texture coordinates (default: 0)

  • aNumberOfCompontentsPerCoord – the number of component per texture coordinate (default: 0)

  • aCoordDataType – the data type of texture coordinates; valid values are GL_FLOAT and GL_DOUBLE (default: 0)

  • apTextureCoordinates – address of the first component of the first texture coordinate (default: 0)

  • aNumberOfAdditionalData – number of additional data (default: 0)

  • aNumberOfCompontentsPerAdditionalData – the number of component per additional data (default: 0)

  • anAdditionalDataType – the data type of additional data; valid values are GL_FLOAT and GL_DOUBLE (default: 0)

  • apAdditionalData – address of the first component of the first additional data (default: 0)

virtual void setVertexVBO(unsigned int aNumberOfVertices, unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO)

Set the vertex buffer objects.

Parameters
  • aNumberOfVertices – number of vertices

  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

virtual void setIndexVBO(unsigned int aNumberOfIndexes, int anIndexDataType, unsigned int anIndexVBO)

Set the index.

Parameters
  • aNumberOfIndexes – number of indices

  • anIndexDataType – the data type of indices; valid values are GL_UNSGINED_BYTE, GL_UNSGINED_SHORT and GL_UNSGINED_INT

  • anIndexVBO – array containing the index data

virtual void setIndexData(const unsigned int aNumberOfIndexes, int anIndexDataType, const void *apIndexSet)

Set the index.

Parameters
  • aNumberOfIndexes – number of indices

  • anIndexDataType – the data type of indices; valid values are GL_UNSGINED_BYTE, GL_UNSGINED_SHORT and GL_UNSGINED_INT

  • apIndexSet – the index set

virtual void display() const

Display the triangular mesh using OpenGL.

inline VBO &operator=(const OpenGL3VBO &aVbo)

Copy operator.

Parameters

aVboVBO to copy

Returns

the new VBO

void reset()

Reset the data.

inline bool isReady() const

Check if the vertex buffer object is ready.

Returns

true if the VBO is ready to use, false if it is not

inline void setBufferUsageHint(int aFlag)

Set the buffer usage hint. Accepted values are: GL_STATIC_DRAW is for vertex buffers that are rendered many times, and whose contents are specified once and never change. GL_DYNAMIC_DRAW is for vertex buffers that are rendered many times, and whose contents change during the rendering loop. GL_STREAM_DRAW is for vertex buffers that are rendered a small number of times and then discarded.

Parameters

aFlag – the buffer usage hint to set

inline int getBufferUsageHint() const

Accessor on the buffer usage hint.

Returns

the buffer usage hint

inline int getPrimitiveType() const

Accessor on the primitive type.

Returns

the primitive type

inline unsigned int getOpenglMajorVersion() const

Accessor on the major version of OpenGL that was used to create the VBO.

Returns

the major version of OpenGL

Protected Attributes

unsigned int m_vao_id

ID of VAO.

unsigned int m_id_set[5]

ID of VBOs.

unsigned int m_number_of_normals

Number of normal vectors.

unsigned int m_number_of_compontents_per_normal

Number of components per normal.

unsigned int m_number_of_additional_data

Number of additional data.

unsigned int m_number_of_compontents_per_additional_data

Number of components per additional data.

unsigned int m_number_of_texture_coordinates

Number of texture coordinates.

unsigned int m_number_of_compontents_per_texture_coord

Number of components per texture coordinate.

unsigned int m_number_of_vertices

Number of vertices.

unsigned int m_number_of_compontents_per_vertex

Number of components per vertex.

unsigned int m_number_of_indices

Number of indices.

unsigned int m_normal_size

Size in bytes of the array of normal vectors.

unsigned int m_additional_data_size

Size in bytes of the array of additional data.

unsigned int m_texture_coordinate_size

Size in bytes of the array of texture coordinates.

unsigned int m_vertex_size

Size in bytes of the array of vertices.

unsigned int m_index_size

Size in bytes of the array of indices.

int m_normal_data_type

Data type of normal vectors; valid values are GL_FLOAT and GL_DOUBLE.

int m_additional_data_type

Data type of additional data; valid values are GL_FLOAT and GL_DOUBLE.

int m_texture_coordinate_data_type

Data type of texture coordinates; valid values are GL_FLOAT and GL_DOUBLE

int m_vertex_data_type

Data type of vertices; valid values are GL_FLOAT and GL_DOUBLE.

int m_index_data_type

Data type of indices; valid values are GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT and GL_UNSIGNED_INT

int m_primitive_type

Type of primitive to draw; valid values are GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP, GL_LINES, GL_LINE_STRIP_ADJACENCY, GL_LINES_ADJACENCY, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES, GL_TRIANGLE_STRIP_ADJACENCY, GL_TRIANGLES_ADJACENCY and GL_PATCHES

int m_storage_type

The buffer usage hint; valid values are GL_DYNAMIC_DRAW, GL_STATIC_DRAW and GL_STREAM_DRAW

unsigned int m_opengl_major_version

The major number of the OpenGL version used to create the VBO. 2 or 3 are supported. We do not distinguish at this level between 3 and 4.

class OpenGLException : public gVirtualXRay::Exception
#include <OpenGLException.h>

OpenGLException is a class to handle exceptions related to OpenGL.

Public Functions

OpenGLException(const char *aFileName, const char *aFunctionName, int anErrorLine, int anErrorCode)

Default constructor.

Parameters
  • aFileName – name of the source file where the exception was thrown (default value: 0)

  • aFunctionName – name of the function where the exception was thrown (default value: 0)

  • anErrorLine – name at which the exception was thrown (default value: 0)

  • anErrorCode – OpenGL error code

inline virtual const char *what() const

Accessor on the error message.

Returns

the error message

Protected Attributes

std::string m_error_message

The error message.

class OpenSceneGraphBinder : public gVirtualXRay::SceneGraphBinder

Public Functions

OpenSceneGraphBinder()
OpenSceneGraphBinder(const OpenSceneGraphBinder &aSceneGraph)
OpenSceneGraphBinder(const std::string &aFileName, RATIONAL_NUMBER aUnitOfLength)
OpenSceneGraphBinder(const char *aFileName, RATIONAL_NUMBER aUnitOfLength)
virtual ~OpenSceneGraphBinder()
OpenSceneGraphBinder &operator=(const OpenSceneGraphBinder &aSceneGraph)
virtual void loadSceneGraph(const char *aFileName, RATIONAL_NUMBER aUnitOfLength)
virtual void updateMatrices()
virtual void scale(const char *aNodeLabel, const gVirtualXRay::VEC3 &aScalingFactorSet)
virtual void rotate(const char *aNodeLabel, float aRotationAngleInDegrees, const gVirtualXRay::VEC3 &aRotationAxis)
virtual void translate(const char *aNodeLabel, const VEC3 &aTranslationVector)
virtual gVirtualXRay::MATRIX4 getTransformationMatrix(const char *aNodeLabel) const
virtual void moveToCentre()
virtual void moveToCenter()
virtual MATRIX4 getRootNodeTransformationMatrix() const
virtual MATRIX4 getNodeTransformationMatrix(const char *aNodeLabel) const
virtual void setRootNodeTransformationMatrix(const MATRIX4 &aTransformationMatrix)
virtual void setNodeTransformationMatrix(const char *aNodeLabel, const MATRIX4 &aTransformationMatrix)
virtual void loadSceneGraph(const std::string &aFileName, RATIONAL_NUMBER aUnitOfLength)
void clear()
void display(GLint aShaderID)
void scale(const std::string &aNodeLabel, const VEC3 &aScalingFactorSet)
void rotate(const std::string &aNodeLabel, float aRotationAngleInDegrees, const VEC3 &aRotationAxis)
void translate(const std::string &aNodeLabel, const VEC3 &aTranslationVector)
MATRIX4 getLocalTransformationMatrix(const std::string &aNodeLabel) const
MATRIX4 getLocalTransformationMatrix(const char *aNodeLabel) const
MATRIX4 getWorldTransformationMatrix(const std::string &aNodeLabel) const
MATRIX4 getWorldTransformationMatrix(const char *aNodeLabel) const
void moveToCentre(const std::string &aNodeLabel)
void moveToCentre(const char *aNodeLabel)
void moveToCenter(const std::string &aNodeLabel)
void moveToCenter(const char *aNodeLabel)
virtual MATRIX4 getNodeLocalTransformationMatrix(const char *aNodeLabel) const
virtual MATRIX4 getNodeWorldTransformationMatrix(const char *aNodeLabel) const
virtual void setNodeLocalTransformationMatrix(const char *aNodeLabel, const MATRIX4 &aTransformationMatrix)
std::pair<VEC3, VEC3> getBoundingBox()
void addPolygonMesh(const std::string &aLabel, const PolygonMesh &aPolygonMesh, const VEC3 &aPosition, const std::string &aParent = "root")
SceneGraphNode *getNode(const std::string &aLabel)
const SceneGraphNode *getNode(const std::string &aLabel) const

Protected Attributes

SceneGraphNode m_root_node
RATIONAL_NUMBER m_unit_of_length
class OutOfBoundsException : public gVirtualXRay::Exception

Public Functions

inline OutOfBoundsException(const char *aFileName = 0, const char *aFunctionName = 0, int anErrorLine = 0)

Default constructor.

Parameters
  • aFileName – name of the source file where the exception was thrown (default value: 0)

  • aFunctionName – name of the function where the exception was thrown (default value: 0)

  • anErrorLine – name at which the exception was thrown (default value: 0)

inline virtual const char *what() const

Accessor on the error message.

Returns

the error message

Protected Attributes

std::string m_error_message

The error message.

class OutOfMemoryException : public gVirtualXRay::Exception

OutOfMemoryException is a class to handle exceptions when accessing an array cell that is not accessible, i.e. out of bounds memory access.

OutOfMemoryException is a class to handle exceptions when memory cannot be allocated dynamically.

Public Functions

inline OutOfMemoryException(const char *aFileName = 0, const char *aFunctionName = 0, int anErrorLine = 0)

Default constructor.

Parameters
  • aFileName – name of the source file where the exception was thrown (default value: 0)

  • aFunctionName – name of the function where the exception was thrown (default value: 0)

  • anErrorLine – name at which the exception was thrown (default value: 0)

inline virtual const char *what() const

Accessor on the error message.

Returns

the error message

Protected Attributes

std::string m_error_message

The error message.

class PhotonCrossSection

PhotonCrossSection is a class to manage photon cross sections of elements, compounds and mixtures.

Public Functions

inline PhotonCrossSection()
inline explicit PhotonCrossSection(unsigned short Z)
inline PhotonCrossSection(const Mixture &aMixture)
inline PhotonCrossSection(const std::map<int, double> &aWeightSet)
inline PhotonCrossSection(const std::map<std::string, double> &aWeightSet)
inline void reset()
inline void useHU(short HU)
inline void useHounsfieldUnit(short HU)
inline void useHounsfieldValue(short HU)
void useElement(unsigned short Z)
void useElement(const std::string &aName)
inline void useMixture(const Mixture &aMixture)
inline void useMixture(const std::map<int, double> &aMixture)
inline void useMixture(const std::map<std::string, double> &aMixture)
void useMixture(const std::string &aName)
void useCompound(const std::string &aName)
inline void useMassAttenuationCoefficient(double aCoefficient)
inline void useLinearAttenuationCoefficient(double aCoefficient)
inline void setDensity(double aDensity)
inline double getEffectiveZNumber() const
inline double getEffectiveAtomicNumber() const
inline double getEffectiveMolarMass() const
double getMassAttenuationCoefficient(double anEnergy) const
double getLinearAttenuationCoefficient(double anEnergy) const
inline double getMu(double anEnergy) const
double getDensity() const
double getMolarMass() const
inline const std::string &getLabel() const
bool operator==(const PhotonCrossSection &aTestData) const
inline bool operator!=(const PhotonCrossSection &aTestData) const
inline bool useHU() const
inline bool useHounsfieldUnit() const
inline bool useHounsfieldValue() const
inline bool useElement() const
inline bool useMixture() const
inline bool useMassAttenuationCoefficient() const
inline bool useLinearAttenuationCoefficient() const
inline std::string getCompound() const

Accessor on the compound description of the polygon mesh.

Returns

if the sample is made of a compound, then return the description of the compound (e.g. H2O for water), otherwise return an empty string

inline std::vector<int> getMixtureElementSet() const

Accessor on the element Z number set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element Z number set of the mixture, otherwise return an empty vector

inline std::vector<double> getMixtureWeightSet() const

Accessor on the element weight set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element weight set of the mixture, otherwise return an empty vector

Public Static Functions

static std::map<int, double> getMixtureWeightSet(const std::string &aName)
static std::map<int, double> getCompoundWeightSet(const std::string &aName)
static double getCompoundMolarMass(const std::string &aName)

Private Members

bool m_use_HU
bool m_use_element
bool m_use_mixture
bool m_use_mass_attenuation_coefficient
bool m_use_linear_attenuation_coefficient
short m_HU
unsigned short m_Z_number
double m_mass_attenuation_coefficient
double m_linear_attenuation_coefficient
Mixture m_mixture
double m_density
std::string m_label

Private Static Functions

static void processElement(std::string &aSymbol, std::string &aWeight, std::map<int, double> &aWeightSet)

Friends

friend std::ostream &operator<<(std::ostream &anOuputStream, const PhotonCrossSection &anInstance)
class PolygonMesh
#include <PolygonMesh.h>

PolygonMesh is a class to handle polygon (triangles) meshes.

Subclassed by gVirtualXRay::CubeMesh< float >, gVirtualXRay::AnatomicalMesh, gVirtualXRay::CubeMesh< T >, gVirtualXRay::CuboidMesh< T >, gVirtualXRay::CylinderMesh< T >, gVirtualXRay::LineMesh< T >, gVirtualXRay::SphereMesh, gVirtualXRay::StepWedgeMesh< T >, gVirtualXRay::LineMesh< float >

Public Functions

PolygonMesh()

Default constructor.

PolygonMesh(const PolygonMesh &aPolygonMesh)

Copy constructor.

Parameters

aPolygonMesh – the polygon mesh to copy

inline ~PolygonMesh()

Destructor.

void reset()

Reset the data.

inline void resetVBOs()

Reset the VBOs only.

inline void setDisplayFlag(bool display)

Set if the mesh is displayed or not.

Parameters

display – true or false

inline bool getDisplayFlag() const

Accessor on the display flag of the polygon mesh.

Returns

display flag

void display()

Display the triangular mesh using OpenGL.

void displayWireFrame()

Display the triangular mesh in wireframe using OpenGL.

void displayFaceNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the face normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

void displayVertexNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the vertex normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

inline void setFilename(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFilename(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline const std::string &getFilename() const

Accessor on the name of the file that contains the polygon mesh.

Returns

the file name

inline const RATIONAL_NUMBER &getUnitOfLength() const

Accessor on the unit of length of the mesh.

Returns

the unit of length

void loadSTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void writeSTLFile(bool aBinaryFlag)

Write the STL file.

Parameters

aBinaryFlag – if true, save a binary file; if false save an ASCII file

inline void moveToCentre()

Move the polygon to the centre.

inline void moveToCenter()

Move the polygon to the center.

void computeNormalVectors()

Compute the normal vectors using the cross product method.

inline bool useVBO(int aBufferUsageHing, int aTypeOfPrimitive)

Use a vertex buffer object if possible.

Parameters
  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

Returns

true if the VBO can be used, false otherwise

inline void setHU(short HU)
inline void setHounsfieldUnit(short HU)
inline void setHounsfieldValue(short HU)
inline void setElement(unsigned short Z)
inline void setElement(const std::string &aName)
inline void setMixture(const Mixture &aMixture)
inline void setMixture(const std::map<int, double> &aMixture)
inline void setMixture(const std::map<std::string, double> &aMixture)
inline void setMixture(const std::string &aName)
inline void setCompound(const std::string &aName)
inline void setMassAttenuationCoefficient(double aCoefficient)
inline void setLinearAttenuationCoefficient(double aCoefficient)
inline void setDensity(double aDensity)
inline double getDensity()
inline const std::string &getMaterialLabel() const
inline std::string getCompound() const

Accessor on the compound description of the polygon mesh.

Returns

if the sample is made of a compound, then return the description of the compound (e.g. H2O for water), otherwise return an empty string

inline std::vector<int> getMixtureElementSet() const

Accessor on the element Z number set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element Z number set of the mixture, otherwise return an empty vector

inline std::vector<double> getMixtureWeightSet() const

Accessor on the element weight set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element weight set of the mixture, otherwise return an empty vector

inline const PhotonCrossSection &getPhotonCrossSection() const
inline void setPhotonCrossSection(const PhotonCrossSection &aPhotonCrossSection)
inline const VEC3 &getLocalMinCorner() const

Accessor on the bounding box lower corner.

Returns

the bounding box lower corner

inline const VEC3 &getLocalMaxCorner() const

Accessor on the bounding box upper corner.

Returns

the bounding box upper corner

inline void applyTranslation(const VEC3 &aTranslationVector)

Translate the polygon mesh given a translation vector, and update the VBO if needed.

Parameters

aTranslationVector – the translation vector

inline void applyScaling(RATIONAL_NUMBER x, RATIONAL_NUMBER y, RATIONAL_NUMBER z)

Scale the polygon mesh given scaling factors, and update the VBO if needed.

Parameters
  • x – the scaling factor along the X-axis

  • y – the scaling factor along the Y-axis

  • z – the scaling factor along the Z-axis

inline void applyRotation(const VEC3 &aRotationAxis, RATIONAL_NUMBER aRotationAngleInDegrees)

Rotate the polygon mesh given a rotation axis and angle, and update the VBO if needed.

Parameters
  • aRotationAxis – the rotation axis

  • aRotationAngleInDegrees – the rotation angle in degrees

inline void applyTransform(const MATRIX4 &aTransformationMatrix)

Transform the polygon mesh given a transformation matrix and update the VBO if needed.

Parameters

aTransformationMatrix – the transformation matrix

unsigned int getFaceNumber() const

Accessor on the number of faces.

Returns

the number of faces

unsigned int getTriangleNumber() const

Accessor on the number of triangles.

Returns

the number of triangles

inline unsigned int getFaceNormalNumber() const

Accessor on the number of face normal vectors.

Returns

the number of face normal vectors

inline unsigned int getVertexNormalNumber() const

Accessor on the number of vertex normal vectors.

Returns

the number of vertex normal vectors

inline unsigned int getVertexNumber() const

Accessor on the number of vertices.

Returns

the number of vertices

inline unsigned int getIndexNumber() const

Accessor on the number of indices.

Returns

the number of indices

void mergeVertices(bool aPrintDebugInfoFlag = false)

Merge the vertices of the mesh if the data is managed by the class instance, and if no index has been build.

void splitFaces(bool aPrintDebugInfoFlag = false)

Split each face into four faces.

VEC3 getVertex(unsigned int anIndex) const

Accessor on a given vertex.

Parameters

anIndex – the index of the vertex to access

Returns

the vertex

void setVertex(unsigned int anIndex, const VEC3 &aVertex)

Change the value of a given vertex.

Parameters
  • anIndex – the index of the vertex to access

  • aVertex – the new value of the vertex

inline void setFaceNormal(unsigned int anIndex, const VEC3 &aNormalVector)
inline void setVertexNormal(unsigned int anIndex, const VEC3 &aNormalVector)
int getIndex(unsigned int anIndex) const

Accessor on a given index.

Parameters

anIndex – the index of the index to access

Returns

the index

void setIndex(unsigned int anIndex, unsigned int aValue)

Set the value of a given index.

Parameters
  • anIndex – the index of the index to access

  • aValue – the new value of the index

inline VEC3 getFaceNormal(unsigned int anIndex) const

Accessor on a given face normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

inline VEC3 getVertexNormal(unsigned int anIndex) const

Accessor on a given vertex normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

void setExternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setVBOData(const void *aVertexArray, unsigned int aNumberOfVertices, unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO, unsigned int aNumberOfIndices, int anIndexDataType, const void *aIndexArray = NULL, const void *aNormalArray = NULL)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aIndexArray – array containing the index data

  • aNormalArray – array containing the normal data

void setInternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)
void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

inline void applyScale(const RATIONAL_NUMBER &aScale)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters

aScale – scaling factor

void applyScale(const RATIONAL_NUMBER &aScaleX, const RATIONAL_NUMBER &aScaleY, const RATIONAL_NUMBER &aScaleZ)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters
  • aScaleX – scaling factor alng the x-axis

  • aScaleY – scaling factor alng the y-axis

  • aScaleZ – scaling factor alng the z-axis

inline void invertNormalVectors()

Inverse the normal vectors.

virtual void updateVBO(int aTypeOfVBO, int aTypeOfPrimitive)

Update the VBO.

Parameters
  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

virtual void updateVBOs(unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO)

Update the VBOs with VBO already created.

Parameters
  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

inline const Material &getMaterial() const

Accessor on the material of the polygon mesh.

Returns

the material

inline Material &getMaterial()

Accessor on the material of the polygon mesh.

Returns

the material

void copyFrom(const PolygonMesh &aPolygonMesh)

Copy.

Parameters

aPolygonMesh – the polygon mesh to copy

PolygonMesh &operator=(const PolygonMesh &aPolygonMesh)

Copy operator.

Parameters

aPolygonMesh – the polygon mesh to copy

Returns

the new PolygonMesh

virtual PolygonMesh operator+(const PolygonMesh &aPolygonMesh) const

operator+.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const PolygonMesh &aPolygonMesh) const

operator-.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const PolygonMesh &aPolygonMesh)

operator+=.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const PolygonMesh &aPolygonMesh)

operator-=.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh operator+(const VEC3 &aTranslationVector) const

operator+.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const VEC3 &aTranslationVector) const

operator-.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const VEC3 &aTranslationVector)

operator+=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const VEC3 &aTranslationVector)

operator-=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

std::map<RATIONAL_NUMBER, VEC3> rayIntersect(const VEC3 &aRayOrigin, const VEC3 &aRayDirection, const MATRIX4 &aTransformationMatrix) const
void getTriangleVertices(VEC3 &v0, VEC3 &v1, VEC3 &v2, unsigned int anIndex) const
inline bool hasNormalVectorsInverted() const

Check if the normal vectors have been inverted.

Returns

true if the normal vectors have been inverted; false otherwise.

Protected Functions

inline void computeBoundingBox()

Update the bounding box.

void normaliseNormals()

Normalise the normal vectors.

void destroyVertexData()

Release the memory held by the vertex data if needed.

void destroyIndexData()

Release the memory held by the index data if needed.

void removeIndex(bool aPrintDebugInfoFlag = false)

Remove the index.

void copyVertexSet(const void *apVertexSet)

Copy a vertex set.

void copyIndexSet(const void *apIndexSet)

Copy an index set.

void loadASCIISTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadBinarySTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadSTLDataFromBinaryStream(const char *apInputData, bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • apInputData – the input data to load

  • aMoveToCentreFlag – a flag to move the polygon to the centre or not

  • anAutoComputeNormalFlag – a flag to compute normals or nor

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

Protected Attributes

std::string m_filename

Name of the file that contains the polygon mesh.

RATIONAL_NUMBER m_file_scale

Unit of length of the file that contains the polygon mesh (if negative, then unknown)

std::auto_ptr<VBO> m_p_vbo

Vertex buffer object.

std::auto_ptr<PolygonMesh> m_p_face_normal_vbo
std::auto_ptr<PolygonMesh> m_p_vertex_normal_vbo
PhotonCrossSection m_photon_cross_section

Material properties, with respect to X-ray.

VEC3 m_local_min_corner

Lower corner of the bounding box.

VEC3 m_local_max_corner

Upper corner of the bounding box.

std::vector<RATIONAL_NUMBER> m_p_vertex_normal_set

Array containing the normal vectors (one per triangle)

Array containing the normal vectors (one per vertex)

void *m_p_vertex_set

Array containing the vertices.

void *m_p_index_set

Array containing the index.

unsigned int m_number_of_indices

Number of indices.

unsigned int m_number_of_vertices

Number of vertices.

int m_index_data_type

Data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

int m_vertex_data_type

Data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

int m_polygon_type

Polygon type; valid values are GL_TRIANGLES.

bool m_external_data_flag

A flag set to true if the memory is managed outside of this class instance; set to false if the memory is managed by this class instance

bool m_display_flag

A flag set to true if you want to display in the Xray image

Material m_material

Material of the object.

bool m_has_inverted_normal_vectors

A flag set to true if the normal vectors are inverted.

class PythonSingleton
#include <PythonSingleton.h>

Public Functions

inline bool hasSpekpy()
inline bool hasXpecgen()
inline ~PythonSingleton()

Public Static Functions

static inline PythonSingleton &getInstance()

Private Functions

inline PythonSingleton()
void initPython()
inline void releasePython()
PythonSingleton(const PythonSingleton&) = delete
PythonSingleton &operator=(const PythonSingleton&) = delete

Private Members

bool m_initialised
bool m_has_spekpy
bool m_has_xpecgen
std::string m_python_interpretor

Private Static Attributes

static std::unique_ptr<PythonSingleton> m_p_instance
class ResourceManager
#include <ResourceManager.h>

Public Functions

ResourceManager(ResourceManager const&) = delete
void operator=(ResourceManager const&) = delete
void releaseResources()
void addShader(Shader *apShader)
void addFBO(FramebufferObject *apFBO)
void addVBO(OpenGL2VBO *apVBO)
void addVBO(OpenGL3VBO *apVBO)
void destroyAndRemoveShader(Shader *apShader)
void destroyAndRemoveFBO(FramebufferObject *apFBO)
void destroyAndRemoveVBO(OpenGL2VBO *apVBO)
void destroyAndRemoveVBO(OpenGL3VBO *apVBO)
void setGraphicsContext(Context *apContext)
Context *getGraphicsContext()
void destroyAndRemoveContext()

Public Static Functions

static inline ResourceManager &getInstance()

Private Functions

ResourceManager()

Private Members

std::vector<Shader*> m_p_shader_set
std::vector<FramebufferObject*> m_p_FBO_set
std::vector<OpenGL2VBO*> m_p_gl2_vbo
std::vector<OpenGL3VBO*> m_p_gl3_vbo
Context *m_p_context
class SceneGraphBinder
#include <SceneGraphBinder.h>

Subclassed by gVirtualXRay::AssimpSceneGraphBinder, gVirtualXRay::OpenSceneGraphBinder

Public Functions

SceneGraphBinder()
SceneGraphBinder(const SceneGraphBinder &aSceneGraph)
SceneGraphBinder(const std::string &aFileName, RATIONAL_NUMBER aUnitOfLength)
SceneGraphBinder(const char *aFileName, RATIONAL_NUMBER aUnitOfLength)
virtual ~SceneGraphBinder()
SceneGraphBinder &operator=(const SceneGraphBinder &aSceneGraph)
virtual void loadSceneGraph(const char *aFileName, RATIONAL_NUMBER aUnitOfLength)
virtual void loadSceneGraph(const std::string &aFileName, RATIONAL_NUMBER aUnitOfLength)
void clear()
void display(GLint aShaderID)
void scale(const std::string &aNodeLabel, const VEC3 &aScalingFactorSet)
virtual void scale(const char *aNodeLabel, const VEC3 &aScalingFactorSet)
void rotate(const std::string &aNodeLabel, float aRotationAngleInDegrees, const VEC3 &aRotationAxis)
virtual void rotate(const char *aNodeLabel, float aRotationAngleInDegrees, const VEC3 &aRotationAxis)
void translate(const std::string &aNodeLabel, const VEC3 &aTranslationVector)
virtual void translate(const char *aNodeLabel, const VEC3 &aTranslationVector)
MATRIX4 getLocalTransformationMatrix(const std::string &aNodeLabel) const
MATRIX4 getLocalTransformationMatrix(const char *aNodeLabel) const
MATRIX4 getWorldTransformationMatrix(const std::string &aNodeLabel) const
MATRIX4 getWorldTransformationMatrix(const char *aNodeLabel) const
void moveToCentre(const std::string &aNodeLabel)
void moveToCentre(const char *aNodeLabel)
void moveToCenter(const std::string &aNodeLabel)
void moveToCenter(const char *aNodeLabel)
void moveToCentre()
void moveToCenter()
virtual MATRIX4 getRootNodeTransformationMatrix() const
virtual MATRIX4 getNodeLocalTransformationMatrix(const char *aNodeLabel) const
virtual MATRIX4 getNodeWorldTransformationMatrix(const char *aNodeLabel) const
virtual void setRootNodeTransformationMatrix(const MATRIX4 &aTransformationMatrix)
virtual void setNodeLocalTransformationMatrix(const char *aNodeLabel, const MATRIX4 &aTransformationMatrix)
std::pair<VEC3, VEC3> getBoundingBox()
void addPolygonMesh(const std::string &aLabel, const PolygonMesh &aPolygonMesh, const VEC3 &aPosition, const std::string &aParent = "root")
SceneGraphNode *getNode(const std::string &aLabel)
const SceneGraphNode *getNode(const std::string &aLabel) const

Protected Attributes

SceneGraphNode m_root_node
RATIONAL_NUMBER m_unit_of_length
class SceneGraphNode
#include <SceneGraphNode.h>

Public Functions

SceneGraphNode(const std::string &aLabel = "", SceneGraphNode *apParent = 0)
SceneGraphNode(const SceneGraphNode &aNode)
SceneGraphNode(const std::string &aLabel, const PolygonMesh &aPolygonMesh, const VEC3 &aPosition, SceneGraphNode *apParent)
SceneGraphNode(const std::string &aLabel, PolygonMesh *apPolygonMesh, const VEC3 &aPosition, SceneGraphNode *apParent)
~SceneGraphNode()
SceneGraphNode &operator=(const SceneGraphNode &aNode)
void release()
void clear()
void display()
void displayWireFrame()
const SceneGraphNode *getParent() const
unsigned int getNumberOfChildren() const
gVirtualXRay::SceneGraphNode &getChild(unsigned int i)
const gVirtualXRay::SceneGraphNode &getChild(unsigned int i) const
gVirtualXRay::SceneGraphNode &getChild(const std::string &aLabel)
const gVirtualXRay::SceneGraphNode &getChild(const std::string &aLabel) const
const std::string &getLabel() const
void setGeometry(const PolygonMesh &aPolygonMesh)
void setGeometry(PolygonMesh *apPolygonMesh)
PolygonMesh &getPolygonMesh()
const PolygonMesh &getPolygonMesh() const
MATRIX4 getLocalTransformationMatrix() const
MATRIX4 getWorldTransformationMatrix()
void setLocalTransformation(const MATRIX4 &aMatrix)
void applyLocalTransformation(const MATRIX4 &aMatrix)
void addChild(const std::string &aLabel)
void addChild(const std::string &aLabel, const PolygonMesh &aPolygonMesh, const VEC3 &aPosition = VEC3())
void addChild(const std::string &aLabel, PolygonMesh *apPolygonMesh, const VEC3 &aPosition = VEC3())
std::map<RATIONAL_NUMBER, VEC3> rayIntersectAABB(const VEC3 &aRayOrigin, const VEC3 &aRayDirection)
VEC3 getNodeAndChildrenWorldMinCorner()
VEC3 getNodeAndChildrenWorldMaxCorner()
VEC3 getNodeOnlyWorldMinCorner()
VEC3 getNodeOnlyWorldMaxCorner()
const PhotonCrossSection &getPhotonCrossSection() const
std::map<RATIONAL_NUMBER, VEC3> rayIntersect(const VEC3 &aRayOrigin, const VEC3 &aRayDirection, const MATRIX4 &aTransformationMatrix)

Protected Functions

void updateWorldMatrix()

Protected Attributes

std::string m_label
PolygonMesh m_local_geometry
PolygonMesh *m_p_geometry
MATRIX4 m_local_transformation
MATRIX4 m_global_transformation
VEC3 m_position
gVirtualXRay::SceneGraphNode *m_p_parent
std::vector<gVirtualXRay::SceneGraphNode*> m_p_children
bool m_world_properties_up_to_date

Friends

friend class SceneGraphBinder
class Scintillator
#include <Scintillator.h>

Scintillator is a class to generate the energy response due to the scintillator of the X-Ray detector.

Public Functions

inline Scintillator()

Default constructor.

inline ~Scintillator()

Destructor.

inline void release()

Release the data.

inline void setMaterial(const std::string &aMaterial)
inline void setThickness(const RATIONAL_NUMBER &aThickness)
inline const std::string &getMaterial() const
inline RATIONAL_NUMBER getThickness()
inline std::vector<std::pair<RATIONAL_NUMBER, RATIONAL_NUMBER>> getEnergyResponse() const
inline void loadEnergyResponse(const std::string &aFileName, const RATIONAL_NUMBER &aUnitOfEnergy)

Load the energy response of the detector from a TSV file.

Parameters
  • aFileName – name of the file. Each line of the file is formatted as follows: input_energy output_energy

  • aUnitOfEnergy – the unit of energy corresponding to the data in the file

inline void setEnergyResponse(const std::vector<std::pair<float, float>> &anEnergyResponse)
inline void setEnergyResponse(const std::vector<std::pair<double, double>> &anEnergyResponse)
inline RATIONAL_NUMBER applyEnergyResponse(const RATIONAL_NUMBER &anEnergy) const

Apply the energy response if any.

Parameters

anEnergy – the input energy

Returns

the output energy

Public Static Functions

static inline std::vector<std::string> getSupportedScintillatorMaterials()

Accessor on the list of scintillator materials currently supported.

Returns

the list of supported scintillator materials

static inline std::vector<std::pair<RATIONAL_NUMBER, RATIONAL_NUMBER>> getEnergyResponse(const std::string &aMaterial, const RATIONAL_NUMBER &aThickness)
static inline RATIONAL_NUMBER getDensity(const std::string &aMaterial)
static inline std::string getCompound(const std::string &aMaterial)

Protected Functions

inline int findNearestEnergyIdx(const RATIONAL_NUMBER &anEnergy) const

Find the index of the closest input energy in the energy response.

Returns

the index of the closest input energy

Protected Attributes

std::string m_material
RATIONAL_NUMBER m_density
RATIONAL_NUMBER m_thickness
std::vector<std::pair<RATIONAL_NUMBER, RATIONAL_NUMBER>> m_p_energy_response

Energy response. The keys of the map are the input energies.

class Shader
#include <Shader.h>

Shader is a class to handle shaders written in GLSL.

Public Functions

Shader()

Default constructor.

~Shader()

Destructor.

void enable() const

Enable the current shader.

void release()

Reset (delete the current shader if it is loaded, and restore default values).

void loadFiles(const std::string &aVertexShaderFilename, const std::string &aFragmentShaderFilename)

Load the vertex and fragment shaders from files.

Parameters
  • aVertexShaderFilename – file name of the vertex shader

  • aFragmentShaderFilename – file name of the fragment shader

void loadFile(const std::string &aComputeShaderFilename)

Load the compute shader from a file.

Parameters

aComputeShaderFilename – file name of the compute shader

inline void setLabels(const std::string &aVertexShaderLabel, const std::string &aFragmentShaderLabel)

Set the vertex and fragment shader labels. This is useful for debugging.

Parameters
  • aVertexShaderLabel – label of the vertex shader

  • aFragmentShaderLabel – label of the fragment shader

inline void setLabel(const std::string &aComputeShaderLabel)

Set the compute shader label. This is useful for debugging.

Parameters

aComputeShaderLabel – label of the compute shader

void loadVertexShaderFile(const std::string &aVertexShaderFilename)

Load the vertex shader from a file.

Parameters

aVertexShaderFilename – file name of the vertex shader

void loadFragmentShaderFile(const std::string &aFragmentShaderFilename)

Load the fragment shader from a file.

Parameters

aFragmentShaderFilename – file name of the fragment shader

void loadComputeShaderFile(const std::string &aComputeShaderFilename)

Load the compute shader from a file.

Parameters

aComputeShaderFilename – file name of the compute shader

void loadSource(const std::string &aVertexShaderSourceCode, const std::string &aFragmentShaderSourceCode)

Load the shader source code.

Parameters
  • aVertexShaderSourceCode – source code of the vertex shader

  • aFragmentShaderSourceCode – source code of the fragment shader

void loadSource(const std::string &aComputeShaderSourceCode)

Load the shader source code.

Parameters

aComputeShaderSourceCode – source code of the compute shader

void loadVertexShaderSource(const std::string &aVertexShaderSourceCode)

Load the vertex shader from a string.

Parameters

aVertexShaderSourceCode – the vertex shader source code

void loadFragmentShaderSource(const std::string &aFragmentShaderSourceCode)

Load the fragment shader from a string.

Parameters

aFragmentShaderSourceCode – the fragment shader source code

void loadComputeShaderSource(const std::string &aComputeShaderSourceCode)

Load the compute shader from a string.

Parameters

aComputeShaderSourceCode – the compute shader source code

inline unsigned int getProgramHandle() const

Accessor on the shader program handle.

Returns

the shader program handle

inline bool isValid() const

Accessor on the validity status of the shader.

Returns

true if the shader is valid, false if it is not

Public Static Functions

static void disable()

Disable the current shader (if any)

Protected Functions

int loadFile(const std::string &aShaderFilename, std::string &aShaderSource)

Load a text file and store its content.

Parameters
  • aShaderFilename – file name of the vertex or fragment shader

  • aShaderSource – source code of the vertex or fragment shader

Returns

the number of lines in the file

unsigned int compileShader(int aShaderType, int aLineNumber, const std::string &aShaderSource)

Compile the vertex shader or the fragment shader.

Parameters
  • aShaderType – type of shader (GL_VERTEX_SHADER, GL_FRAGMENT_SHADER or GL_COMPUTE_SHADER)

  • aLineNumber – the number of lines of the source code

  • aShaderSource – source code of the vertex or fragment shader

Returns

the corresponding ID

void linkProgram()

Link the vertex and fragment programs.

Protected Attributes

std::string m_vertex_shader_label

Label of the vertex shader.

std::string m_fragment_shader_label

Label of the fragment shader.

std::string m_compute_shader_label

Label of the compute shader.

std::string m_vertex_shader_filename

Name of the file containing the vertex shader.

std::string m_fragment_shader_filename

Name of the file containing the fragment shader.

std::string m_compute_shader_filename

Name of the file containing the compute shader.

std::string m_vertex_source

Source code of the vertex shader.

int m_vertex_source_number_of_lines

Number of line of the vertex shader.

std::string m_fragment_source

Source code of the fragment shader.

int m_fragment_source_number_of_lines

Number of line of the fragment shader.

std::string m_compute_source

Source code of the vertex shader.

int m_compute_source_number_of_lines

Number of line of the vertex shader.

bool m_valid

Flag set to true if the vertex shader, the fragment shader and the shader program are all valid

unsigned int m_shader_program_id

ID of the shader program.

unsigned int m_vertex_shader_id

ID of the vertex shader.

unsigned int m_fragment_shader_id

ID of the fragment shader.

unsigned int m_compute_shader_id

ID of the compute shader.

Protected Static Attributes

static bool m_shader_capable

Flag set to true when a shader if fully valid.

template<typename T>
class Sinogram : public gVirtualXRay::Image<T>
#include <Image.h>

Sinogram is a class to reconstruct images from a sinogram.

Public Functions

Sinogram()
Sinogram(const Image<T> anImage)
Sinogram(unsigned int aWidth, unsigned int aHeight, unsigned int aNumberOfSlices = 1)
Image<T> getProjectionSet() const
Image<T> art(double aFirstAngle, double anAngleStep, unsigned int aNumberOfIterations = 0, const char *aDirectory = 0, void (*aCallback)(const Image<T>*, const Image<T>*, const Image<T>*) = 0) const
Image<T> mart(double aFirstAngle, double anAngleStep, unsigned int aNumberOfIterations = 0, const char *aDirectory = 0, void (*aCallback)(const Image<T>*, const Image<T>*, const Image<T>*) = 0) const
Image<T> sirt(double aFirstAngle, double anAngleStep, unsigned int aNumberOfIterations = 0, const char *aDirectory = 0, void (*aCallback)(const Image<T>*, const Image<T>*, const Image<T>*) = 0) const
Image<T> simpleBackProjection(double aFirstAngle, double anAngleStep, const char *aDirectorye = 0, void (*aCallback)(const Image<T>*, const Image<T>*, const Image<T>*) = 0) const
Image<T> filteredBackProjection(double aFirstAngle, double anAngleStep, const char *aFilterType = "hamming", float aScalingFactor = 1.0, const char *aDirectory = 0, void (*aCallback)(const Image<T>*, const Image<T>*, const Image<T>*) = 0) const
Image<T> art(double aFirstAngle, double anAngleStep, unsigned int aNumberOfIterations, const std::string &aDirectory, void (*aCallback)(const Image<T>*, const Image<T>*, const Image<T>*)) const
Image<T> mart(double aFirstAngle, double anAngleStep, unsigned int aNumberOfIterations, const std::string &aDirectory, void (*aCallback)(const Image<T>*, const Image<T>*, const Image<T>*)) const
Image<T> sirt(double aFirstAngle, double anAngleStep, unsigned int aNumberOfIterations, const std::string &aDirectory, void (*aCallback)(const Image<T>*, const Image<T>*, const Image<T>*)) const
Image<T> simpleBackProjection(double aFirstAngle, double anAngleStep, const std::string &aDirectory, void (*aCallback)(const Image<T>*, const Image<T>*, const Image<T>*)) const
Image<T> filteredBackProjection(double aFirstAngle, double anAngleStep, const std::string &aFilterType, float aScalingFactor, const std::string &aDirectory, void (*aCallback)(const Image<T>*, const Image<T>*, const Image<T>*)) const
void makeBlank(const T &aDefaultColour = 0)

Replace all the pixels of an image with a default value.

Parameters

aDefaultColour – the pixel value (default value: 0)

Image getROI(unsigned int i, unsigned int j, unsigned int k, unsigned int aWidth, unsigned int aHeight, unsigned int aDepth) const

Compute a region of interest (ROI).

Parameters
  • i – the position of the first pixel of the ROI along the horizontal axis

  • j – the position of the first pixel of the ROI along the vertical axis

  • k – the position of the first pixel of the ROI along the depth axis

  • aWidth – the width of the ROI (in number of pixels)

  • aHeight – the height of the ROI (in number of pixels)

  • aDepth – the depth of the ROI (in number of pixels)

Returns

the ROI

void setPixel(unsigned int i, unsigned int j, unsigned int k, T aValue)

Set a pixel.

Parameters
  • i – the position of the pixel along the x-axis

  • j – the position of the pixel along the y-axis

  • k – the position of the pixel along the z-axis

  • aValue – the new pixel value

T &getPixel(unsigned int i, unsigned int j, unsigned int k = 0)

Accessor on a pixel value.

Parameters
  • i – the position of the pixel along the x-axis

  • j – the position of the pixel along the y-axis

  • k – the position of the pixel along the z-axis (default value: 0)

Returns

the pixel value

const T &getPixel(unsigned int i, unsigned int j, unsigned int k = 0) const

Accessor on a pixel value.

Parameters
  • i – the position of the pixel along the x-axis

  • j – the position of the pixel along the y-axis

  • k – the position of the pixel along the z-axis (default value: 0)

Returns

the pixel value

T &getPixelValue(unsigned int i, unsigned int j, unsigned int k = 0)

Accessor on a pixel value.

Parameters
  • i – the position of the pixel along the x-axis

  • j – the position of the pixel along the y-axis

  • k – the position of the pixel along the z-axis (default value: 0)

Returns

the pixel value

const T &getPixelValue(unsigned int i, unsigned int j, unsigned int k = 0) const

Accessor on a pixel value.

Parameters
  • i – the position of the pixel along the x-axis

  • j – the position of the pixel along the y-axis

  • k – the position of the pixel along the z-axis (default value: 0)

Returns

the pixel value

VEC3 getPixelPosition(unsigned int i, unsigned int j, unsigned int k = 0) const

Accessor on a pixel position.

Parameters
  • i – the position of the pixel along the x-axis

  • j – the position of the pixel along the y-axis

  • k – the position of the pixel along the z-axis (default value: 0)

Returns

the pixel position

T &operator[](unsigned anIndex)
const T &operator[](unsigned anIndex) const
T &operator()(unsigned int i, unsigned int j, unsigned int k)
const T &operator()(unsigned int i, unsigned int j, unsigned int k) const
void destroy()

Release the memory.

T *getRawData()

Accessor on the raw data.

Returns

the raw data

const T *getRawData() const

Accessor on the raw data.

Returns

the raw data

unsigned int getWidth() const

Number of pixels along the horizontal axis.

Returns

the width

unsigned int getHeight() const

Number of pixels along the vertical axis.

Returns

the height

unsigned int getDepth() const

Number of pixels along the Z axis.

Returns

the depth

void setSpacing(const VEC3 &aPixelSize)
void setSpacing(const double &aPixelWidth, const double &aPixelHeight = 0.0, const double &aPixelDepth = 0.0)
const VEC3 &getSpacing() const
T getMinValue() const

Compute the minimum pixel value in the image.

Returns

the minimum pixel

T getMinValue(unsigned int aSliceID) const

Compute the minimum pixel value in a given slice.

Parameters

aSliceID – the slice ID

Returns

the minimum pixel

T getMaxValue() const

Compute the maximum pixel value in the image.

Returns

the maximum pixel

T getMaxValue(unsigned int aSliceID) const

Compute the maximum pixel value in a given slice.

Parameters

aSliceID – the slice ID

Returns

the maximum pixel

Image shiftScaleFilter(double aShiftValue, double aScaleValue, bool aRunOnGPUFlag = true) const

Add aShiftValue to every pixel, then multiply every pixel by aScaleValue

Parameters
  • aShiftValue – the shift parameter of the filter

  • aScaleValue – the scale parameter of the filter

Image<unsigned char> threshold(const T &aLowerThreshold, const T &aUpperThreshold, unsigned char anInValue, unsigned char anOutValue, bool aRunOnGPUFlag = true) const
Image<unsigned char> threshold(const T &aThreshold, unsigned char aValueIn = 1, unsigned char aValueOut = 0) const
Image<unsigned char> threshold(const T &aLowerThreshold, const T &aUpperThreshold, unsigned char aValueIn = 1, unsigned char aValueOut = 0) const
Image<T> convolution1D(const std::vector<float> &aKernel) const
Image<T> convolution2D(const Image<float> &aKernel) const
Image<T> convolution2D(const Image<double> &aKernel) const
Image<unsigned char> opening(unsigned int aRadius) const
Image<unsigned char> closing(unsigned int aRadius) const
Image<float> getIsoTropic() const
Image<float> antiAliasBinaryImageFilter(double aMaximumRMSChange, unsigned int aNumberOfIterations, double aVariance) const
Image constantPadFilter(const T &aPadValue) const
Image normalised(bool aRunOnGPUFlag = true) const

Normalise the image between 0 and 1.

Image normalized(bool aRunOnGPUFlag = true) const

Normalize the image between 0 and 1.

void load(const char *aFileName)
void load(const std::string &aFileName)
void loadUsingITK(const char *aFileName)
void loadUsingITK(const std::string &aFileName)
void loadSeries(const char *aPattern, int aFirstSliceIndex, int aLastSliceIndex, int anIncrementIndex = 1)
void loadSeries(const std::string &aPattern, int aFirstSliceIndex, int aLastSliceIndex, int anIncrementIndex = 1)
void loadDicomSeries(const char *aDirectory)
void loadDicomSeries(const std::string &aDirectory)
void loadASCII(const char *aFileName)
void loadASCII(const std::string &aFileName)
void loadASCII(const char *aFileName, unsigned int aWidth, unsigned int aHeight, unsigned int aDepth, const VEC3 &aVoxelSize)
void loadASCII(const std::string &aFileName, unsigned int aWidth, unsigned int aHeight, unsigned int aDepth, const VEC3 &aVoxelSize)
void loadMHD(const char *aFileName)
void loadMHD(const std::string &aFileName)
void loadMHA(const char *aFileName)
void loadMHA(const std::string &aFileName)
unsigned int sizeOf(const char *anElementType) const
unsigned int sizeOf(const std::string &anElementType) const
void loadRAW(const char *aFileName, unsigned int aWidth, unsigned int aHeight, unsigned int aNumberOfSlices = 1, bool aChangeEndianessFlag = false, const char *anElementType = 0)
void loadRAW(const std::string &aFileName, unsigned int aWidth, unsigned int aHeight, unsigned int aNumberOfSlices = 1, bool aChangeEndianessFlag = false, const std::string &anElementType = "")
void loadTIFF(const char *aFileName)
void loadTIFF(const std::string &aFileName)
void save(const char *aFileName, bool anInvertLUTFlag = false, const char *aComment = "", bool useDeflateCompressionIfPossible = false) const

Save the image in a file.

Parameters
  • aFileName – the name of the file to write

  • anInvertLUTFlag – invert the LUT if it is supported by the file format (default value: false)

  • aComment – add a comment if it is supported by the file format (default value: “”)

  • useDeflateCompressionIfPossible – use compression if possible (default value: false)

void save(const std::string &aFileName, bool anInvertLUTFlag = false, const std::string &aComment = "", bool useDeflateCompressionIfPossible = false) const

Save the image in a file.

Parameters
  • aFileName – the name of the file to write

  • anInvertLUTFlag – invert the LUT if it is supported by the file format (default value: false)

  • aComment – add a comment if it is supported by the file format (default value: “”)

  • useDeflateCompressionIfPossible – use compression if possible (default value: false)

void savePGM(const char *aFileName) const

Save the image in a PGM file.

Parameters

aFileName – the name of the file to write

void savePGM(const std::string &aFileName) const

Save the image in a PGM file.

Parameters

aFileName – the name of the file to write

void saveRaw(const char *aFileName, bool useDeflateCompressionIfPossible) const

Save the image in a Raw file.

Parameters
  • aFileName – the name of the file to write

  • useDeflateCompressionIfPossible – use compression (default value: false)

void saveRaw(const std::string &aFileName, bool useDeflateCompressionIfPossible) const

Save the image in a Raw file.

Parameters
  • aFileName – the name of the file to write

  • useDeflateCompressionIfPossible – use compression (default value: false)

void saveRAW(const char *aFileName, bool useDeflateCompressionIfPossible) const

Save the image in a Raw file.

Parameters
  • aFileName – the name of the file to write

  • useDeflateCompressionIfPossible – use compression (default value: false)

void saveRAW(const std::string &aFileName, bool useDeflateCompressionIfPossible) const

Save the image in a Raw file.

Parameters
  • aFileName – the name of the file to write

  • useDeflateCompressionIfPossible – use compression (default value: false)

void saveASCII(const char *aFileName) const

Save the image in an ASCII file.

Parameters

aFileName – the name of the file to write

void saveASCII(const std::string &aFileName) const

Save the image in an ASCII file.

Parameters

aFileName – the name of the file to write

void saveMHD(const char *aFileName, bool useDeflateCompressionIfPossible = false) const

Save the image in a MHD+RAW file.

Parameters
  • aFileName – the name of the file to write

  • useDeflateCompressionIfPossible – use compression (default value: false)

void saveMHD(const std::string &aFileName, bool useDeflateCompressionIfPossible = false) const

Save the image in a MHD+RAW file.

Parameters
  • aFileName – the name of the file to write

  • useDeflateCompressionIfPossible – use compression (default value: false)

void saveMHA(const char *aFileName, bool useDeflateCompressionIfPossible = false) const

Save the image in a MHA+RAW file.

Parameters
  • aFileName – the name of the file to write

  • useDeflateCompressionIfPossible – use compression (default value: false)

void saveMHA(const std::string &aFileName, bool useDeflateCompressionIfPossible = false) const

Save the image in a MHA+RAW file.

Parameters
  • aFileName – the name of the file to write

  • useDeflateCompressionIfPossible – use compression (default value: false)

void saveDCM(const char *aFileName, bool anInvertLUTFlag = false, const char *aComment = "") const

Save the image in a DICOM file.

Parameters
  • aFileName – the name of the file to write

  • anInvertLUTFlag – invert the LUT (default value: false)

  • aComment – add a comment (default value: “”)

void saveDCM(const std::string &aFileName, bool anInvertLUTFlag = false, const std::string &aComment = "") const

Save the image in a DICOM file.

Parameters
  • aFileName – the name of the file to write

  • anInvertLUTFlag – invert the LUT (default value: false)

  • aComment – add a comment (default value: “”)

void saveTIFF(const char *aFileName, bool anInvertLUTFlag = false) const

Save the image in a TIFF file.

Parameters
  • aFileName – the name of the file to write

  • anInvertLUTFlag – invert the LUT (default value: false)

void saveTIFF(const std::string &aFileName, bool anInvertLUTFlag = false) const

Save the image in a TIFF file.

Parameters
  • aFileName – the name of the file to write

  • anInvertLUTFlag – invert the LUT (default value: false)

void saveUsingITK(const char *aFileName, bool useDeflateCompressionIfPossible = false) const

Save the image in a file using ITK.

Parameters
  • aFileName – the name of the file to write

  • useDeflateCompressionIfPossible – use compression (default value: false)

void saveUsingITK(const std::string &aFileName, bool useDeflateCompressionIfPossible = false) const

Save the image in a file using ITK.

Parameters
  • aFileName – the name of the file to write

  • useDeflateCompressionIfPossible – use compression (default value: false)

bool operator==(const Image<T> &anImage) const

Operator Equal to.

Parameters

anImage – the image to compare with

Returns

true if the images are similar, false if they are different

bool operator!=(const Image<T> &anImage) const

Operator Not equal to.

Parameters

anImage – the image to compare with

Returns

true if the images are different, false if they are similar

Image operator+(const Image<T> &anImage) const

Addition operator. Add anImage.

Parameters

anImage – the image to add

Returns

the resulting image

Image operator+(T aValue) const

Addition operator. Add aValue to every pixel of the image.

Parameters

aValue – the value to add

Returns

the resulting image

Image operator-(const Image<T> &anImage) const

Subtraction operator. Add anImage.

Parameters

anImage – the image to subtract

Returns

the resulting image

Image operator-(T aValue) const

Subtraction operator. Subtract aValue to every pixel of the image.

Parameters

aValue – the value to subtract

Returns

the resulting image

Image operator*(const Image<T> &anImage) const

Multiplication operator. Add anImage.

Parameters

anImage – the image to add

Returns

the resulting image

Image operator*(T aValue) const

Multiplication operator. Multiply every pixel of the image by aValue.

Parameters

aValue – the value for the multiplication

Returns

the resulting image

Image operator/(const Image<T> &anImage) const

Division operator. Add anImage.

Parameters

anImage – the image to subtract

Returns

the resulting image

Image operator/(T aValue) const

Division operator. Divide every pixel of the image by aValue.

Parameters

aValue – the value for the division

Returns

the resulting image

Image<T> &operator+=(const Image<T> &anImage)

Addition assignment operator. Add anImage.

Parameters

anImage – the image to add

Returns

the updated version of the current image

Image<T> &operator+=(T aValue)

Addition operator. Add aValue to every pixel of the image.

Parameters

aValue – the value to add

Returns

the updated version of the current image

Image<T> &operator-=(const Image<T> &anImage)

Subraction assignment operator. Add anImage.

Parameters

anImage – the image to subtract

Returns

the updated version of the current image

Image<T> &operator-=(T aValue)

Subtraction operator. Subtract aValue to every pixel of the image.

Parameters

aValue – the value to subtract

Returns

the updated version of the current image

Image<T> &operator*=(const Image<T> &anImage)

Multiplication assignment operator. Add anImage.

Parameters

anImage – the image to add

Returns

the updated version of the current image

Image<T> &operator*=(T aValue)

Multiplication operator. Multiply every pixel of the image by aValue.

Parameters

aValue – the value for the multiplication

Returns

the updated version of the current image

Image<T> &operator/=(const Image<T> &anImage)

Division assignment operator. Add anImage.

Parameters

anImage – the image to subtract

Returns

the updated version of the current image

Image<T> &operator/=(T aValue)

Division operator. Divide every pixel of the image by aValue.

Parameters

aValue – the value for the division

Returns

the updated version of the current image

Image operator!() const

Negation operator. Compute the negative of the current image.

Returns

the negative image

Image<T> abs() const
Image<T> log() const
Image<T> flipVertically() const
Image<T> flipHorizontally() const
double getSum() const
double getAverage() const
double getVariance() const
double getStandardDeviation() const
double computeSAE(const Image<T> &anImage) const
double computeMAE(const Image<T> &anImage) const
double computeSSE(const Image<T> &anImage) const
double computeMSE(const Image<T> &anImage) const
double computeRMSE(const Image<T> &anImage) const
double computeNCC(const Image<T> &anImage) const
gVirtualXRay::FFT<T> getFFT() const
Image<T> transpose() const
Image<T> resize(unsigned int aNewWidth, unsigned int aNewHeightunsigned, unsigned int aNewNumberOfSlices) const
Image<T> rotate(float anAngleInDegrees) const
Image<T> setCanvasSize(unsigned int aNewWidth, unsigned int aNewHeight, unsigned int aNewNumberOfSlices) const
gVirtualXRay::Sinogram<T> radonTransform(double aFirstAngle, double anAngleStep, double aLastAngle) const
PolygonMesh marchingCubes(const T &aFirstThresholdValue, const T &aSecondThresholdValue = 0, bool aTwoThresholdFlag = false, unsigned char aVerboseLevel = 0) const

Apply the marching cubes algorithm to extract the polygon mesh corresponding to voxel values in the range between aFirstThresholdValue and aSecondThresholdValue.

Parameters
  • aFirstThresholdValue – the first threshold

  • aSecondThresholdValue – the second threshold (optional)

  • aTwoThresholdFlag – if the flag is false, then use aFirstThresholdValue as iso-value. If the flag is true, then use voxel values in the range between aFirstThresholdValue and aSecondThresholdValue. (default value: false)

  • aVerboseLevel – the level of statements in the standard output. For no output, use 0 (default value: 0)

Returns

the polygon mesh

void convertVoxelsToCubes(std::map<T, PolygonMesh> &aPolygonMeshSet, T aThreshold = -1000, unsigned char aVerboseLevel = 0) const

Convert every voxel into a cube.

Parameters
  • aPolygonMeshSet – the set of polygon mesh

  • aThreshold – the iso-value. Any voxel above the iso-value is part of the selected object. Other voxels are ignored.

  • aVerboseLevel – the level of statements in the standard output. For no output, use 0 (default value: 0)

Image<T> convertHU2mu(double anEnergy) const
void allocateHostMemory()
void transferHostToDevice()
void transferDeviceToHost()
void destroyOpenGLTexture()
unsigned int getTextureId() const

Protected Functions

VEC3 VertexInterp(const T &aThresholdValue, const VEC3 &p0, const VEC3 &p1, const T &v0, const T &v1) const

Protected Attributes

unsigned int m_width

Number of pixel along the horizontal axis.

unsigned int m_height

Number of pixel along the vertical axis.

unsigned int m_number_of_slices

Number of slices.

VEC3 m_spacing

The space between two successive pixels.

T *m_p_image

The pixel data.

unsigned int m_texture_id

OpenGL texture ID.

Protected Static Attributes

static unsigned int g_mesh_type
static unsigned int g_vbo_type
class SkinMesh : public gVirtualXRay::AnatomicalMesh
#include <SkinMesh.h>

SkinMesh is a class to handle a polygon mesh for Skin.

Public Functions

SkinMesh()

Default Constructor.

virtual ~SkinMesh()

Destructor.

virtual bool isTransparent() const

return true if the mesh has to be displayed with transparency

virtual bool isSoftTissue() const

return true if the mesh represent a soft tissue

virtual void initialize()

Merge the vertices for optimization and a smoother display.

virtual void defineDisplayShaderInput(unsigned int aShaderID)

Link the attributes to their id in the shader.

void copyFrom(const AnatomicalMesh &aPolygonMesh)
void copyFrom(const PolygonMesh &aPolygonMesh)

Copy.

Parameters

aPolygonMesh – the polygon mesh to copy

virtual const std::string &getLabel() const

Accessor on the label that determines the type of the mesh.

void reset()

Reset the data.

inline void resetVBOs()

Reset the VBOs only.

inline void setDisplayFlag(bool display)

Set if the mesh is displayed or not.

Parameters

display – true or false

inline bool getDisplayFlag() const

Accessor on the display flag of the polygon mesh.

Returns

display flag

void display()

Display the triangular mesh using OpenGL.

void displayWireFrame()

Display the triangular mesh in wireframe using OpenGL.

void displayFaceNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the face normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

void displayVertexNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the vertex normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

inline void setFilename(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFilename(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline const std::string &getFilename() const

Accessor on the name of the file that contains the polygon mesh.

Returns

the file name

inline const RATIONAL_NUMBER &getUnitOfLength() const

Accessor on the unit of length of the mesh.

Returns

the unit of length

void loadSTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void writeSTLFile(bool aBinaryFlag)

Write the STL file.

Parameters

aBinaryFlag – if true, save a binary file; if false save an ASCII file

inline void moveToCentre()

Move the polygon to the centre.

inline void moveToCenter()

Move the polygon to the center.

void computeNormalVectors()

Compute the normal vectors using the cross product method.

inline bool useVBO(int aBufferUsageHing, int aTypeOfPrimitive)

Use a vertex buffer object if possible.

Parameters
  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

Returns

true if the VBO can be used, false otherwise

inline void setHU(short HU)
inline void setHounsfieldUnit(short HU)
inline void setHounsfieldValue(short HU)
inline void setElement(unsigned short Z)
inline void setElement(const std::string &aName)
inline void setMixture(const Mixture &aMixture)
inline void setMixture(const std::map<int, double> &aMixture)
inline void setMixture(const std::map<std::string, double> &aMixture)
inline void setMixture(const std::string &aName)
inline void setCompound(const std::string &aName)
inline void setMassAttenuationCoefficient(double aCoefficient)
inline void setLinearAttenuationCoefficient(double aCoefficient)
inline void setDensity(double aDensity)
inline double getDensity()
inline const std::string &getMaterialLabel() const
inline std::string getCompound() const

Accessor on the compound description of the polygon mesh.

Returns

if the sample is made of a compound, then return the description of the compound (e.g. H2O for water), otherwise return an empty string

inline std::vector<int> getMixtureElementSet() const

Accessor on the element Z number set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element Z number set of the mixture, otherwise return an empty vector

inline std::vector<double> getMixtureWeightSet() const

Accessor on the element weight set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element weight set of the mixture, otherwise return an empty vector

inline const PhotonCrossSection &getPhotonCrossSection() const
inline void setPhotonCrossSection(const PhotonCrossSection &aPhotonCrossSection)
inline const VEC3 &getLocalMinCorner() const

Accessor on the bounding box lower corner.

Returns

the bounding box lower corner

inline const VEC3 &getLocalMaxCorner() const

Accessor on the bounding box upper corner.

Returns

the bounding box upper corner

inline void applyTranslation(const VEC3 &aTranslationVector)

Translate the polygon mesh given a translation vector, and update the VBO if needed.

Parameters

aTranslationVector – the translation vector

inline void applyScaling(RATIONAL_NUMBER x, RATIONAL_NUMBER y, RATIONAL_NUMBER z)

Scale the polygon mesh given scaling factors, and update the VBO if needed.

Parameters
  • x – the scaling factor along the X-axis

  • y – the scaling factor along the Y-axis

  • z – the scaling factor along the Z-axis

inline void applyRotation(const VEC3 &aRotationAxis, RATIONAL_NUMBER aRotationAngleInDegrees)

Rotate the polygon mesh given a rotation axis and angle, and update the VBO if needed.

Parameters
  • aRotationAxis – the rotation axis

  • aRotationAngleInDegrees – the rotation angle in degrees

inline void applyTransform(const MATRIX4 &aTransformationMatrix)

Transform the polygon mesh given a transformation matrix and update the VBO if needed.

Parameters

aTransformationMatrix – the transformation matrix

unsigned int getFaceNumber() const

Accessor on the number of faces.

Returns

the number of faces

unsigned int getTriangleNumber() const

Accessor on the number of triangles.

Returns

the number of triangles

inline unsigned int getFaceNormalNumber() const

Accessor on the number of face normal vectors.

Returns

the number of face normal vectors

inline unsigned int getVertexNormalNumber() const

Accessor on the number of vertex normal vectors.

Returns

the number of vertex normal vectors

inline unsigned int getVertexNumber() const

Accessor on the number of vertices.

Returns

the number of vertices

inline unsigned int getIndexNumber() const

Accessor on the number of indices.

Returns

the number of indices

void mergeVertices(bool aPrintDebugInfoFlag = false)

Merge the vertices of the mesh if the data is managed by the class instance, and if no index has been build.

void splitFaces(bool aPrintDebugInfoFlag = false)

Split each face into four faces.

VEC3 getVertex(unsigned int anIndex) const

Accessor on a given vertex.

Parameters

anIndex – the index of the vertex to access

Returns

the vertex

void setVertex(unsigned int anIndex, const VEC3 &aVertex)

Change the value of a given vertex.

Parameters
  • anIndex – the index of the vertex to access

  • aVertex – the new value of the vertex

inline void setFaceNormal(unsigned int anIndex, const VEC3 &aNormalVector)
inline void setVertexNormal(unsigned int anIndex, const VEC3 &aNormalVector)
int getIndex(unsigned int anIndex) const

Accessor on a given index.

Parameters

anIndex – the index of the index to access

Returns

the index

void setIndex(unsigned int anIndex, unsigned int aValue)

Set the value of a given index.

Parameters
  • anIndex – the index of the index to access

  • aValue – the new value of the index

inline VEC3 getFaceNormal(unsigned int anIndex) const

Accessor on a given face normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

inline VEC3 getVertexNormal(unsigned int anIndex) const

Accessor on a given vertex normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

void setExternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setVBOData(const void *aVertexArray, unsigned int aNumberOfVertices, unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO, unsigned int aNumberOfIndices, int anIndexDataType, const void *aIndexArray = NULL, const void *aNormalArray = NULL)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aIndexArray – array containing the index data

  • aNormalArray – array containing the normal data

void setInternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)
void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

inline void applyScale(const RATIONAL_NUMBER &aScale)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters

aScale – scaling factor

void applyScale(const RATIONAL_NUMBER &aScaleX, const RATIONAL_NUMBER &aScaleY, const RATIONAL_NUMBER &aScaleZ)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters
  • aScaleX – scaling factor alng the x-axis

  • aScaleY – scaling factor alng the y-axis

  • aScaleZ – scaling factor alng the z-axis

inline void invertNormalVectors()

Inverse the normal vectors.

virtual void updateVBO(int aTypeOfVBO, int aTypeOfPrimitive)

Update the VBO.

Parameters
  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

virtual void updateVBOs(unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO)

Update the VBOs with VBO already created.

Parameters
  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

inline const Material &getMaterial() const

Accessor on the material of the polygon mesh.

Returns

the material

inline Material &getMaterial()

Accessor on the material of the polygon mesh.

Returns

the material

virtual PolygonMesh operator+(const PolygonMesh &aPolygonMesh) const

operator+.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh operator+(const VEC3 &aTranslationVector) const

operator+.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const PolygonMesh &aPolygonMesh) const

operator-.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const VEC3 &aTranslationVector) const

operator-.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const PolygonMesh &aPolygonMesh)

operator+=.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const VEC3 &aTranslationVector)

operator+=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const PolygonMesh &aPolygonMesh)

operator-=.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const VEC3 &aTranslationVector)

operator-=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

std::map<RATIONAL_NUMBER, VEC3> rayIntersect(const VEC3 &aRayOrigin, const VEC3 &aRayDirection, const MATRIX4 &aTransformationMatrix) const
void getTriangleVertices(VEC3 &v0, VEC3 &v1, VEC3 &v2, unsigned int anIndex) const
inline bool hasNormalVectorsInverted() const

Check if the normal vectors have been inverted.

Returns

true if the normal vectors have been inverted; false otherwise.

Protected Functions

inline void computeBoundingBox()

Update the bounding box.

void normaliseNormals()

Normalise the normal vectors.

void destroyVertexData()

Release the memory held by the vertex data if needed.

void destroyIndexData()

Release the memory held by the index data if needed.

void removeIndex(bool aPrintDebugInfoFlag = false)

Remove the index.

void copyVertexSet(const void *apVertexSet)

Copy a vertex set.

void copyIndexSet(const void *apIndexSet)

Copy an index set.

void loadASCIISTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadBinarySTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadSTLDataFromBinaryStream(const char *apInputData, bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • apInputData – the input data to load

  • aMoveToCentreFlag – a flag to move the polygon to the centre or not

  • anAutoComputeNormalFlag – a flag to compute normals or nor

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

Protected Attributes

int m_use_texture

1 if the mesh use texturing; default value is 0

int m_use_bump_map

1 if the mesh use bump mapping; default value is 0

std::string m_label

A label to determine the type of the mesh.

std::string m_filename

Name of the file that contains the polygon mesh.

RATIONAL_NUMBER m_file_scale

Unit of length of the file that contains the polygon mesh (if negative, then unknown)

std::auto_ptr<VBO> m_p_vbo

Vertex buffer object.

std::auto_ptr<PolygonMesh> m_p_face_normal_vbo
std::auto_ptr<PolygonMesh> m_p_vertex_normal_vbo
PhotonCrossSection m_photon_cross_section

Material properties, with respect to X-ray.

VEC3 m_local_min_corner

Lower corner of the bounding box.

VEC3 m_local_max_corner

Upper corner of the bounding box.

std::vector<RATIONAL_NUMBER> m_p_vertex_normal_set

Array containing the normal vectors (one per triangle)

Array containing the normal vectors (one per vertex)

void *m_p_vertex_set

Array containing the vertices.

void *m_p_index_set

Array containing the index.

unsigned int m_number_of_indices

Number of indices.

unsigned int m_number_of_vertices

Number of vertices.

int m_index_data_type

Data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

int m_vertex_data_type

Data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

int m_polygon_type

Polygon type; valid values are GL_TRIANGLES.

bool m_external_data_flag

A flag set to true if the memory is managed outside of this class instance; set to false if the memory is managed by this class instance

bool m_display_flag

A flag set to true if you want to display in the Xray image

Material m_material

Material of the object.

bool m_has_inverted_normal_vectors

A flag set to true if the normal vectors are inverted.

class SoftTissueMesh : public gVirtualXRay::InternalOrganMesh
#include <SoftTissueMesh.h>

SoftTissueMesh is a class to handle a polygon mesh for an internal organ. It uses procedural texturing.

Subclassed by gVirtualXRay::DiaphragmMesh, gVirtualXRay::LiverMesh, gVirtualXRay::LungsMesh

Public Functions

SoftTissueMesh(bool optimize_texture_coordinates = true, unsigned int texture_size = 1024, unsigned int texture_3D_size = 64)

Default Constructor.

virtual ~SoftTissueMesh()

Destructor.

virtual bool isSoftTissue() const

return true if the mesh represent a soft tissue

virtual void updateVBO(int aTypeOfVBO, int aTypeOfPrimitive)

Update the VBO.

Parameters
  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

virtual void defineDisplayShaderInput(int aShaderID)

Link the attributes to their id in the shader.

virtual void initialize()

initialize the shaders, the buffers, the normal vectors and the textures

virtual bool isTransparent() const

return true if the mesh has to be displayed with transparency

virtual void defineDisplayShaderInput(unsigned int aShaderID)

Link the attributes to their id in the shader.

virtual void splitFaces()

Split each face into four faces.

void splitFaces(bool aPrintDebugInfoFlag = false)

Split each face into four faces.

void copyFrom(const InternalOrganMesh &aPolygonMesh)
void copyFrom(const AnatomicalMesh &aPolygonMesh)
void copyFrom(const PolygonMesh &aPolygonMesh)

Copy.

Parameters

aPolygonMesh – the polygon mesh to copy

virtual const std::string &getLabel() const

Accessor on the label that determines the type of the mesh.

void reset()

Reset the data.

inline void resetVBOs()

Reset the VBOs only.

inline void setDisplayFlag(bool display)

Set if the mesh is displayed or not.

Parameters

display – true or false

inline bool getDisplayFlag() const

Accessor on the display flag of the polygon mesh.

Returns

display flag

void display()

Display the triangular mesh using OpenGL.

void displayWireFrame()

Display the triangular mesh in wireframe using OpenGL.

void displayFaceNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the face normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

void displayVertexNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the vertex normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

inline void setFilename(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFilename(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline const std::string &getFilename() const

Accessor on the name of the file that contains the polygon mesh.

Returns

the file name

inline const RATIONAL_NUMBER &getUnitOfLength() const

Accessor on the unit of length of the mesh.

Returns

the unit of length

void loadSTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void writeSTLFile(bool aBinaryFlag)

Write the STL file.

Parameters

aBinaryFlag – if true, save a binary file; if false save an ASCII file

inline void moveToCentre()

Move the polygon to the centre.

inline void moveToCenter()

Move the polygon to the center.

void computeNormalVectors()

Compute the normal vectors using the cross product method.

inline bool useVBO(int aBufferUsageHing, int aTypeOfPrimitive)

Use a vertex buffer object if possible.

Parameters
  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

Returns

true if the VBO can be used, false otherwise

inline void setHU(short HU)
inline void setHounsfieldUnit(short HU)
inline void setHounsfieldValue(short HU)
inline void setElement(unsigned short Z)
inline void setElement(const std::string &aName)
inline void setMixture(const Mixture &aMixture)
inline void setMixture(const std::map<int, double> &aMixture)
inline void setMixture(const std::map<std::string, double> &aMixture)
inline void setMixture(const std::string &aName)
inline void setCompound(const std::string &aName)
inline void setMassAttenuationCoefficient(double aCoefficient)
inline void setLinearAttenuationCoefficient(double aCoefficient)
inline void setDensity(double aDensity)
inline double getDensity()
inline const std::string &getMaterialLabel() const
inline std::string getCompound() const

Accessor on the compound description of the polygon mesh.

Returns

if the sample is made of a compound, then return the description of the compound (e.g. H2O for water), otherwise return an empty string

inline std::vector<int> getMixtureElementSet() const

Accessor on the element Z number set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element Z number set of the mixture, otherwise return an empty vector

inline std::vector<double> getMixtureWeightSet() const

Accessor on the element weight set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element weight set of the mixture, otherwise return an empty vector

inline const PhotonCrossSection &getPhotonCrossSection() const
inline void setPhotonCrossSection(const PhotonCrossSection &aPhotonCrossSection)
inline const VEC3 &getLocalMinCorner() const

Accessor on the bounding box lower corner.

Returns

the bounding box lower corner

inline const VEC3 &getLocalMaxCorner() const

Accessor on the bounding box upper corner.

Returns

the bounding box upper corner

inline void applyTranslation(const VEC3 &aTranslationVector)

Translate the polygon mesh given a translation vector, and update the VBO if needed.

Parameters

aTranslationVector – the translation vector

inline void applyScaling(RATIONAL_NUMBER x, RATIONAL_NUMBER y, RATIONAL_NUMBER z)

Scale the polygon mesh given scaling factors, and update the VBO if needed.

Parameters
  • x – the scaling factor along the X-axis

  • y – the scaling factor along the Y-axis

  • z – the scaling factor along the Z-axis

inline void applyRotation(const VEC3 &aRotationAxis, RATIONAL_NUMBER aRotationAngleInDegrees)

Rotate the polygon mesh given a rotation axis and angle, and update the VBO if needed.

Parameters
  • aRotationAxis – the rotation axis

  • aRotationAngleInDegrees – the rotation angle in degrees

inline void applyTransform(const MATRIX4 &aTransformationMatrix)

Transform the polygon mesh given a transformation matrix and update the VBO if needed.

Parameters

aTransformationMatrix – the transformation matrix

unsigned int getFaceNumber() const

Accessor on the number of faces.

Returns

the number of faces

unsigned int getTriangleNumber() const

Accessor on the number of triangles.

Returns

the number of triangles

inline unsigned int getFaceNormalNumber() const

Accessor on the number of face normal vectors.

Returns

the number of face normal vectors

inline unsigned int getVertexNormalNumber() const

Accessor on the number of vertex normal vectors.

Returns

the number of vertex normal vectors

inline unsigned int getVertexNumber() const

Accessor on the number of vertices.

Returns

the number of vertices

inline unsigned int getIndexNumber() const

Accessor on the number of indices.

Returns

the number of indices

void mergeVertices(bool aPrintDebugInfoFlag = false)

Merge the vertices of the mesh if the data is managed by the class instance, and if no index has been build.

VEC3 getVertex(unsigned int anIndex) const

Accessor on a given vertex.

Parameters

anIndex – the index of the vertex to access

Returns

the vertex

void setVertex(unsigned int anIndex, const VEC3 &aVertex)

Change the value of a given vertex.

Parameters
  • anIndex – the index of the vertex to access

  • aVertex – the new value of the vertex

inline void setFaceNormal(unsigned int anIndex, const VEC3 &aNormalVector)
inline void setVertexNormal(unsigned int anIndex, const VEC3 &aNormalVector)
int getIndex(unsigned int anIndex) const

Accessor on a given index.

Parameters

anIndex – the index of the index to access

Returns

the index

void setIndex(unsigned int anIndex, unsigned int aValue)

Set the value of a given index.

Parameters
  • anIndex – the index of the index to access

  • aValue – the new value of the index

inline VEC3 getFaceNormal(unsigned int anIndex) const

Accessor on a given face normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

inline VEC3 getVertexNormal(unsigned int anIndex) const

Accessor on a given vertex normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

void setExternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setVBOData(const void *aVertexArray, unsigned int aNumberOfVertices, unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO, unsigned int aNumberOfIndices, int anIndexDataType, const void *aIndexArray = NULL, const void *aNormalArray = NULL)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aIndexArray – array containing the index data

  • aNormalArray – array containing the normal data

void setInternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)
void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

inline void applyScale(const RATIONAL_NUMBER &aScale)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters

aScale – scaling factor

void applyScale(const RATIONAL_NUMBER &aScaleX, const RATIONAL_NUMBER &aScaleY, const RATIONAL_NUMBER &aScaleZ)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters
  • aScaleX – scaling factor alng the x-axis

  • aScaleY – scaling factor alng the y-axis

  • aScaleZ – scaling factor alng the z-axis

inline void invertNormalVectors()

Inverse the normal vectors.

virtual void updateVBOs(unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO)

Update the VBOs with VBO already created.

Parameters
  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

inline const Material &getMaterial() const

Accessor on the material of the polygon mesh.

Returns

the material

inline Material &getMaterial()

Accessor on the material of the polygon mesh.

Returns

the material

virtual PolygonMesh operator+(const PolygonMesh &aPolygonMesh) const

operator+.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh operator+(const VEC3 &aTranslationVector) const

operator+.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const PolygonMesh &aPolygonMesh) const

operator-.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const VEC3 &aTranslationVector) const

operator-.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const PolygonMesh &aPolygonMesh)

operator+=.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const VEC3 &aTranslationVector)

operator+=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const PolygonMesh &aPolygonMesh)

operator-=.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const VEC3 &aTranslationVector)

operator-=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

std::map<RATIONAL_NUMBER, VEC3> rayIntersect(const VEC3 &aRayOrigin, const VEC3 &aRayDirection, const MATRIX4 &aTransformationMatrix) const
void getTriangleVertices(VEC3 &v0, VEC3 &v1, VEC3 &v2, unsigned int anIndex) const
inline bool hasNormalVectorsInverted() const

Check if the normal vectors have been inverted.

Returns

true if the normal vectors have been inverted; false otherwise.

Protected Types

enum ToCreate

To know if a bump map or a colour texture has to be created.

Values:

enumerator TO_CREATE_BUMP_MAP
enumerator TO_CREATE_COLOUR_TEXTURE

Protected Functions

virtual void generateTextures()

generates the textures

virtual void defineBumpMapShaderInput(int shader_id)

Link the attributes to their id in the shader bump map generation.

virtual void defineColourTextureShaderInput(int shader_id)

Link the attributes to their id in the shader for colour texture generation

virtual void generate2DTexture(Shader const &shader, unsigned int &frame_buffer, ToCreate to_create)

generates a 2D texture

virtual void generate3DTexture(Shader const &shader, unsigned int &frame_buffer, unsigned int &texture, ToCreate to_create)

generates a 3D texture

virtual void initialize2DBuffer(unsigned int &aTexture, unsigned int &aFrameBuffer)

initialize a 2D frame buffer and bind a texture to it

virtual void initialize3DBuffer(unsigned int &aTexture, unsigned int &aFrameBuffer, bool has_colours)

initialize a 3D frame buffer and bind a texture to its layer 0

virtual void load2DBumpShader()

Load the shader to create the 2D bump map.

virtual void load3DBumpShader()

Load the shader to create the 3D bump map.

virtual void initialize2DTextureCoordinates()

Initialise optimised texture coordinates by sharing an hypothenuse in the texture for two adjacent polygons.

virtual void initialize3DTextureCoordinates()

Initialise 3D texture coordinates.

virtual void shareNormalVectors()

Compute a normal vector per vertex for a smoother display.

virtual void deleteIndices()

delete the indices and calculate new normal vectors

virtual void initGradientTab()

initialize gradient tab for gnoise

virtual void initPermutation()

initialize permutation tab for all noises

inline void computeBoundingBox()

Update the bounding box.

void normaliseNormals()

Normalise the normal vectors.

void destroyVertexData()

Release the memory held by the vertex data if needed.

void destroyIndexData()

Release the memory held by the index data if needed.

void removeIndex(bool aPrintDebugInfoFlag = false)

Remove the index.

void copyVertexSet(const void *apVertexSet)

Copy a vertex set.

void copyIndexSet(const void *apIndexSet)

Copy an index set.

void loadASCIISTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadBinarySTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadSTLDataFromBinaryStream(const char *apInputData, bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • apInputData – the input data to load

  • aMoveToCentreFlag – a flag to move the polygon to the centre or not

  • anAutoComputeNormalFlag – a flag to compute normals or nor

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

Protected Attributes

unsigned int m_colour_texture
unsigned int m_colour_texture_frame_buffer
int m_use_3D_colour_texture
Shader m_colour_texture_shader
std::vector<VEC3> m_gradient_tab
std::vector<int> m_permutation
std::vector<VEC2> m_texture_coordinates_2d
std::vector<VEC3> m_texture_coordinates_3d
std::vector<VEC2> m_margin_direction
unsigned int m_bump_map_texture
unsigned int m_bump_map_frame_buffer
Shader m_bump_map_shader
int m_has_tendon
int m_is_lung
int m_has_thin_bumps
int m_use_3D_bump_map
unsigned int m_texture_size_2d
unsigned int m_texture_size_3d
bool m_need_initialize
bool m_generation_texture_coord_are_set
bool m_optimize_texture_coordinates
int m_use_texture

1 if the mesh use texturing; default value is 0

int m_use_bump_map

1 if the mesh use bump mapping; default value is 0

std::string m_label

A label to determine the type of the mesh.

std::string m_filename

Name of the file that contains the polygon mesh.

RATIONAL_NUMBER m_file_scale

Unit of length of the file that contains the polygon mesh (if negative, then unknown)

std::auto_ptr<VBO> m_p_vbo

Vertex buffer object.

std::auto_ptr<PolygonMesh> m_p_face_normal_vbo
std::auto_ptr<PolygonMesh> m_p_vertex_normal_vbo
PhotonCrossSection m_photon_cross_section

Material properties, with respect to X-ray.

VEC3 m_local_min_corner

Lower corner of the bounding box.

VEC3 m_local_max_corner

Upper corner of the bounding box.

std::vector<RATIONAL_NUMBER> m_p_vertex_normal_set

Array containing the normal vectors (one per triangle)

Array containing the normal vectors (one per vertex)

void *m_p_vertex_set

Array containing the vertices.

void *m_p_index_set

Array containing the index.

unsigned int m_number_of_indices

Number of indices.

unsigned int m_number_of_vertices

Number of vertices.

int m_index_data_type

Data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

int m_vertex_data_type

Data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

int m_polygon_type

Polygon type; valid values are GL_TRIANGLES.

bool m_external_data_flag

A flag set to true if the memory is managed outside of this class instance; set to false if the memory is managed by this class instance

bool m_display_flag

A flag set to true if you want to display in the Xray image

Material m_material

Material of the object.

bool m_has_inverted_normal_vectors

A flag set to true if the normal vectors are inverted.

class SpectrumRecord
#include <SpectrumRecord.h>

SpectrumRecord is a class to handle a record of the X-Ray beam, i.e. an energy bin (number of photons, energy of the photons in the bin).

Public Functions

inline SpectrumRecord(const RATIONAL_NUMBER &aPhotonNumber = 0, const RATIONAL_NUMBER &anIncidentEnergy = 0)

Default constructor.

Parameters
  • aPhotonNumber – number of photons in the bin (default value: 0)

  • anIncidentEnergy – energy of the photons (default value: 0)

inline RATIONAL_NUMBER getPhotonNumber() const

Accessor on the number of photons in the bin.

Returns

the number of photons

inline RATIONAL_NUMBER getPhotonEnergy() const

Accessor on the energy of photons.

Returns

the energy of photons

inline bool operator<(const SpectrumRecord &aRecord) const

operator<.

Returns

true is this->m_energy is lower than aRecord.m_energy

Protected Attributes

RATIONAL_NUMBER m_photon_number

The number of photons.

RATIONAL_NUMBER m_energy

The energy of the photons.

Friends

friend class XRayBeam
friend std::istream &operator>>(std::istream &is, SpectrumRecord &obj)

operator>>

Parameters
  • is – the input stream

  • obj – the record to load from the stream

Returns

the input stream

friend std::ostream &operator<<(std::ostream &os, const SpectrumRecord &obj)

operator<<

Parameters
  • os – the output stream

  • obj – the record to store in the stream

Returns

the output stream

class SphereMesh : public gVirtualXRay::PolygonMesh
#include <SphereMesh.h>

SphereMesh is a class to handle 3D meshes of spheres.

Public Functions

inline SphereMesh(unsigned int aNumberOfRings, unsigned int aNumberOfSectors, float aRadius, int anIndexDataType = 0)

Default constructor.

Parameters
  • aNumberOfRings – the number of rings

  • aNumberOfSectors – the number of sectors

  • aRadius – the radius

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE (default value: 0, i.e. GL_NONE)

inline SphereMesh(unsigned int aNumberOfSubdivision = 0, float aRadius = 0.5 * cm, int anIndexDataType = 0)
void create(unsigned int aNumberOfRings, unsigned int aNumberOfSectors, float aRadius, int anIndexDataType = 0)

Create a new sphere.

Parameters
  • aNumberOfRings – the number of rings

  • aNumberOfSectors – the number of sectors

  • aRadius – the radius

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE (default value: 0, i.e. GL_NONE)

void create(unsigned int aNumberOfSubdivision = 0, float aRadius = 0.5 * cm, int anIndexDataType = 0)
void reset()

Reset the data.

inline void resetVBOs()

Reset the VBOs only.

inline void setDisplayFlag(bool display)

Set if the mesh is displayed or not.

Parameters

display – true or false

inline bool getDisplayFlag() const

Accessor on the display flag of the polygon mesh.

Returns

display flag

void display()

Display the triangular mesh using OpenGL.

void displayWireFrame()

Display the triangular mesh in wireframe using OpenGL.

void displayFaceNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the face normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

void displayVertexNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the vertex normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

inline void setFilename(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFilename(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline const std::string &getFilename() const

Accessor on the name of the file that contains the polygon mesh.

Returns

the file name

inline const RATIONAL_NUMBER &getUnitOfLength() const

Accessor on the unit of length of the mesh.

Returns

the unit of length

void loadSTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void writeSTLFile(bool aBinaryFlag)

Write the STL file.

Parameters

aBinaryFlag – if true, save a binary file; if false save an ASCII file

inline void moveToCentre()

Move the polygon to the centre.

inline void moveToCenter()

Move the polygon to the center.

void computeNormalVectors()

Compute the normal vectors using the cross product method.

inline bool useVBO(int aBufferUsageHing, int aTypeOfPrimitive)

Use a vertex buffer object if possible.

Parameters
  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

Returns

true if the VBO can be used, false otherwise

inline void setHU(short HU)
inline void setHounsfieldUnit(short HU)
inline void setHounsfieldValue(short HU)
inline void setElement(unsigned short Z)
inline void setElement(const std::string &aName)
inline void setMixture(const Mixture &aMixture)
inline void setMixture(const std::map<int, double> &aMixture)
inline void setMixture(const std::map<std::string, double> &aMixture)
inline void setMixture(const std::string &aName)
inline void setCompound(const std::string &aName)
inline void setMassAttenuationCoefficient(double aCoefficient)
inline void setLinearAttenuationCoefficient(double aCoefficient)
inline void setDensity(double aDensity)
inline double getDensity()
inline const std::string &getMaterialLabel() const
inline std::string getCompound() const

Accessor on the compound description of the polygon mesh.

Returns

if the sample is made of a compound, then return the description of the compound (e.g. H2O for water), otherwise return an empty string

inline std::vector<int> getMixtureElementSet() const

Accessor on the element Z number set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element Z number set of the mixture, otherwise return an empty vector

inline std::vector<double> getMixtureWeightSet() const

Accessor on the element weight set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element weight set of the mixture, otherwise return an empty vector

inline const PhotonCrossSection &getPhotonCrossSection() const
inline void setPhotonCrossSection(const PhotonCrossSection &aPhotonCrossSection)
inline const VEC3 &getLocalMinCorner() const

Accessor on the bounding box lower corner.

Returns

the bounding box lower corner

inline const VEC3 &getLocalMaxCorner() const

Accessor on the bounding box upper corner.

Returns

the bounding box upper corner

inline void applyTranslation(const VEC3 &aTranslationVector)

Translate the polygon mesh given a translation vector, and update the VBO if needed.

Parameters

aTranslationVector – the translation vector

inline void applyScaling(RATIONAL_NUMBER x, RATIONAL_NUMBER y, RATIONAL_NUMBER z)

Scale the polygon mesh given scaling factors, and update the VBO if needed.

Parameters
  • x – the scaling factor along the X-axis

  • y – the scaling factor along the Y-axis

  • z – the scaling factor along the Z-axis

inline void applyRotation(const VEC3 &aRotationAxis, RATIONAL_NUMBER aRotationAngleInDegrees)

Rotate the polygon mesh given a rotation axis and angle, and update the VBO if needed.

Parameters
  • aRotationAxis – the rotation axis

  • aRotationAngleInDegrees – the rotation angle in degrees

inline void applyTransform(const MATRIX4 &aTransformationMatrix)

Transform the polygon mesh given a transformation matrix and update the VBO if needed.

Parameters

aTransformationMatrix – the transformation matrix

unsigned int getFaceNumber() const

Accessor on the number of faces.

Returns

the number of faces

unsigned int getTriangleNumber() const

Accessor on the number of triangles.

Returns

the number of triangles

inline unsigned int getFaceNormalNumber() const

Accessor on the number of face normal vectors.

Returns

the number of face normal vectors

inline unsigned int getVertexNormalNumber() const

Accessor on the number of vertex normal vectors.

Returns

the number of vertex normal vectors

inline unsigned int getVertexNumber() const

Accessor on the number of vertices.

Returns

the number of vertices

inline unsigned int getIndexNumber() const

Accessor on the number of indices.

Returns

the number of indices

void mergeVertices(bool aPrintDebugInfoFlag = false)

Merge the vertices of the mesh if the data is managed by the class instance, and if no index has been build.

void splitFaces(bool aPrintDebugInfoFlag = false)

Split each face into four faces.

VEC3 getVertex(unsigned int anIndex) const

Accessor on a given vertex.

Parameters

anIndex – the index of the vertex to access

Returns

the vertex

void setVertex(unsigned int anIndex, const VEC3 &aVertex)

Change the value of a given vertex.

Parameters
  • anIndex – the index of the vertex to access

  • aVertex – the new value of the vertex

inline void setFaceNormal(unsigned int anIndex, const VEC3 &aNormalVector)
inline void setVertexNormal(unsigned int anIndex, const VEC3 &aNormalVector)
int getIndex(unsigned int anIndex) const

Accessor on a given index.

Parameters

anIndex – the index of the index to access

Returns

the index

void setIndex(unsigned int anIndex, unsigned int aValue)

Set the value of a given index.

Parameters
  • anIndex – the index of the index to access

  • aValue – the new value of the index

inline VEC3 getFaceNormal(unsigned int anIndex) const

Accessor on a given face normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

inline VEC3 getVertexNormal(unsigned int anIndex) const

Accessor on a given vertex normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

void setExternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setVBOData(const void *aVertexArray, unsigned int aNumberOfVertices, unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO, unsigned int aNumberOfIndices, int anIndexDataType, const void *aIndexArray = NULL, const void *aNormalArray = NULL)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aIndexArray – array containing the index data

  • aNormalArray – array containing the normal data

void setInternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)
void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

inline void applyScale(const RATIONAL_NUMBER &aScale)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters

aScale – scaling factor

void applyScale(const RATIONAL_NUMBER &aScaleX, const RATIONAL_NUMBER &aScaleY, const RATIONAL_NUMBER &aScaleZ)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters
  • aScaleX – scaling factor alng the x-axis

  • aScaleY – scaling factor alng the y-axis

  • aScaleZ – scaling factor alng the z-axis

inline void invertNormalVectors()

Inverse the normal vectors.

virtual void updateVBO(int aTypeOfVBO, int aTypeOfPrimitive)

Update the VBO.

Parameters
  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

virtual void updateVBOs(unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO)

Update the VBOs with VBO already created.

Parameters
  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

inline const Material &getMaterial() const

Accessor on the material of the polygon mesh.

Returns

the material

inline Material &getMaterial()

Accessor on the material of the polygon mesh.

Returns

the material

void copyFrom(const PolygonMesh &aPolygonMesh)

Copy.

Parameters

aPolygonMesh – the polygon mesh to copy

virtual PolygonMesh operator+(const PolygonMesh &aPolygonMesh) const

operator+.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh operator+(const VEC3 &aTranslationVector) const

operator+.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const PolygonMesh &aPolygonMesh) const

operator-.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const VEC3 &aTranslationVector) const

operator-.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const PolygonMesh &aPolygonMesh)

operator+=.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const VEC3 &aTranslationVector)

operator+=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const PolygonMesh &aPolygonMesh)

operator-=.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const VEC3 &aTranslationVector)

operator-=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

std::map<RATIONAL_NUMBER, VEC3> rayIntersect(const VEC3 &aRayOrigin, const VEC3 &aRayDirection, const MATRIX4 &aTransformationMatrix) const
void getTriangleVertices(VEC3 &v0, VEC3 &v1, VEC3 &v2, unsigned int anIndex) const
inline bool hasNormalVectorsInverted() const

Check if the normal vectors have been inverted.

Returns

true if the normal vectors have been inverted; false otherwise.

Protected Functions

inline void computeBoundingBox()

Update the bounding box.

void normaliseNormals()

Normalise the normal vectors.

void destroyVertexData()

Release the memory held by the vertex data if needed.

void destroyIndexData()

Release the memory held by the index data if needed.

void removeIndex(bool aPrintDebugInfoFlag = false)

Remove the index.

void copyVertexSet(const void *apVertexSet)

Copy a vertex set.

void copyIndexSet(const void *apIndexSet)

Copy an index set.

void loadASCIISTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadBinarySTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadSTLDataFromBinaryStream(const char *apInputData, bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • apInputData – the input data to load

  • aMoveToCentreFlag – a flag to move the polygon to the centre or not

  • anAutoComputeNormalFlag – a flag to compute normals or nor

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

Protected Attributes

std::string m_filename

Name of the file that contains the polygon mesh.

RATIONAL_NUMBER m_file_scale

Unit of length of the file that contains the polygon mesh (if negative, then unknown)

std::auto_ptr<VBO> m_p_vbo

Vertex buffer object.

std::auto_ptr<PolygonMesh> m_p_face_normal_vbo
std::auto_ptr<PolygonMesh> m_p_vertex_normal_vbo
PhotonCrossSection m_photon_cross_section

Material properties, with respect to X-ray.

VEC3 m_local_min_corner

Lower corner of the bounding box.

VEC3 m_local_max_corner

Upper corner of the bounding box.

std::vector<RATIONAL_NUMBER> m_p_vertex_normal_set

Array containing the normal vectors (one per triangle)

Array containing the normal vectors (one per vertex)

void *m_p_vertex_set

Array containing the vertices.

void *m_p_index_set

Array containing the index.

unsigned int m_number_of_indices

Number of indices.

unsigned int m_number_of_vertices

Number of vertices.

int m_index_data_type

Data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

int m_vertex_data_type

Data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

int m_polygon_type

Polygon type; valid values are GL_TRIANGLES.

bool m_external_data_flag

A flag set to true if the memory is managed outside of this class instance; set to false if the memory is managed by this class instance

bool m_display_flag

A flag set to true if you want to display in the Xray image

Material m_material

Material of the object.

bool m_has_inverted_normal_vectors

A flag set to true if the normal vectors are inverted.

Private Functions

void subdivision()

Private Members

float m_radius
template<typename T>
class StepWedgeMesh : public gVirtualXRay::PolygonMesh
#include <StepWedgeMesh.h>

StepWedgeMesh is a class to handle 3D meshes of step wedges.

Public Functions

StepWedgeMesh(unsigned int aNumberOfSteps = 2, T aTotalLength = 10.0 * cm, T aWidth = 1.0 * cm, T aFirstStepHeight = 1.0 * cm, T anOtherStepHeight = 0.1 * cm, int anIndexDataType = 0)

Default constructor.

void create(unsigned int aNumberOfSteps = 2, T aTotalLength = 10.0 * cm, T aWidth = 1.0 * cm, T aFirstStepHeight = 1.0 * cm, T anOtherStepHeight = 0.1 * cm, int anIndexDataType = 0)

Create a new step wedge.

void reset()

Reset the data.

inline void resetVBOs()

Reset the VBOs only.

inline void setDisplayFlag(bool display)

Set if the mesh is displayed or not.

Parameters

display – true or false

inline bool getDisplayFlag() const

Accessor on the display flag of the polygon mesh.

Returns

display flag

void display()

Display the triangular mesh using OpenGL.

void displayWireFrame()

Display the triangular mesh in wireframe using OpenGL.

void displayFaceNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the face normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

void displayVertexNormal(RATIONAL_NUMBER aNormalSize = 0.5 * cm)

Display the vertex normal vectors.

Parameters

aNormalSize – the size of the vectors (default value is 0.5 cm)

inline void setFilename(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFilename(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const char *aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline void setFileName(const std::string &aFilename)

Set the name of the file that contains the polygon mesh.

Parameters

aFilename – the file name

inline const std::string &getFilename() const

Accessor on the name of the file that contains the polygon mesh.

Returns

the file name

inline const RATIONAL_NUMBER &getUnitOfLength() const

Accessor on the unit of length of the mesh.

Returns

the unit of length

void loadSTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void writeSTLFile(bool aBinaryFlag)

Write the STL file.

Parameters

aBinaryFlag – if true, save a binary file; if false save an ASCII file

inline void moveToCentre()

Move the polygon to the centre.

inline void moveToCenter()

Move the polygon to the center.

void computeNormalVectors()

Compute the normal vectors using the cross product method.

inline bool useVBO(int aBufferUsageHing, int aTypeOfPrimitive)

Use a vertex buffer object if possible.

Parameters
  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

Returns

true if the VBO can be used, false otherwise

inline void setHU(short HU)
inline void setHounsfieldUnit(short HU)
inline void setHounsfieldValue(short HU)
inline void setElement(unsigned short Z)
inline void setElement(const std::string &aName)
inline void setMixture(const Mixture &aMixture)
inline void setMixture(const std::map<int, double> &aMixture)
inline void setMixture(const std::map<std::string, double> &aMixture)
inline void setMixture(const std::string &aName)
inline void setCompound(const std::string &aName)
inline void setMassAttenuationCoefficient(double aCoefficient)
inline void setLinearAttenuationCoefficient(double aCoefficient)
inline void setDensity(double aDensity)
inline double getDensity()
inline const std::string &getMaterialLabel() const
inline std::string getCompound() const

Accessor on the compound description of the polygon mesh.

Returns

if the sample is made of a compound, then return the description of the compound (e.g. H2O for water), otherwise return an empty string

inline std::vector<int> getMixtureElementSet() const

Accessor on the element Z number set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element Z number set of the mixture, otherwise return an empty vector

inline std::vector<double> getMixtureWeightSet() const

Accessor on the element weight set of the mixture of the polygon mesh.

Returns

if the sample is made of a mixture, then return the element weight set of the mixture, otherwise return an empty vector

inline const PhotonCrossSection &getPhotonCrossSection() const
inline void setPhotonCrossSection(const PhotonCrossSection &aPhotonCrossSection)
inline const VEC3 &getLocalMinCorner() const

Accessor on the bounding box lower corner.

Returns

the bounding box lower corner

inline const VEC3 &getLocalMaxCorner() const

Accessor on the bounding box upper corner.

Returns

the bounding box upper corner

inline void applyTranslation(const VEC3 &aTranslationVector)

Translate the polygon mesh given a translation vector, and update the VBO if needed.

Parameters

aTranslationVector – the translation vector

inline void applyScaling(RATIONAL_NUMBER x, RATIONAL_NUMBER y, RATIONAL_NUMBER z)

Scale the polygon mesh given scaling factors, and update the VBO if needed.

Parameters
  • x – the scaling factor along the X-axis

  • y – the scaling factor along the Y-axis

  • z – the scaling factor along the Z-axis

inline void applyRotation(const VEC3 &aRotationAxis, RATIONAL_NUMBER aRotationAngleInDegrees)

Rotate the polygon mesh given a rotation axis and angle, and update the VBO if needed.

Parameters
  • aRotationAxis – the rotation axis

  • aRotationAngleInDegrees – the rotation angle in degrees

inline void applyTransform(const MATRIX4 &aTransformationMatrix)

Transform the polygon mesh given a transformation matrix and update the VBO if needed.

Parameters

aTransformationMatrix – the transformation matrix

unsigned int getFaceNumber() const

Accessor on the number of faces.

Returns

the number of faces

unsigned int getTriangleNumber() const

Accessor on the number of triangles.

Returns

the number of triangles

inline unsigned int getFaceNormalNumber() const

Accessor on the number of face normal vectors.

Returns

the number of face normal vectors

inline unsigned int getVertexNormalNumber() const

Accessor on the number of vertex normal vectors.

Returns

the number of vertex normal vectors

inline unsigned int getVertexNumber() const

Accessor on the number of vertices.

Returns

the number of vertices

inline unsigned int getIndexNumber() const

Accessor on the number of indices.

Returns

the number of indices

void mergeVertices(bool aPrintDebugInfoFlag = false)

Merge the vertices of the mesh if the data is managed by the class instance, and if no index has been build.

void splitFaces(bool aPrintDebugInfoFlag = false)

Split each face into four faces.

VEC3 getVertex(unsigned int anIndex) const

Accessor on a given vertex.

Parameters

anIndex – the index of the vertex to access

Returns

the vertex

void setVertex(unsigned int anIndex, const VEC3 &aVertex)

Change the value of a given vertex.

Parameters
  • anIndex – the index of the vertex to access

  • aVertex – the new value of the vertex

inline void setFaceNormal(unsigned int anIndex, const VEC3 &aNormalVector)
inline void setVertexNormal(unsigned int anIndex, const VEC3 &aNormalVector)
int getIndex(unsigned int anIndex) const

Accessor on a given index.

Parameters

anIndex – the index of the index to access

Returns

the index

void setIndex(unsigned int anIndex, unsigned int aValue)

Set the value of a given index.

Parameters
  • anIndex – the index of the index to access

  • aValue – the new value of the index

inline VEC3 getFaceNormal(unsigned int anIndex) const

Accessor on a given face normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

inline VEC3 getVertexNormal(unsigned int anIndex) const

Accessor on a given vertex normal.

Parameters

anIndex – the index of the normal to access

Returns

the normal

void setExternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setExternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will not manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setVBOData(const void *aVertexArray, unsigned int aNumberOfVertices, unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO, unsigned int aNumberOfIndices, int anIndexDataType, const void *aIndexArray = NULL, const void *aNormalArray = NULL)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aIndexArray – array containing the index data

  • aNormalArray – array containing the normal data

void setInternalData(int aTypeOfPrimitive, const void *aVertexArray, unsigned int aNumberOfVertices, int aVertexDataType, const void *anIndexArray, unsigned int aNumberOfIndices, int anIndexDataType, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNumberOfVertices – number of vertices

  • aVertexDataType – data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

  • anIndexArray – array containing the index data

  • aNumberOfIndices – number of indices

  • anIndexDataType – data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)
void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<float> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<float> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned char> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned short> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void setInternalData(int aTypeOfPrimitive, const std::vector<double> *aVertexArray, const std::vector<double> *aNormalArray, const std::vector<unsigned int> *anIndexArray, bool aCreateVBOFlag, int aTypeOfVBO)

Set the polygon mesh using external data. The class instance will manage the memory.

Parameters
  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

  • aVertexArray – array containing the vertex data

  • aNormalArray – array containing the normal data

  • anIndexArray – array containing the index data

  • aCreateVBOFlag – flag set to true to create a VBO, set to false to not set a VBO

  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

inline void applyScale(const RATIONAL_NUMBER &aScale)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters

aScale – scaling factor

void applyScale(const RATIONAL_NUMBER &aScaleX, const RATIONAL_NUMBER &aScaleY, const RATIONAL_NUMBER &aScaleZ)

Apply a scaling factor to the vertex data. Note that the bounding box will be automatically updated.

Parameters
  • aScaleX – scaling factor alng the x-axis

  • aScaleY – scaling factor alng the y-axis

  • aScaleZ – scaling factor alng the z-axis

inline void invertNormalVectors()

Inverse the normal vectors.

virtual void updateVBO(int aTypeOfVBO, int aTypeOfPrimitive)

Update the VBO.

Parameters
  • aTypeOfVBOVBO usage hint to set; valid values are GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

  • aTypeOfPrimitive – type of primitive; valid values are GL_TRIANGLES

virtual void updateVBOs(unsigned int aVertexVBO, unsigned int aNormalVBO, unsigned int aTextureVBO, unsigned int anIndexVBO)

Update the VBOs with VBO already created.

Parameters
  • aVertexVBO – identificator of vbo for vertices

  • aNormalVBO – identificator of vbo for normals

  • aTextureVBO – identificator of vbo for texture coords

  • anIndexVBO – array containing the index data

inline const Material &getMaterial() const

Accessor on the material of the polygon mesh.

Returns

the material

inline Material &getMaterial()

Accessor on the material of the polygon mesh.

Returns

the material

void copyFrom(const PolygonMesh &aPolygonMesh)

Copy.

Parameters

aPolygonMesh – the polygon mesh to copy

virtual PolygonMesh operator+(const PolygonMesh &aPolygonMesh) const

operator+.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh operator+(const VEC3 &aTranslationVector) const

operator+.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const PolygonMesh &aPolygonMesh) const

operator-.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh operator-(const VEC3 &aTranslationVector) const

operator-.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const PolygonMesh &aPolygonMesh)

operator+=.

Parameters

aPolygonMesh – the polygon mesh to add

Returns

the new PolygonMesh

virtual PolygonMesh &operator+=(const VEC3 &aTranslationVector)

operator+=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const PolygonMesh &aPolygonMesh)

operator-=.

Parameters

aPolygonMesh – the polygon mesh to remove

Returns

the new PolygonMesh

virtual PolygonMesh &operator-=(const VEC3 &aTranslationVector)

operator-=.

Parameters

aTranslationVector – the translation vector

Returns

the new PolygonMesh

std::map<RATIONAL_NUMBER, VEC3> rayIntersect(const VEC3 &aRayOrigin, const VEC3 &aRayDirection, const MATRIX4 &aTransformationMatrix) const
void getTriangleVertices(VEC3 &v0, VEC3 &v1, VEC3 &v2, unsigned int anIndex) const
inline bool hasNormalVectorsInverted() const

Check if the normal vectors have been inverted.

Returns

true if the normal vectors have been inverted; false otherwise.

Protected Functions

inline void computeBoundingBox()

Update the bounding box.

void normaliseNormals()

Normalise the normal vectors.

void destroyVertexData()

Release the memory held by the vertex data if needed.

void destroyIndexData()

Release the memory held by the index data if needed.

void removeIndex(bool aPrintDebugInfoFlag = false)

Remove the index.

void copyVertexSet(const void *apVertexSet)

Copy a vertex set.

void copyIndexSet(const void *apIndexSet)

Copy an index set.

void loadASCIISTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadBinarySTLFile(bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • aMoveToCentreFlag – a flag to move the polygon to the center or not

  • anAutoComputeNormalFlag – a flag to compute normals or not

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

void loadSTLDataFromBinaryStream(const char *apInputData, bool aMoveToCentreFlag, bool anAutoComputeNormalFlag, bool aPrintDebugInfoFlag, bool aCreateVBOFlag, RATIONAL_NUMBER aScale, int aBufferUsageHing)

Set the name of the file that contains the polygon mesh.

Parameters
  • apInputData – the input data to load

  • aMoveToCentreFlag – a flag to move the polygon to the centre or not

  • anAutoComputeNormalFlag – a flag to compute normals or nor

  • aPrintDebugInfoFlag – a flag to display additional debug information in the console or not

  • aCreateVBOFlag – a flag to use a vertex buffer object or not

  • aScale – the unit in which data is stored in the file (e.g. mm, cm, m)

  • aBufferUsageHing – the buffer usage hint; valid values are: GL_STATIC_DRAW, GL_DYNAMIC_DRAW and GL_STREAM_DRAW

Protected Attributes

std::string m_filename

Name of the file that contains the polygon mesh.

RATIONAL_NUMBER m_file_scale

Unit of length of the file that contains the polygon mesh (if negative, then unknown)

std::auto_ptr<VBO> m_p_vbo

Vertex buffer object.

std::auto_ptr<PolygonMesh> m_p_face_normal_vbo
std::auto_ptr<PolygonMesh> m_p_vertex_normal_vbo
PhotonCrossSection m_photon_cross_section

Material properties, with respect to X-ray.

VEC3 m_local_min_corner

Lower corner of the bounding box.

VEC3 m_local_max_corner

Upper corner of the bounding box.

std::vector<RATIONAL_NUMBER> m_p_vertex_normal_set

Array containing the normal vectors (one per triangle)

Array containing the normal vectors (one per vertex)

void *m_p_vertex_set

Array containing the vertices.

void *m_p_index_set

Array containing the index.

unsigned int m_number_of_indices

Number of indices.

unsigned int m_number_of_vertices

Number of vertices.

int m_index_data_type

Data type of the index data; valid values are GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE and GL_NONE

int m_vertex_data_type

Data type of the vertex data; valid values are GL_FLOAT, GL_DOUBLE and GL_NONE

int m_polygon_type

Polygon type; valid values are GL_TRIANGLES.

bool m_external_data_flag

A flag set to true if the memory is managed outside of this class instance; set to false if the memory is managed by this class instance

bool m_display_flag

A flag set to true if you want to display in the Xray image

Material m_material

Material of the object.

bool m_has_inverted_normal_vectors

A flag set to true if the normal vectors are inverted.

class StereoHelper
#include <StereoHelper.h>

StereoHelper is a class to handle stereo vision using OpenGL’s quad buffer.

Public Types

enum EyeType

Enum defining eyes.

Values:

enumerator LEFT_EYE
enumerator RIGHT_EYE
enumerator MONO

Public Functions

StereoHelper()

Default constructor.

inline void setIntraocularDistance(double aDistance)

Set the intraocular distance.

Parameters

aDistance – the intraocular distance

inline double getIntraocularDistance() const

Accessor on the intraocular distance.

Returns

the intraocular distance

inline void setScreenAspectRatio(double aRatio)

Set the screen aspect ratio.

Parameters

aRatio – the screen aspect ratio

inline void setFieldOfViewY(double aFOVY)

Set the field of view along the y-axis.

Parameters

aFOVY – the field of view along the y-axis

inline double getFieldOfViewY() const

Accessor on the field of view along the y-axis.

return the field of view along the y-axis

inline void setNear(double aPlane)

Set the near clipping plane.

Parameters

aPlane – the near clipping plane

inline double getNear() const

Accessor on the near clipping plane.

Returns

the near clipping plane

inline void setFar(double aPlane)

Set the far clipping plane.

Parameters

aPlane – the far clipping plane

inline double getFar() const

Accessor on the far clipping plane.

Returns

the far clipping plane

inline void setScreenProjectionPlane(double aPlane)

Set the screen projection plane.

Parameters

aPlane – the screen projection plane

inline const MATRIX4 &getLeftEyeProjectionMatrix()

Accessor on the projection matrix corresponding to the left eye.

Returns

the projection matrix

inline const MATRIX4 &getRightEyeProjectionMatrix()

Accessor on the projection matrix corresponding to the right eye.

Returns

the projection matrix

void swapEye()

Swap eye.

bool enable()

Enable the stereo if possible.

void disable()

Disable the stereo.

inline bool isActive() const

Accessor on the stereo flag.

Protected Functions

void update()

Compute the projection matrices.

Protected Attributes

double m_intraocular_distance

Intraocular distance.

MATRIX4 m_left_eye_projection_matrix

The projection matrix corresponding to the left eye.

MATRIX4 m_right_eye_projection_matrix

The projection matrix corresponding to the right eye.

double m_left_eye_frustum[4]

Frustum of the left eye m_left_eye_frustum[0] corresponds to the left clipping plane m_left_eye_frustum[1] corresponds to the right clipping plane m_left_eye_frustum[2] corresponds to the bottom clipping plane m_left_eye_frustum[3] corresponds to the top clipping plane

double m_right_eye_frustum[4]

Frustum of the right eye m_right_eye_frustum[0] corresponds to the left clipping plane m_right_eye_frustum[1] corresponds to the right clipping plane m_right_eye_frustum[2] corresponds to the bottom clipping plane m_right_eye_frustum[3] corresponds to the top clipping plane

double m_near

Near clipping plane.

double m_far

Far clipping plane.

double m_fovy

Field of view along the y-axis.

double m_screen_aspect_ratio

Screen aspect ratio.

double m_screen_projection_plane

Screen projection plane.

bool m_matrices_are_up_to_date

Flag set to true when the matrices are up-to-date.

EyeType m_current_eye

Current eye type.

bool m_stereo_currently_in_use

Flag set to true when the stereo is in used.

class TextRenderer
#include <TextRenderer.h>

TextRenderer is a class to render text using OpenGL and FreeType2.

Public Functions

inline TextRenderer()

Default constructor.

inline virtual ~TextRenderer()

Destructor.

inline void release()
void initialise(unsigned int aFontSize = 16 * 38)

Initialise the default font.

Parameters

aFontSize – the font size (default value: 16*38)

inline void initialize(unsigned int aFontSize = 16 * 38)

Initialise the default font.

Parameters

aFontSize – the font size (default value: 16*38)

void initialise(const std::string aFontFile, unsigned int aFontSize = 16 * 38)

Initialise the given font.

Parameters
  • aFontFile – the font file

  • aFontSize – the font size (default value: 16*38)

inline void initialize(const std::string aFontFile, unsigned int aFontSize = 16 * 38)

Initialise the given font.

Parameters
  • aFontFile – the font file

  • aFontSize – the font size (default value: 16*38)

void renderText(const std::string &aText, float x, float y, Matrix4x4<GLfloat> &aProjectionMatrix, GLfloat *apBackgroundColour, GLfloat *apFontColour)

Display some text.

Parameters
  • aText – the text to display

  • x – the x-position of the text

  • y – the y-position of the text

  • aProjectionMatrix – the projection matrix

  • apBackgroundColour – the background colour (RGBA)

  • apFontColour – the font colour (RGBA)

inline bool isInitialised() const

Accessor on the initialisation flag.

Returns

true if the text renderer is initialised, false if it is not

Protected Functions

void initialiseInternalStates(unsigned int aFontSize)

Initialise internal states.

Parameters

aFontSize – the font size

Protected Attributes

bool m_initialised

Flag set to true when the fond is initialised.

class TissueMaterial
#include <TissueMaterial.h>

TissueMaterial is a class to manage a material.

Public Functions

inline TissueMaterial(short aMinHUValue = 0, short aMaxHUValue = 0, double H = 0, double C = 0, double N = 0, double O = 0, double Na = 0, double Mg = 0, double P = 0, double S = 0, double Cl = 0, double Ar = 0, double K = 0, double Ca = 0, double Ti = 0, double Cu = 0, double Zn = 0, double Ag = 0, double Sn = 0, double Fe = 0, double I = 0)

Default Constructor.

inline TissueMaterial(const TissueMaterial &aMaterial)

Copy constructor.

inline void clear()

Remove all the atomic elements from the material.

inline const std::map<int, double> &getMassWeightSet() const

Accessor on the mass weight (w_i) of each atomic element.

inline const std::map<int, double> &getElectronWeightSet() const

Accessor on the electron weight (f_i) of each atomic element.

inline short getMinHUValue() const

Accessor on the minimum HU.

inline short getMaxHUValue() const

Accessor on the maximum HU.

inline double getMolarMass() const

Accessor on the molar mass of the material.

inline void setDensity(double aDensity)

Set the density for the mixture regardless of the HU value.

inline double getMassAttenuationTotal(double anEnergy) const

Get the mass attenuation coefficient at a given energy (values are interpolated).

inline double getLinearAttenuationTotal(short aHounsfieldValue, double anEnergy) const

Get the linear attenuation coefficient for a HU value at a given energy (in mm-1) (values are interpolated).

inline double getMu(short aHounsfieldValue, double anEnergy) const

Get the linear attenuation coefficient for a HU value at a given energy (in mm-1) (values are interpolated).

inline double getLinearAttenuationTotal(double anEnergy) const

Get the linear attenuation coefficient of the mixture (regardless of the HU value) at a given energy (values are interpolated). Note that the density must have been set.

inline double getMu(double anEnergy) const

Get the linear attenuation coefficient of the mixture (regardless of the HU value) at a given energy (values are interpolated). Note that the density must have been set.

inline double getS(double x) const

Get the Compton scattering cross section sample (values are interpolated).

inline TissueMaterial &operator=(const TissueMaterial &aMaterial)

Copy operator.

inline bool operator==(const TissueMaterial &aMaterial) const

Operator ==.

inline bool operator!=(const TissueMaterial &aMaterial) const

Operator !=.

Public Static Functions

static double getDensity(short aHounsfieldValue)

Get the density for a given material (in HU).

Protected Functions

void setMixture(const std::map<int, double> &aWeightSet)

Private Members

short m_min_HU_value
short m_max_HU_value
Mixture m_mixture

Friends

friend std::ostream &operator<<(std::ostream &anOutputSream, const TissueMaterial &aTissueMaterial)

operator <<

friend std::istream &operator>>(std::istream &anInputSream, TissueMaterial &aTissueMaterial)

operator <<

class VBO
#include <VBO.h>

VBO is a class to handle a vertex buffer object (VBO).

Subclassed by gVirtualXRay::OpenGL2VBO, gVirtualXRay::OpenGL3VBO

Public Functions

VBO()

Default constructor.

inline virtual ~VBO()

Destructor.

virtual void destroy()

Release the data on the GPU.

void reset()

Reset the data.

virtual void setVertexData(int aPrimitiveType, const unsigned int aNumberOfVertices = 0, unsigned int aNumberOfCompontentsPerVertex = 0, int aVertexDataType = 0, const void *apVertices = 0, const unsigned int aNumberOfNormals = 0, unsigned int aNumberOfCompontentsPerNormal = 0, int aNormalDataType = 0, const void *apNormals = 0, const unsigned int aNumberOfTextureCoordinates = 0, unsigned int aNumberOfCompontentsPerCoord = 0, int aCoordDataType = 0, const void *apTextureCoordinates = 0, const unsigned int aNumberOfAdditionalData = 0, unsigned int aNumberOfCompontentsPerAdditionalData = 0, int anAdditionalDataType = 0, const void *apAdditionalData = 0) = 0

Set the vertex data.

Parameters
  • aPrimitiveType – the primitive type; valid values are: GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP, GL_LINES, GL_LINE_STRIP_ADJACENCY, GL_LINES_ADJACENCY, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES, GL_TRIANGLE_STRIP_ADJACENCY, GL_TRIANGLES_ADJACENCY and GL_PATCHES

  • aNumberOfVertices – number of vertices (default: 0)

  • aNumberOfCompontentsPerVertex – the number of component per vertex (default: 0)

  • aVertexDataType – the data type of vertices; valid values are GL_FLOAT and GL_DOUBLE (default: 0)

  • apVertices – address of the first component of the first vertex (default: 0)

  • aNumberOfNormals – number of normal vectors (default: 0)

  • aNumberOfCompontentsPerNormal – the number of component per normal vector (default: 0)

  • aNormalDataType – the data type of normal vectors; valid values are GL_FLOAT and GL_DOUBLE (default: 0)

  • apNormals – address of the first component of the firth normal vector (default: 0)

  • aNumberOfTextureCoordinates – number of texture coordinates (default: 0)

  • aNumberOfCompontentsPerCoord – the number of component per texture coordinate (default: 0)

  • aCoordDataType – the data type of texture coordinates; valid values are GL_FLOAT and GL_DOUBLE (default: 0)

  • apTextureCoordinates – address of the first component of the first texture coordinate (default: 0)

  • aNumberOfAdditionalData – number of additional data (default: 0)

  • aNumberOfCompontentsPerAdditionalData – the number of component per additional data (default: 0)

  • anAdditionalDataType – the data type of additional data; valid values are GL_FLOAT and GL_DOUBLE (default: 0)

  • apAdditionalData – address of the first component of the first additional data (default: 0)

virtual void setIndexData(const unsigned int aNumberOfIndexes, int anIndexDataType, const void *apIndexSet) = 0

Set the index.

Parameters
  • aNumberOfIndexes – number of indices

  • anIndexDataType – the data type of indices; valid values are GL_UNSGINED_BYTE, GL_UNSGINED_SHORT and GL_UNSGINED_INT

  • apIndexSet – the index set

virtual void display() const = 0

Display the triangular mesh using OpenGL.

inline bool isReady() const

Check if the vertex buffer object is ready.

Returns

true if the VBO is ready to use, false if it is not

inline void setBufferUsageHint(int aFlag)

Set the buffer usage hint. Accepted values are: GL_STATIC_DRAW is for vertex buffers that are rendered many times, and whose contents are specified once and never change. GL_DYNAMIC_DRAW is for vertex buffers that are rendered many times, and whose contents change during the rendering loop. GL_STREAM_DRAW is for vertex buffers that are rendered a small number of times and then discarded.

Parameters

aFlag – the buffer usage hint to set

inline int getBufferUsageHint() const

Accessor on the buffer usage hint.

Returns

the buffer usage hint

inline int getPrimitiveType() const

Accessor on the primitive type.

Returns

the primitive type

inline VBO &operator=(const VBO &aVbo)

Copy operator.

Parameters

aVboVBO to copy

Returns

the new VBO

inline unsigned int getOpenglMajorVersion() const

Accessor on the major version of OpenGL that was used to create the VBO.

Returns

the major version of OpenGL

Protected Attributes

unsigned int m_id_set[5]

ID of VBOs.

unsigned int m_number_of_normals

Number of normal vectors.

unsigned int m_number_of_compontents_per_normal

Number of components per normal.

unsigned int m_number_of_additional_data

Number of additional data.

unsigned int m_number_of_compontents_per_additional_data

Number of components per additional data.

unsigned int m_number_of_texture_coordinates

Number of texture coordinates.

unsigned int m_number_of_compontents_per_texture_coord

Number of components per texture coordinate.

unsigned int m_number_of_vertices

Number of vertices.

unsigned int m_number_of_compontents_per_vertex

Number of components per vertex.

unsigned int m_number_of_indices

Number of indices.

unsigned int m_normal_size

Size in bytes of the array of normal vectors.

unsigned int m_additional_data_size

Size in bytes of the array of additional data.

unsigned int m_texture_coordinate_size

Size in bytes of the array of texture coordinates.

unsigned int m_vertex_size

Size in bytes of the array of vertices.

unsigned int m_index_size

Size in bytes of the array of indices.

int m_normal_data_type

Data type of normal vectors; valid values are GL_FLOAT and GL_DOUBLE.

int m_additional_data_type

Data type of additional data; valid values are GL_FLOAT and GL_DOUBLE.

int m_texture_coordinate_data_type

Data type of texture coordinates; valid values are GL_FLOAT and GL_DOUBLE

int m_vertex_data_type

Data type of vertices; valid values are GL_FLOAT and GL_DOUBLE.

int m_index_data_type

Data type of indices; valid values are GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT and GL_UNSIGNED_INT

int m_primitive_type

Type of primitive to draw; valid values are GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP, GL_LINES, GL_LINE_STRIP_ADJACENCY, GL_LINES_ADJACENCY, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES, GL_TRIANGLE_STRIP_ADJACENCY, GL_TRIANGLES_ADJACENCY and GL_PATCHES

int m_storage_type

The buffer usage hint; valid values are GL_DYNAMIC_DRAW, GL_STATIC_DRAW and GL_STREAM_DRAW

unsigned int m_opengl_major_version

The major number of the OpenGL version used to create the VBO. 2 or 3 are supported. We do not distinguish at this level between 3 and 4.

template<typename T>
class Vec2
#include <Vec2.h>

Vec2 is a template class to handle a 2D vector.

Public Functions

Vec2(const T &aX = 0.0f, const T &aY = 0.0f)

Default Constructor.

Parameters
  • aX – the position along the x-axis

  • aY – the position along the y-axis

void setX(const T &aValue)

Set the position along the x-axis.

Parameters

aValue – the position along the x-axis

void setY(const T &aValue)

Set the position along the y-axis.

Parameters

aValue – the position along the y-axis

T getX() const

Accessor on the position along the x-axis.

Returns

the position along the x-axis

T getY() const

Accessor on the position along the y-axis.

Returns

the position along the y-axis

double length() const

Get the length of the vector.

Returns

the length of the vector

Vec2 normal() const

Get the unit vector corresponding to the normed current vector.

Returns

the unit vector

void normalize()

Normalize the current vector so that its length is 1.

void normalise()

Normalise the current vector so that its length is 1.

double dotProduct(const Vec2 &aVector) const

Get the dot product between the current vector and a given vector.

Parameters

aVector – the other vector

Returns

the dot product

double distance(const Vec2 &aVector) const

Get the distance between the 2D position represented by the current vector and another position.

Parameters

aVector – the other vector

Returns

the distance

const Vec2 operator+(const Vec2 &aVector) const

Operator +.

Parameters

aVector – the other vector

Returns

the modified vector

Vec2 &operator+=(const Vec2 &aVector)

Operator +=.

Parameters

aVector – the other vector

Returns

the modified vector

const Vec2 operator-(const Vec2 &aVector) const

Operator -.

Parameters

aVector – the other vector

Returns

the modified vector

Vec2 &operator-=(const Vec2 &aVector)

Operator -=.

Parameters

aVector – the other vector

Returns

the modified vector

const Vec2 operator*(const double &aValue) const

Operator * to multiply each component of the vector by a given value.

Parameters

aValue – the multiplicative value

Returns

the modified vector

Vec2 &operator*=(const double &aValue)

Operator *= to multiply each component of the vector by a given value, and modify the current vector.

Parameters

aValue – the multiplicative value

Returns

the modified vector

const Vec2 operator*(const float &aValue) const

Operator * to multiply each component of the vector by a given value.

Parameters

aValue – the multiplicative value

Returns

the modified vector

Vec2 &operator*=(const float &aValue)

Operator *= to multiply each component of the vector by a given value, and modify the current vector.

Parameters

aValue – the multiplicative value

Returns

the modified vector

const Vec2 operator/(const double &aValue) const

Operator / to divide each component of the vector by a given value.

Parameters

aValue – the value

Returns

the modified vector

Vec2 &operator/=(const double &aValue)

Operator /= to divide each component of the vector by a given value, and modify the current vector.

Parameters

aValue – the value

Returns

the modified vector

const Vec2 operator/(const float &aValue) const

Operator / to divide each component of the vector by a given value.

Parameters

aValue – the value

Returns

the modified vector

Vec2 &operator/=(const float &aValue)

Operator /= to divide each component of the vector by a given value, and modify the current vector.

Parameters

aValue – the value

Returns

the modified vector

const Vec2 operator-() const

Operator - to get the opposite vector.

Returns

the opposite vector

T &operator()(unsigned int i)
const T &operator()(unsigned int i) const
T &operator[](unsigned int i)
const T &operator[](unsigned int i) const

Protected Attributes

T m_x

the position along the x-axis

T m_y

the position along the y-axi

template<typename T>
class Vec3
#include <Vec3.h>

Vec3 is a template class to handle a 3D vector.

Public Functions

Vec3(const T &aX = 0, const T &aY = 0, const T &aZ = 0)

Default Constructor.

Parameters
  • aX – the position along the x-axis (default value is 0)

  • aY – the position along the y-axis (default value is 0)

  • aZ – the position along the z-axis (default value is 0)

void setX(const T &aValue)

Set the position along the x-axis.

Parameters

aValue – the position along the x-axis

void setY(const T &aValue)

Set the position along the y-axis.

Parameters

aValue – the position along the y-axis

void setZ(const T &aValue)

Set the position along the z-axis.

Parameters

aValue – the position along the z-axis

T getX() const

Accessor on the position along the x-axis.

Returns

the position along the x-axis

T getY() const

Accessor on the position along the y-axis.

Returns

the position along the y-axis

T getZ() const

Accessor on the position along the z-axis.

Returns

the position along the z-axis

double length() const

Get the length of the vector.

Returns

the length of the vector

Vec3 normal() const

Get the unit vector corresponding to the normed current vector.

Returns

the unit vector

void normalize()

Normalize the current vector so that its length is 1.

void normalise()

Normalise the current vector so that its length is 1.

double dotProduct(const Vec3 &aVector) const

Get the dot product between the current vector and a given vector.

Parameters

aVector – the other vector

Returns

the dot product

Vec3 crossProduct(const Vec3 &aVector) const

Cross product between the current vector and a given vector.

Parameters

aVector – the other vector

Returns

the cross product

double distance(const Vec3 &aVector) const

Get the distance between the 3D position represented by the current vector and another position.

Parameters

aVector – the other vector

Returns

the distance

Vec3<T> elementWiseProduct(const Vec3 &aVector) const

Element-wise product.

Operator * to compute the dot product between the current vector and a given vector.

Parameters
  • aVector – the other vector

  • aVector – the other vector

Returns

the dot product

Returns

the new vector resulting of the element-wise product

Vec3 operator+(const Vec3 &aVector) const

Operator +.

Parameters

aVector – the other vector

Returns

the dot product

Vec3 &operator+=(const Vec3 &aVector)

Operator +=.

Parameters

aVector – the other vector

Returns

the modified vector

Vec3 operator-(const Vec3 &aVector) const

Operator -.

Parameters

aVector – the other vector

Returns

the modified vector

Vec3 &operator-=(const Vec3 &aVector)

Operator -=.

Parameters

aVector – the other vector

Returns

the modified vector

Vec3 operator*(const double &aValue) const

Operator * to multiply each component of the vector by a given value.

Parameters

aValue – the multiplicative value

Returns

the modified vector

Vec3 &operator*=(const double &aValue)

Operator *= to multiply each component of the vector by a given value, and modify the current vector.

Parameters

aValue – the multiplicative value

Returns

the modified vector

Vec3 operator*(const float &aValue) const

Operator * to multiply each component of the vector by a given value.

Parameters

aValue – the multiplicative value

Returns

the modified vector

Vec3 &operator*=(const float &aValue)

Operator *= to multiply each component of the vector by a given value, and modify the current vector.

Parameters

aValue – the multiplicative value

Returns

the modified vector

Vec3 operator/(const double &aValue) const

Operator / to divide each component of the vector by a given value.

Parameters

aValue – the value

Returns

the modified vector

Vec3 &operator/=(const double &aValue)

Operator -=.

Parameters

aValue – the other vector

Returns

the modified vector

Vec3 operator/(const float &aValue) const

Operator / to divide each component of the vector by a given value.

Parameters

aValue – the value

Returns

the modified vector

Vec3 &operator/=(const float &aValue)

Operator -=.

Parameters

aValue – the other vector

Returns

the modified vector

Vec3 operator^(const Vec3 &aVector) const

Operator ^ to compute the cross product between the current vector and a given vector.

Parameters

aVector – the other vector

Returns

the cross product

Vec3 operator-() const

Operator - to get the opposite vector.

Returns

the opposite vector

bool operator==(const Vec3 &aVector) const

Operator ==.

Parameters

aVector – the vector to compare the current vector with

Returns

true if the two vectors are the same, false if the two vectors are different

bool operator!=(const Vec3 &aVector) const

Operator !=.

Parameters

aVector – the vector to compare the current vector with

Returns

true if the two vectors are different, false if the two vectors are the same

T &operator()(unsigned int i)
const T &operator()(unsigned int i) const
T &operator[](unsigned int i)
const T &operator[](unsigned int i) const

Protected Attributes

T m_x

the position along the x-axis

T m_y

the position along the y-axi

T m_z

the position along the z-axi

class XRayBeam
#include <XRayBeam.h>

XRayBeam is a class to handle the X-Ray beam. The beam spectrum is discretised into energy channels.

Public Functions

inline XRayBeam()

Default constructor.

inline ~XRayBeam()

Destructor.

inline void clear()

Remove all the energy channels from the beam and all its parameters.

inline void clearSpectrumOnly()

Remove all the energy channels from the beam.

inline bool addChannel(const RATIONAL_NUMBER &aNumberOfPhotons, const RATIONAL_NUMBER &anIncidentEnergy)

Add an energy channel to the beam.

Parameters
  • aNumberOfPhotons – the number of photons in this energy channel per pixel at SDD

  • anIncidentEnergy – the energy of the photons in this energy channel

Returns

true if the channel was added, i.e. if aNumberOfPhotons * anIncidentEnergy >= m_bin_total_energy_lower_threshold, false otherwise

inline bool addChannelPerPixelAtSDD(const RATIONAL_NUMBER &aNumberOfPhotons, const RATIONAL_NUMBER &anIncidentEnergy)

Add an energy channel to the beam.

Parameters
  • aNumberOfPhotons – the number of photons in this energy channel per pixel at SDD

  • anIncidentEnergy – the energy of the photons in this energy channel

Returns

true if the channel was added, i.e. if aNumberOfPhotons * anIncidentEnergy >= m_bin_total_energy_lower_threshold, false otherwise

inline bool addChannelPerCm2At1m(const RATIONAL_NUMBER &aNumberOfPhotons, const RATIONAL_NUMBER &anIncidentEnergy)

Add an energy channel to the beam.

Parameters
  • aNumberOfPhotons – the number of photons in this energy channel per cm2 at 1m

  • anIncidentEnergy – the energy of the photons in this energy channel

Returns

true if the channel was added, i.e. if aNumberOfPhotons * anIncidentEnergy >= m_bin_total_energy_lower_threshold, false otherwise

void initialise(const char *aFileName, const RATIONAL_NUMBER &aUnit, unsigned int aMergeChannelFlag = 1)

Initialise the X-ray beam specturm with a polychromatic spectrum.

Parameters
  • aFileName – name of the file that stores the spectrum

  • aUnit – unit in which the data is stored, e.g. meV, eV, keV, or MeV

  • aMergeChannelFlag – the number of records to store in a single bin (default value: 1)

void initialisePerPixelAtSDD(const char *aFileName, const RATIONAL_NUMBER &aUnit, unsigned int aMergeChannelFlag = 1)

Initialise the X-ray beam specturm with a polychromatic spectrum. The number of photons is given per pixel at the source-detector distance.

Parameters
  • aFileName – name of the file that stores the spectrum

  • aUnit – unit in which the data is stored, e.g. meV, eV, keV, or MeV

  • aMergeChannelFlag – the number of records to store in a single bin (default value: 1)

void initialisePerCm2At1m(const char *aFileName, const RATIONAL_NUMBER &aUnit, unsigned int aMergeChannelFlag = 1)

Initialise the X-ray beam specturm with a polychromatic spectrum. The number of photons is given per cm2 at 1m.

Parameters
  • aFileName – name of the file that stores the spectrum

  • aUnit – unit in which the data is stored, e.g. meV, eV, keV, or MeV

  • aMergeChannelFlag – the number of records to store in a single bin (default value: 1)

inline void initialise(const RATIONAL_NUMBER &anIncidentEnergy)

Initialise the X-ray beam specturm with a monochromatic spectrum.

Parameters

anIncidentEnergy – the energy of these photons

void normalise()

Normalise the number of photons so that the total incident energy is 1.0.

inline void setBinTotalEnergyCutoff(const RATIONAL_NUMBER &aThreshold)

Set a threshold to discard energy bins with a tiny amount of energy.

Parameters

aThreshold – the threshold

inline unsigned int getEnergyChannelNumber()

Accessor on the number of bins in the spectrum.

Returns

the number of energy bins in the spectrum

inline std::vector<double> getEnergySet() const

Accessor on the energy of bins in the spectrum.

Returns

the energy of bins in the spectrum

inline SpectrumRecord getEnergyChannel(unsigned int anID, const XRayDetector *apDetector = nullptr, bool anApplyFiltrationFlag = true)

Accessor on a given energy bin.

Parameters
  • anID – the ID of the bin

  • apDetector – the detector to retrieve the pixel pitch and the source-detector distance if needed (default value: nullptr)

Returns

the energy bin

inline SpectrumRecord getEnergyChannelPerPixelAtSDD(unsigned int anID, const XRayDetector *apDetector, bool anApplyFiltrationFlag)

Accessor on a given energy bin.

Parameters
  • anID – the ID of the bin

  • apDetector – the detector to retrieve the pixel pitch and the source-detector distance if needed

Returns

the energy bin

inline SpectrumRecord getEnergyChannelPerCm2At1m(unsigned int anID, const XRayDetector *apDetector, bool anApplyFiltrationFlag)

Accessor on a given energy bin.

Parameters
  • anID – the ID of the bin

  • apDetector – the detector to retrieve the pixel pitch and the source-detector distance if needed

Returns

the energy bin

inline RATIONAL_NUMBER getTotalEnergy()

Accessor on a total energy of the beam.

Returns

the total energy

inline void setLambdaCutoff(const RATIONAL_NUMBER &aLambdaCutoff)

Set the value of lambda in a Poisson distribution where a Gaussian distribution is a good enough approximation of the Poisson distribution the number of photons to add the Poisson noise.

Parameters

aCutoffValue – the cutoff value of lambda.

inline const RATIONAL_NUMBER &getLambdaCutoff() const

Accessor on the value of lambda in a Poisson distribution where a Gaussian distribution is a good enough approximation of the Poisson distribution the number of photons to add the Poisson noise.

Returns

the cutoff value of lambda.

inline void enablePoissonNoise()

Enable Poisson noise for the energy fluence.

inline void disablePoissonNoise()

Disable Poisson noise for the energy fluence.

inline void setNumberOfPhotons(RATIONAL_NUMBER aNumberOfPhotons, bool anApplyFiltrationFlag)

Set the total number of photons per pixel when Poisson noise is enable.

Parameters

aNumberOfPhotons – the number of photons

inline void setNumberOfPhotonsPerPixelAtSDD(RATIONAL_NUMBER aNumberOfPhotons, bool anApplyFiltrationFlag)

Set the total number of photons per pixel when Poisson noise is enable.

Parameters

aNumberOfPhotons – the number of photons

inline void setNumberOfPhotonsPerCm2At1m(RATIONAL_NUMBER aNumberOfPhotons, bool anApplyFiltrationFlag)

Set the total number of photons per cm2 at 1m when Poisson noise is enable.

Parameters

aNumberOfPhotons – the number of photons

inline RATIONAL_NUMBER getNumberOfPhotons(const XRayDetector *apDetector = nullptr, bool anApplyFiltrationFlag = true)

Accessor on the total number of photons per pixel when Poisson noise is enable.

Parameters
  • apDetector – the detector to retrieve the pixel pitch and the source-detector distance if needed (default value: nullptr)

  • anApplyFiltrationFlag – true if the number of photons apply to the filtered spectrum; false if the number of photons apply to the unfiltered spectrum (default value = true)

Returns

the number of photons

inline RATIONAL_NUMBER getNumberOfPhotonsPerPixelAtSDD(const XRayDetector *apDetector, bool anApplyFiltrationFlag)

Accessor on the total number of photons per pixel when Poisson noise is enable.

Parameters
  • apDetector – the detector to retrieve the pixel pitch and the source-detector distance if needed

  • anApplyFiltrationFlag – true if the number of photons apply to the filtered spectrum; false if the number of photons apply to the unfiltered spectrum

Returns

the number of photons

inline RATIONAL_NUMBER getNumberOfPhotonsPerCm2At1m(const XRayDetector *apDetector, bool anApplyFiltrationFlag)

Accessor on the total number of photons per cm2 at 1m when Poisson noise is enable.

Parameters
  • apDetector – the detector to retrieve the pixel pitch and the source-detector distance if needed

  • anApplyFiltrationFlag – true if the number of photons apply to the filtered spectrum; false if the number of photons apply to the unfiltered spectrum

Returns

the number of photons

inline void usePoissonNoise(bool aFlag)

Enable or disable Poisson noise for the energy fluence.

Parameters

aFlag – if true, then enable Poisson noise. If false, then disable it

inline bool usePoissonNoise() const

Check if Poisson noise for the energy fluence is enable or disable.

Returns

true if Poisson noise is enable, or false if Poisson noise is disable

inline void sort()

Sort the spectrum in ascending energy.

void setPhotonCountingBands(RATIONAL_NUMBER aMinEnergy, RATIONAL_NUMBER aMaxEnergy, size_t aNumberOfBands)
inline size_t getNumberOfPhotonCountingBands()
inline void activatePhotonCountingBand(unsigned int aBand)
void mergePhotonCountingBands()
inline const std::vector<RATIONAL_NUMBER> &getPhotonCountingBands()
inline void setVoltage(const RATIONAL_NUMBER &aVoltage)
inline void addInherentFilter(unsigned int aMaterial, const RATIONAL_NUMBER &aThickness)
inline void clearInherentFiltration()
inline void setmAs(const RATIONAL_NUMBER &an_mAs)
inline void setTubeAngle(const RATIONAL_NUMBER &anAngle)
inline RATIONAL_NUMBER getVoltage() const
inline const std::vector<std::pair<unsigned int, RATIONAL_NUMBER>> &getInherentFiltration() const
RATIONAL_NUMBER getInherentFilterThickness() const
inline RATIONAL_NUMBER getmAs() const
inline RATIONAL_NUMBER getTubeAngle() const
inline void setFirstEnergyBin(const float &aFirstEnergyBin)

Set the energy of the first energy bin in the unfiltered spectrum. This function only has an effect for X-ray tube spectra generated with setVoltage.

Parameters

aFirstEnergyBin – the energy of the first energy bin in the unfiltered spectrum

inline void setEnergyBinSize(const float &anEnergyBinSize)

Set the size of an energy bin in the unfiltered spectrum. This function only has an effect for X-ray tube spectra generated with setVoltage.

Parameters

anEnergyBinSize – the size of an energy bin in the unfiltered spectrum

inline float getEnergyBinSize() const

Accessor on the size of an energy bin in the unfiltered spectrum. This function is only relevant for X-ray tube spectra generated with setVoltage.

inline void clearFiltration()
inline void setFiltration(const std::vector<std::pair<unsigned int, RATIONAL_NUMBER>> &aSetOfFilters)
inline void addFilter(const std::string &aMaterial, const double &aThickness)
inline void addFilter(unsigned int aMaterial, const double &aThickness)
inline const std::vector<std::pair<unsigned int, RATIONAL_NUMBER>> &getFiltration() const

Protected Types

enum PhotonCountType

Values:

enumerator PER_PIXEL_AT_SDD
enumerator PER_CM2_AT_1M
enumerator UNKNOWN

Protected Functions

void generateTubeSpectrum()
void loadSpectrumFromFile(const char *aFileName, const RATIONAL_NUMBER &aUnit, unsigned int aMergeChannelFlag, PhotonCountType aPhotonCountType = PhotonCountType::UNKNOWN)

Initialise the X-ray beam specturm with a polychromatic spectrum.

Parameters
  • aFileName – name of the file that stores the spectrum

  • aUnit – unit in which the data is stored, e.g. meV, eV, keV, or MeV

  • aMergeChannelFlag – the number of records to store in a single bin

  • aPhotonCountType – number of photons per pixels at SDD, number of photons per cm2 at 1m, or unknown (default value: unknown)

void applyFiltrationOnSpectrum()
inline int getBinID(const std::vector<SpectrumRecord> &aBeamSpectrum, unsigned int anID)
RATIONAL_NUMBER applyFiltration(const RATIONAL_NUMBER &anEnergy, const RATIONAL_NUMBER &aNumberOfPhoton)

Protected Attributes

std::vector<SpectrumRecord> m_unfiltered_beam_spectrum

Set of photon bins with no filter applied.

std::vector<SpectrumRecord> m_current_beam_spectrum

Set of photon bins with filters applied.

RATIONAL_NUMBER m_bin_total_energy_lower_threshold

All bins with a total energy below m_bin_total_energy_lower_threshold will be ignored

bool m_use_poisson_noise
RATIONAL_NUMBER m_lambda_cutoff
PhotonCountType m_photon_count_type
std::vector<std::vector<SpectrumRecord>> m_beam_spectrum_for_photon_count_detector

Set of photon bins.

std::vector<RATIONAL_NUMBER> m_photon_count_bands
RATIONAL_NUMBER m_voltage
RATIONAL_NUMBER m_tube_angle_in_degrees
RATIONAL_NUMBER m_mAs
std::vector<std::pair<unsigned int, RATIONAL_NUMBER>> m_filtration
std::shared_ptr<xsec> m_p_xsec
std::vector<std::pair<unsigned int, RATIONAL_NUMBER>> m_inherent_filtration
RATIONAL_NUMBER m_first_energy_bin
RATIONAL_NUMBER m_size_energy_bin
class XRayDetector
#include <XRayDetector.h>

XRayDetector is a class to handle a X-ray detector.

Public Types

enum SourceShape

SourceShape is a type that defines the shape of X-ray sources.

Values:

enumerator POINT

Infinitively small point source.

enumerator SQUARE

Source whose shape corresponds to a square.

enumerator RECTANGLE

Source whose shape corresponds to a rectangle.

enumerator CUBE

Source whose shape corresponds to a cube.

enumerator LINE

Source whose shape corresponds to a line segment.

enumerator PARALLEL

Parallel source, i.e. a point source infinitely far away

enumerator UNKNOWN_SHAPE

Unknown type.

Public Functions

inline XRayDetector()

Default constructor.

inline ~XRayDetector()

Destructor.

inline void release()

Release the data.

void displayDetector()

Display the detector using OpenGL.

inline void setWidgetLength(const RATIONAL_NUMBER &aLength)
inline void displaySource()

Display the source using OpenGL.

inline void displaySourceWireframe()

Display the source using OpenGL.

void displayBeam()

Display the beam using OpenGL.

void displayFirstPixelPosition()

Display a sphere on the position of the first pixel of the image using OpenGL.

void displayDetectorPosition()

Display a sphere on the position of the centre of the detecotr using OpenGL.

inline void setResolutionInUnitsOfLengthPerPixel(const RATIONAL_NUMBER &aResolution)

Set the pixel resolution (in units of length per pixel, i.e. the inverse of the pixel size)

Parameters

aResolution – the pixel resolution

inline void setResolutionInUnitsOfLengthPerPixel(const VEC2 &aResolution)

Set the pixel resolution (in units of length per pixel, i.e. the inverse of the pixel size)

Parameters

aResolution – the pixel resolution

inline void setNumberOfPixels(const Vec2ui &aSizeInPixels)

Set the number of pixels.

Parameters

aSizeInPixels – the number of pixels

inline void setDetectorPosition(const VEC3 &aDetectorPosition)

Set the position of the X-ray detector.

Parameters

aDetectorPosition – the position of the X-ray detector

inline void setXrayPointSource(const VEC3 &aXraySourcePosition)

Set the position of the X-ray source.

Parameters

aXraySourcePosition – the position of the X-ray source

void setCubicSource(const VEC3 &aXraySourcePosition, unsigned int aNumberOfSamplesAlongOneDirection, RATIONAL_NUMBER aLength)

Set the shape of the source as a cube.

Parameters
  • aXraySourcePosition – the position of the centre of the source

  • aNumberOfSamplesAlongOneDirection – the number of point sources along one axis (in total there will be aNumberOfSamplesAlongOneDirection^3 point sources in the cube)

  • aLength – the length of the cube

void setSquareSource(const VEC3 &aXraySourcePosition, unsigned int aNumberOfSamplesAlongOneDirection, RATIONAL_NUMBER aLength)

Set the shape of the source as a square (in total there will be aNumberOfSamplesAlongOneDirection^2 point sources in the square).

Parameters
  • aXraySourcePosition – the position of the centre of the source

  • aNumberOfSamplesAlongOneDirection – the number of point sources along one axis

  • aLength – the length of the square

void setRectangleSource(const VEC3 &aXraySourcePosition, unsigned int aNumberOfSamplesAlongLength, unsigned int aNumberOfSamplesAlongHeight, RATIONAL_NUMBER aLongitudinalLength, RATIONAL_NUMBER aHeight)

Set the shape of the source as a rectangle (in total there will be aNumberOfSamplesAlongLength * aNumberOfSamplesAlongHeight point sources in the rectangle).

Parameters
  • aXraySourcePosition – the position of the centre of the source

  • aNumberOfSamplesAlongLength – the number of point sources along the axis defined by the cross product between the source-detector centres and the detector up-vector.

  • aNumberOfSamplesAlongHeight – the number of point sources along the detector up-vector direction.

  • aLongitudinalLength – the length of the rectangle along the axis defined by the cross product between the source-detector centres and the detector up-vector.

  • aHeight – the height of the source along the detector up-vector direction.

void setLineSource(const VEC3 &aXraySourcePosition, const VEC3 &aDirection, unsigned int aNumberOfSamplesAlongOneDirection, RATIONAL_NUMBER aLength)

Set the shape of the source as a line segment.

Parameters
  • aXraySourcePosition – the position of the centre of the source

  • aDirection – the direction vector of the line

  • aNumberOfSamplesAlongOneDirection – the number of point sources

  • aLength – the length of the line

inline void setXrayPointSource()

Set the shape of the source as an infinitely small point.

inline void setCubicSource()

Set the shape of the source as a cube.

inline void setSquareSource()

Set the shape of the source as a square.

inline void setRectangleSource()

Set the shape of the source as a rectangle.

inline void setLineSource()

Set the shape of the source as a line segment.

inline void setUpVector(const VEC3 &anUpVector)

Set the up vector that defines the detector’s orientation.

Parameters

anUpVector – the up vector

inline void setRightVector(const VEC3 &aRightVector)

Set the right vector that defines the detector’s orientation.

Parameters

aRightVector – the right vector

inline void autoAlignDetector(bool aFlag = true)
inline void rotateDetector(const RATIONAL_NUMBER &anAngle, const VEC3 &aRotationAxis)
inline void setRotationMatrix(const MATRIX4 &aMatrix)

Set the rotation matrix.

Parameters

aMatrix – the rotation matrix

inline void setParallelBeam()

Set the projection mode to parallel beam.

inline void setConeBeam()

Set the projection mode to cone beam (same as point source).

inline void setPointSource()

Set the projection mode to point source (same as cone beam).

inline const Vec2ui &getNumberOfPixels() const

Accessor on the number of pixels.

Returns

the number of pixels

inline const VEC2 &getSizeInUnitOfLength() const

Accessor on the size of the detector (in unit of length).

Returns

the size of the detector

inline const VEC2 &getPixelSpacingInUnitOfLength() const

Accessor on the pixel spacing (in unit of length).

Returns

the pixel spacing

inline const VEC3 &getDetectorPosition() const

Accessor on the detector position.

Returns

the detector position

inline const VEC3 &getXraySourceCentre() const

Accessor on the centre of the source.

Returns

the source position

inline unsigned int getNumberOfSourceSamples() const
inline const VEC3 &getSourceSamplePosition(unsigned int aSampleID) const
inline const VEC3 &getUpVector() const

Accessor on the up vector, which defines the orientation of the detector.

Returns

the up vector

inline const MATRIX4 &getRotationMatrix() const

Accessor on the rotation matrix.

Returns

the rotation matrix

const VEC3 &getNormal() const

Accessor on the vector normal to the detector.

inline const VEC3 &getRightVector() const

Accessor on the cross product between m_look_at_vector and m_up_vector.

Returns

the cross product

inline void getPlaneEquation(RATIONAL_NUMBER &A, RATIONAL_NUMBER &B, RATIONAL_NUMBER &C, RATIONAL_NUMBER &D)

Accessor on the plane equation (Ax + By + Cz + D = 0).

Parameters
  • A – the 1st component of the plane equation

  • B – the 2nd component of the plane equation

  • C – the 3rd component of the plane equation

  • D – the 4th component of the plane equation

inline const std::vector<float> &getVertices() const

Accessor on the four corners of the X-ray detector.

Returns

the corresponding vertices

inline SourceShape getSourceShape() const

Accessor on the shape of the source.

Returns

true if a parallel beam is used (e.g. orthographic projection), false if perspective projection is used

inline const std::vector<VEC3> &getSourcePositionSet() const
inline void setSourcePositions(const std::vector<VEC3> &aSourcePostionSet)
inline void rotateFocalSpot(const RATIONAL_NUMBER &aRotationAngle, const VEC3 &aRotationAxis)

Rotate the focal spot around its centre.

Parameters
  • aRotationAngle – the rotation angle in degrees

  • aRotationAxis – the rotaton axis

inline void rotateSource(const RATIONAL_NUMBER &aRotationAngle, const VEC3 &aRotationCentre, const VEC3 &aRotationAxis)

Rotate the source around and arbitrary point.

Parameters
  • aRotationAngle – the rotation angle in degrees

  • aRotationCentre – the rotaton centre

  • aRotationAxis – the rotaton axis

inline bool useParallelBeam() const

Accessor on the flag about projection.

Returns

true if a parallel beam is used (e.g. orthographic projection), false if perspective projection is used

inline const RATIONAL_NUMBER &getFOVY() const

Accessor on the view along the Y-axis.

Returns

the view along the Y-axis

inline const VEC2 &getPixelSizeInUnitOfLength() const
inline void clearEnergyResponse()

Clear the energy response of the detector.

inline void loadEnergyResponse(const std::string &aFileName, const RATIONAL_NUMBER &aUnitOfEnergy)

Load the energy response of the detector from a TSV file.

Parameters
  • aFileName – name of the file. Each line of the file is formatted as follows: input_energy output_energy

  • aUnitOfEnergy – the unit of energy corresponding to the data in the file

inline void setEnergyResponse(const std::vector<std::pair<float, float>> &anEnergyResponse)
inline void setEnergyResponse(const std::vector<std::pair<double, double>> &anEnergyResponse)
inline void setScintillator(const Scintillator &aScintillator)
inline void setScintillator(const std::string &aMaterial, const float &aThickness)
inline const std::string &getScintillatorMaterial()
inline double getScintillatorThickness()
inline std::vector<std::pair<RATIONAL_NUMBER, RATIONAL_NUMBER>> getEnergyResponse() const
inline RATIONAL_NUMBER applyEnergyResponse(const RATIONAL_NUMBER &anEnergy) const

Apply the energy response if any.

Parameters

anEnergy – the input energy

Returns

the output energy

inline void setLSF(const std::string &aFileName)

Set the line spread function from a file.

Parameters

aFileName – the input file name

inline void setLSF(const std::vector<RATIONAL_NUMBER> &aLSF)

Set the line spread function from an array.

Parameters

aLSF – the LSF coefficients

inline const std::vector<RATIONAL_NUMBER> &getLSF() const

Accessor on the line spread function.

Returns

the LSF coefficients

inline void clearLSF()

Clear the LSF to use a Dirac as impulse response.

inline void setPSF(const Image<RATIONAL_NUMBER> &aPSF)

Set the point spread function from a 2D image.

Parameters

aPSF – the PSF coefficients

inline const Image<RATIONAL_NUMBER> &getPSF() const

Accessor on the point spread function.

Returns

the PSF coefficients as a 2D image

void clearPSF()

Clear the PSF to use a Dirac as impulse response.

inline RATIONAL_NUMBER convertPerCm2At1m2PerPixelAtSDD(const RATIONAL_NUMBER &aPhotonCount) const

Convert a photon count per cm2 at 1m into per pixel at the source-detector distance.

Parameters

aPhotonCount – the number of photons to convert

Returns

the converted number of photons

inline RATIONAL_NUMBER convertPerPixelAtSDD2PerCm2At1m(const RATIONAL_NUMBER &aPhotonCount) const

Convert a photon count per pixel at the source-detector distance into per cm2 at 1m.

Parameters

aPhotonCount – the number of photons to convert

Returns

the converted number of photons

inline RATIONAL_NUMBER getGain()

Accessor on the detector gain.

Returns

the gain

inline void setGain(RATIONAL_NUMBER aGain)

Set the detector gain.

Parameters

aGain – the gain

inline RATIONAL_NUMBER getBias()

Accessor on the detector bias.

Returns

the bias

inline void setBias(RATIONAL_NUMBER aBias)

Set the detector bias.

Parameters

aBias – the bias

inline RATIONAL_NUMBER getStdDevBias()

Accessor on the standard deviation of the detector bias.

Returns

the standard deviation of the detector bias

inline void setStdDevBias(RATIONAL_NUMBER aStdDevBias)

Set the standard deviation of the detector bias.

Parameters

aStdDevBias – the standard deviation of the detector bias

Protected Functions

inline void updateSizeInUnitOfLength()

Compute the size of the detector.

inline void updateInternalValues()

Compute the distance between the source and the detector, etc.

void updateVBOs()

Update the VBOs.

void updateDetectorVBO()

Update the VBO of the detector.

void updateParallelBeamVBO()

Update the VBO of the parallel beam.

void updateConeBeamVBO()

Update the VBO of the cone beam.

inline void updateFOVY()

Update the view along the Y-axis.

Protected Attributes

VEC3 m_detector_position

The position of the detector centre.

VEC3 m_xray_source_centre

The position of the source centre.

std::vector<VEC3> m_p_xray_source_position_set

The sample positions of the source.

VEC3 m_up_vector

The “up” vector the the detector.

MATRIX4 m_rotation_matrix

The rotation matrix.

VEC2 m_size_in_unit_of_length

The size of the detector.

VEC2 m_resolution_in_unit_of_length_per_pixel

Resolution (in unit of length per pixel)

RATIONAL_NUMBER m_distance_source_detector

Distance between the source and the detector.

Vec2ui m_size_in_number_of_pixels

Size of the detector (in number of pixels)

bool m_vbo_need_update

A flag set to true when the VBOs need to be updated.

std::auto_ptr<VBO> m_detector_geometry

The triangle mesh corresponding to the detector.

std::vector<GLfloat> m_p_detector_geometry_vertices
std::auto_ptr<VBO> m_parallel_beam

The triangle mesh corresponding to the parallel beam.

std::auto_ptr<VBO> m_cone_beam

The triangle mesh corresponding to the cone beam.

std::auto_ptr<VBO> m_parallel_beam_highlight

The triangle mesh corresponding to the parallel beam highlight.

std::auto_ptr<VBO> m_cone_beam_highlight

The triangle mesh corresponding to the cone beam highlight.

RATIONAL_NUMBER m_widget_length

The length of the widgets.

SphereMesh m_source_mesh

Polygon mesh of the source.

CubeMesh<float> m_first_pixel_mesh

Polygon mesh of the first pixel of the detector.

SphereMesh m_detector_centre_mesh
SourceShape m_source_shape

Source type.

VEC3 m_normal

The vector normal to the detector.

VEC3 m_look_at_vector

The viewing direction (i.e. the unit vector from the X-ray source to the centre of the detector)

VEC3 m_right_vector

The cross product between m_look_at_vector and m_up_vector.

RATIONAL_NUMBER m_fovy

Field of view along the Y-axis.

Scintillator m_scintillator

Scintillator.

std::vector<RATIONAL_NUMBER> m_LSF

Impulse response of the detector as a line spread function.

Image<RATIONAL_NUMBER> m_PSF

Impulse response of the detector as a point spread function.

bool m_update_right_vector_flag

If true, the right vector is perpendicular to both the detector up-vector and the vector from the source to the centre of the detector

RATIONAL_NUMBER m_gain

The gain is a multiplicative factor by which the pixel values are amplified.

RATIONAL_NUMBER m_bias

The bias of value of the detector.

RATIONAL_NUMBER m_std_dev_bias

The standard deviation of the bias of value of the detector.

class XRayRenderer
#include <XRayRenderer.h>

XRayRenderer is a class to compute and renderer X-ray images on GPU.

Public Types

enum ComputingMode

Type to store the computation engine (OpenGL, CUDA, OpenCL, etc.).

Values:

enumerator NONE

Not set as yet.

enumerator OPENGL

Computation using OpenGL.

enumerator VULKAN

Computation using Vulkan.

enumerator CUDA

Computation using CUDA.

enumerator OPENCL

Computation using OpenCL.

enumerator OPENMP

Computation on CPU using OpenMP.

typedef RATIONAL_NUMBER PixelType

Pixel type.

Public Functions

XRayRenderer()

Default constructor.

inline ~XRayRenderer()

Destructor.

void initialise(ComputingMode aComputingMode, uint8_t aMixedPrecisionFlag, const XRayDetector *apDetector, const XRayBeam *apBeamSpectrum)

Initialise the renderer.

Parameters
  • aComputingMode – the computing mode (OPENGL, CUDA, or OPENCL)

  • aMixedPrecisionFlag – the flag that stores the internal format in which each texture will be stored (GL_RGB16F_ARB, or GL_RGB32F_ARB)

  • apDetector – the X-ray detector that will be used

  • apBeamSpectrum – the X-ray beam spectrum

void release()

Reset the renderer (release memory on the host and the device, and restore default values).

inline void setComputingMode(ComputingMode aMode)

Set the required computing mode. supported values are:

  • OPENGL, and

  • OPENMP.

inline const ComputingMode &getComputingMode() const

Accessor on the computing mode. supported values are:

  • OPENGL, and

  • OPENMP

Returns

the computing mode

bool isReady() const

Check if the renderer is ready to simulate X-ray images.

Returns

true if the renderer is ready, false if it is not

inline RATIONAL_NUMBER getTotalEnergyWithDetectorResponse(bool anApplyFiltrationFlag) const

Accessor on a total energy of the beam when the detector response is applied.

Parameters

anApplyFiltrationFlag – true if the number of photons apply to the filtered spectrum; false if the number of photons apply to the unfiltered spectrum

Returns

the total energy

inline RATIONAL_NUMBER getTotalEnergyWithoutDetectorResponse(bool anApplyFiltrationFlag) const

Accessor on a total energy of the beam when the detector response is not applied.

Parameters

anApplyFiltrationFlag – true if the number of photons apply to the filtered spectrum; false if the number of photons apply to the unfiltered spectrum

Returns

the total energy

inline void addInnerSurface(const SceneGraphNode *apSurface)

Add a 3D object to be rendered. It will be used as an internal surface.

Parameters

apSurface – the 3D object

inline void addOuterSurface(const SceneGraphNode *apSurface)

Add a 3D object to be rendered. It will be used as an external surface.

Parameters

apSurface – the 3D object

inline void addInnerSurface(const PolygonMesh *apSurface)

Add a 3D object to be rendered. It will be used as an internal surface.

Parameters

apSurface – the 3D object

inline void addOuterSurface(const PolygonMesh *apSurface)

Add a 3D object to be rendered. It will be used as an external surface.

Parameters

apSurface – the 3D object

inline bool isInnerSurface(const SceneGraphNode *apNode)

Check if a given PolygonMesh is an inner surface.

Parameters

apNode – the node in the scenegraph

Returns

true if the PolygonMesh is an inner surface, return false otherwise

inline bool isOuterSurface(const SceneGraphNode *apNode)

Check if a given PolygonMesh is an outer surface.

Parameters

apNode – the node in the scenegraph

Returns

true if the PolygonMesh is an outer surface, return false otherwise

inline void removeInnerSurfaces()

Remove the external surface from the renderer if any.

inline void removeOuterSurface()

Remove the internal surfaces from the renderer if any.

void computeLBuffer(SceneGraphNode &anObject, const VEC3 &aXRaySourceDetectorTranslation, const MATRIX4 &aModellingTransformationMatrix, bool aGPUStateConservationFlag = true)

Compute the L-buffer of a 3D object.

Parameters
  • anObject – the 3D object to process

  • aXRaySourceDetectorTranslation – the translation vector to use when the source is not aligned with the detector

  • aModellingTransformationMatrix – the transformation matrix of the 3D object

  • aGPUStateConservationFlag – if true, then restore the OpenGL states as they were before the method was called. If false, leave them as they are. It is useful to leave them when the method is called repetitively, i.e. to save time.

void computeLBuffer(PolygonMesh &anObject, const VEC3 &aXRaySourceDetectorTranslation, const MATRIX4 &aModellingTransformationMatrix, bool aGPUStateConservationFlag = true)

Compute the L-buffer of a 3D object.

Parameters
  • anObject – the 3D object to process

  • aXRaySourceDetectorTranslation – the translation vector to use when the source is not aligned with the detector

  • aModellingTransformationMatrix – the transformation matrix of the 3D object

  • aGPUStateConservationFlag – if true, then restore the OpenGL states as they were before the method was called. If false, leave them as they are. It is useful to leave them when the method is called repetitively, i.e. to save time.

void computeImage(const MATRIX4 &aModellingTransformationMatrix, bool anIntegrateEnergyFlag = true)

Compute the X-ray image.

Parameters
  • aModellingTransformationMatrix – a modelling transformation matrix that will be used on all the 3D objects

  • anIntegrateEnergyFlag – if true the energy fluence is returned, otherwise the number of photons is returned (default value: true)

void printFBO(unsigned int aFBOID, const char *aFileName, bool useCompression = false)

Save a FBO into a file.

Parameters
  • aFBOID – the ID of the FBO

  • aFileName – the file name

  • useCompression – use compression if the file format supports it (default value: false)

inline void printFBO(unsigned int aFBOID, const std::string &aFileName, bool useCompression = false)

Save a FBO into a file.

Parameters
  • aFBOID – the ID of the FBO

  • aFileName – the file name

  • useCompression – use compression if the file format supports it (default value: false)

void print2DTexture(unsigned int aTextureID, const char *aFileName, bool useCompression = false)

Save a texture into a file.

Parameters
  • aTextureID – the ID of the texture

  • aFileName – the file name

  • useCompression – use compression if the file format supports it (default value: false)

inline void print2DTexture(unsigned int aTextureID, const std::string &aFileName, bool useCompression = false)

Save a texture into a file.

Parameters
  • aTextureID – the ID of the texture

  • aFileName – the file name

  • useCompression – use compression if the file format supports it (default value: false)

inline void printLBuffer(const char *aFileName, bool useCompression = false)

Save the current L-buffer into a file.

Parameters
  • aFileName – the file name

  • useCompression – use compression if the file format supports it (default value: false)

inline void printLBuffer(const std::string &aFileName, bool useCompression = false)

Save the current L-buffer into a file.

Parameters
  • aFileName – the file name

  • useCompression – use compression if the file format supports it (default value: false)

inline void printCumulatedLBuffer(const char *aFileName, bool useCompression = false)

Save the current cumulated L-buffer into a file.

Parameters
  • aFileName – the file name

  • useCompression – use compression if the file format supports it (default value: false)

inline void printCumulatedLBuffer(const std::string &aFileName, bool useCompression = false)

Save the current cumulated L-buffer into a file.

Parameters
  • aFileName – the file name

  • useCompression – use compression if the file format supports it (default value: false)

inline void printSumMuxDx(const char *aFileName, bool useCompression = false)

Save the current Mux Dx into a file.

Parameters
  • aFileName – the file name

  • useCompression – use compression if the file format supports it (default value: false)

inline void printSumMuxDx(const std::string &aFileName, bool useCompression = false)

Save the current Mux Dx into a file.

Parameters
  • aFileName – the file name

  • useCompression – use compression if the file format supports it (default value: false)

inline void printEnergyFluence(const char *aFileName, bool useCompression = false)

Save the current energy fluence into a file (same as printXRayImage()).

Parameters
  • aFileName – the file name

  • useCompression – use compression if the file format supports it (default value: false)

inline void printEnergyFluence(const std::string &aFileName, bool useCompression = false)

Save the current energy fluence into a file (same as printXRayImage()).

Parameters
  • aFileName – the file name

  • useCompression – use compression if the file format supports it (default value: false)

inline void printXRayImage(const char *aFileName, bool useCompression = false)

Save the current energy fluence into a file (same as printEnergyFluence()).

Parameters
  • aFileName – the file name

  • useCompression – use compression if the file format supports it (default value: false)

inline void printXRayImage(const std::string &aFileName, bool useCompression = false)

Save the current energy fluence into a file (same as printEnergyFluence()).

Parameters
  • aFileName – the file name

  • useCompression – use compression if the file format supports it (default value: false)

RATIONAL_NUMBER *getFBO(unsigned int aFBOID)

Accessor on the raw data from a FBO.

Parameters

aFBOID – the ID of the FBO

void getFBO(unsigned int aFBOID, float *apImage, unsigned int aWidth, unsigned int aHeight)

Accessor on the raw data from a FBO.

Parameters

aFBOID – the ID of the FBO

void getFBO(unsigned int aFBOID, double *apImage, unsigned int aWidth, unsigned int aHeight)

Accessor on the raw data from a FBO.

Parameters

aFBOID – the ID of the FBO

GLuint getFboId(unsigned int aFBOID)

Accessor on the OpenGL ID of the FBO.

Parameters

aFBOID – the ID of the FBO

Returns

the OpenGL ID of the FBO

GLuint getTextureId(unsigned int aTextureID)

Accessor on the OpenGL ID of the texture.

Parameters

aTextureID – the ID of the texture

Returns

the OpenGL ID of the texture

RATIONAL_NUMBER *get2DTexture(unsigned int aTextureID)

Accessor on the raw data from a texture.

Parameters

aTextureID – the ID of the texture

void display2DTexture(unsigned int aTextureID)

Display a 2D texture using OpenGL.

Parameters

aTextureID – the ID of the texture

unsigned int getID2DTexture() const

Get id 2D texture using OpenGL.

inline void displayLBuffer()

Display the L-buffer using OpenGL.

inline void displayEnergyFluence()

Display the energy fluence using OpenGL (same as displayXRayImage()).

inline void displayXRayImage()

Display the energy fluence using OpenGL (same as displayEnergyFluence()).

void getEnergyFluenceMinMax()

Normalise the final result to display in OpenGL.

void display(bool useNormalisation, bool useLogScale, bool usePowerLaw, double shift = 0.0, double scale = 1.0, double gamma = (1.0 / 2.5))

Display the X-ray image using OpenGL. First the shift/scale filter is used so that The pixel \(I(x,y)\) will be replaced with \(I_t(x,y) = $(I(x,y) + shift) \times scale\). Then a log scale or a power law can be applied (optional). useLogScale and usePowerLaw cannot be used at the same time.

Parameters
  • useNormalisation – use the min/max normalisation.

  • useLogScale – use the log scale.

  • usePowerLaw – use the power law scale.

  • shift – the defalut value of shift in the shift/scale filter. It is used if useNormalisation is false. If useNormalisation is true, then the value is computed automatically (default value: 0)

  • scale – the defalut value of scale in the shift/scale filter. It is used if useNormalisation is false. If useNormalisation is true, then the value is computed automatically (default value: 1)

  • gamma – the \(\gamma\) value used in the power law if usePowerLaw is true. The pixel \(I_t(x,y)\) will be replaced with the \(I_t(x,y)^\gamma\) in the visualisation. (default value: (1.0 / 2.5))

RATIONAL_NUMBER getMuWaterLinearInterpolation(const RATIONAL_NUMBER &anIncidentEnergy)

Get the attenuation coefficient of water for a given energy. The value is computed using linear interpolation.

Parameters

anIncidentEnergy – the energy

Returns

the corresponding attenuation coefficient of water

inline RATIONAL_NUMBER getElementMassAttenuation(const char *anElementSymbol, const RATIONAL_NUMBER &anEnergy)

Get the mass attenuation coefficient ( \(\mu / \rho\)) of a chemical element.

Parameters
  • anElementSymbol – the symbol of the chemical element to consider

  • anEnergy – a given energy

Returns

the corresponding attenuation coefficient

inline RATIONAL_NUMBER getElementDensity(const char *anElementSymbol)

Get the density ( \(\rho\)) of a chemical element.

Parameters

anElementSymbol – the symbol of the chemical element to consider

Returns

the corresponding density

inline void useNegativeFilteringFlag(bool aFlag = true)

Display the final image in negative or not.

Parameters

aFlag – true is the final image is displayed in negative, false it is not (default value: true)

inline bool getNegativeFilteringFlag() const

Accessor on the flag control the display of the final in negative.

Returns

true if the final image is displayed in negative, false it is not

inline void printMuWaterTable(std::ostream &anOutputStream)

Output the talbe of attenuation coefficients of water into a data stream.

Parameters

anOutputStream – the output data stream

inline unsigned int getNumberOfInnerSurfaces() const

Accessor on the number of inner surfaces (e.g. an internal organ in case of a medical application).

Returns

the number of inner surfaces

inline unsigned int getNumberOfOuterSurfaces() const

Accessor on the number of outer surfaces (e.g. the skin surface in case of a medical application). This value is either equal to 0 or 1.

Returns

the number of outer surfaces

inline void displayInnerSurface(unsigned int anIndex) const

Display a given inner surface (e.g. an internal organ in case of a medical application).

Parameters

anIndex – the index of the inner surface to display

inline void displayOuterSurface() const

Display the outer surface (e.g. the skin surface in case of a medical application).

inline RATIONAL_NUMBER getMinPixelValue() const

Accessor on the smallest pixel intensity in the latest simulated X-ray image.

Returns

the min value in simulated X-ray image

inline RATIONAL_NUMBER getMaxPixelValue() const

Accessor on the greatest pixel intensity in the latest simulated X-ray image.

Returns

the max value in simulated X-ray image

void computeSinogram(MATRIX4 &aModellingTransformationMatrix, VEC3 aRotationCenter = VEC3(), unsigned int aNumberOfAngle = 180, RATIONAL_NUMBER anAngleOffset = 1.0)
inline void printSinogram(const char *aFileName, bool useCompression = false)
inline void printSinogram(const std::string &aFileName, bool useCompression = false)
inline const Sinogram<XRayRenderer::PixelType> &getSinogram() const
inline Sinogram<XRayRenderer::PixelType> &getSinogram()
inline const PixelType *getSinogramRawData() const
void computeProjectionSet(MATRIX4 &aModellingTransformationMatrix, VEC3 aRotationCenter = VEC3(), unsigned int aNumberOfAngle = 180, RATIONAL_NUMBER anAngleOffset = 1.0)
void computeCTAcquisition(const std::string &aProjectionOutputPath, const std::string &aScreenshotOutputPath, unsigned int aNumberOfProjections, const RATIONAL_NUMBER &aFirstAngle, bool anIncludeLastAngleFlag, const RATIONAL_NUMBER &aLastAngle, unsigned int aNumberOfWhiteImagesInFlatField, const VEC3 &aPositionOfCentreOfRotation, const VEC3 &aAxisOfRotation, const MATRIX4 &aModellingTransformationMatrix = MATRIX4(), bool anIntegrateEnergyFlag = true, unsigned short aWhiteValue = 0, unsigned int aVerboseLevel = 0)

Compute the X-ray projections for a CT acquisition.

Parameters
  • aProjectionOutputPath – the path where the X-ray projections will be saved. If the path is empty, the data will be stored in the main memory, but not saved on the disk. If the path is provided, the data will be saved on the disk, and the main memory released.

  • aScreenshotOutputPath – the path where the screenshots will be saved. If kept empty, not screenshot will be saved.

  • aNumberOfProjections – The total number of projections to simulate.

  • aFirstAngle – The rotation angle corresponding to the first projection.

  • anIncludeLastAngleFlag – A boolean flag to include or exclude the last angle. It is used to calculate the angular step between successive projections.

  • aLastAngle – The rotation angle corresponding to the last projection. Note that depending on the value of anIncludeLastAngleFlag, this angle may be included or excluded

  • aNumberOfWhiteImagesInFlatField – The number of white images used to perform the flat-field correction. If zero, then no correction will be performed.

  • aPositionOfCentreOfRotation – The location of the rotation centre,

  • aAxisOfRotation – The rotation axis.

  • anIntegrateEnergyFlag – if true the energy fluence is returned, otherwise the number of photons is returned (default value: true)

  • aWhiteValue – the value of white when flat-field correction is applied. If it is equal to zero, images will be saved as floating-point numbers. If it is greater than zero, images will be saved as unsigned short numbers. (default value = 0)

  • aVerboseLevel – The verbose level. If greater than zero, details will be outputed (default value = 0)

void computeCTAcquisitionWithGain(const std::string &aProjectionOutputPath, const std::string &aScreenshotOutputPath, unsigned int aNumberOfProjections, const RATIONAL_NUMBER &aFirstAngle, bool anIncludeLastAngleFlag, const RATIONAL_NUMBER &aLastAngle, unsigned int aNumberOfWhiteImagesInFlatField, const VEC3 &aPositionOfCentreOfRotation, const VEC3 &aAxisOfRotation, const MATRIX4 &aModellingTransformationMatrix = MATRIX4(), bool anIntegrateEnergyFlag = true, unsigned short aWhiteValue = 60000, unsigned int aVerboseLevel = 0)

Compute the X-ray projections with detector gain for a CT acquisition.

Parameters
  • aProjectionOutputPath – the path where the X-ray projections will be saved. If the path is empty, the data will be stored in the main memory, but not saved on the disk. If the path is provided, the data will be saved on the disk, and the main memory released.

  • aScreenshotOutputPath – the path where the screenshots will be saved. If kept empty, not screenshot will be saved.

  • aNumberOfProjections – The total number of projections to simulate.

  • aFirstAngle – The rotation angle corresponding to the first projection.

  • anIncludeLastAngleFlag – A boolean flag to include or exclude the last angle. It is used to calculate the angular step between successive projections.

  • aLastAngle – The rotation angle corresponding to the last projection. Note that depending on the value of anIncludeLastAngleFlag, this angle may be included or excluded

  • aNumberOfWhiteImagesInFlatField – The number of white images used to perform the flat-field correction. If zero, then no correction will be performed.

  • aPositionOfCentreOfRotation – The location of the rotation centre,

  • aAxisOfRotation – The rotation axis.

  • anIntegrateEnergyFlag – if true the energy fluence is returned, otherwise the number of photons is returned (default value: true)

  • aWhiteValue – the value of white when flat-field correction is applied. If it is equal to zero, images will be saved as floating-point numbers. If it is greater than zero, images will be saved as unsigned short numbers. (default value = 60000)

  • aVerboseLevel – The verbose level. If greater than zero, details will be outputed (default value = 0)

inline const std::string &getProjectionOutputPathCT() const

Accessor on the path where X-ray projections are saved during a CT scan acquisition simulation.

Returns

the path where X-ray projections are saved

inline const std::string &getScreenshotOutputPathCT() const

Accessor on the path where screenshots are saved during a CT scan acquisition simulation.

Returns

the path where screenshots are saved

inline unsigned int getNumberOfProjectionsCT() const

Accessor on the number of X-ray projections computed during a CT scan acquisition simulation.

Returns

the number of X-ray projections

inline RATIONAL_NUMBER getFOV() const

Compute the field of view (FOV) of a CT scan.

Returns

the FOV

inline RATIONAL_NUMBER getSourceDetectorDistance() const
inline RATIONAL_NUMBER getSDD() const
inline RATIONAL_NUMBER getObjectDetectorDistance() const
inline RATIONAL_NUMBER getODD() const
inline RATIONAL_NUMBER getSourceObjectDistance() const
inline RATIONAL_NUMBER getSOD() const
inline unsigned int getOptimalNumberOfProjectionsCT() const

Accessor on the number of X-ray projections needed to compute a CT scan acquisition that satisfies the Nyquist theorem. Note that the user may choose a different number.

Returns

the optimal number of X-ray projections

inline RATIONAL_NUMBER getFirstAngleCT() const

Accessor on the first angle of the CT scan acquisition simulation.

Returns

the first angle

inline RATIONAL_NUMBER getLastAngleCT() const

Accessor on the last angle of the CT scan acquisition simulation.

Returns

the last angle

inline bool getIncludeLastAngleFlagCT() const

Accessor on the flag used to include the last angle or not during the CT scan acquisition simulation.

Returns

the flag used to include the last angle or not

inline unsigned int getWhiteImagesInFlatFieldCT() const

Accessor on the number of white images used in the flat-field correction during the CT scan acquisition simulation. Zero means that the flat-field correction was not used.

Returns

the number of white images

inline const VEC3 &getCentreOfRotationPositionCT() const

Accessor on the position of the centre of rotation used during the CT scan acquisition simulation.

Returns

the position of the centre of rotation

inline const VEC3 &getRotationAxisCT() const

Accessor on the axis of rotation used during the CT scan acquisition simulation.

Returns

the axis of rotation

inline const std::vector<RATIONAL_NUMBER> &getAngleSetCT() const

Accessor on the set of rotation angles used during the CT scan acquisition simulation.

Returns

the set of rotation angles

inline void printProjectionSet(const char *aFileName, bool useCompression = false)
inline void printProjectionSet(const std::string &aFileName, bool useCompression = false)
inline const Image<XRayRenderer::PixelType> &getProjectionSet() const
inline Image<XRayRenderer::PixelType> &getProjectionSet()
inline const PixelType *getProjectionSetRawData()
inline Image<XRayRenderer::PixelType> &getEnergyFluence()
inline Image<unsigned short> &getEnergyFluenceWithGain()
const PixelType *getEnergyFluenceRawData()
inline const Image<XRayRenderer::PixelType> &getLBuffer() const
inline Image<XRayRenderer::PixelType> &getLBuffer()
inline const Image<XRayRenderer::PixelType> &getCumulatedLBuffer() const
inline Image<XRayRenderer::PixelType> &getCumulatedLBuffer()
inline const PixelType *getLBufferRawData()
inline const XRayBeam *getXRayBeam() const

Returns the actual Beam.

Returns

a const pointer to the actual Beam

inline void enableArtefactFilteringOnGPU()

Enable artefact filtering on GPU.

inline void enableArtefactFilteringOnCPU()

Enable artefact filtering on CPU.

inline void enableArtifactFilteringOnGPU()

Enable artefact filtering on GPU.

inline void enableArtifactFilteringOnCPU()

Enable artefact filtering on CPU.

inline void disableArtefactFilteringOnGPU()

Disable artefact filtering on GPU.

inline void disableArtefactFilteringOnCPU()

Disable artefact filtering on CPU.

inline void disableArtifactFilteringOnGPU()

Disable artefact filtering on GPU.

inline void disableArtifactFilteringOnCPU()

Disable artefact filtering on CPU.

inline void useArtifactFilteringOnGPU(bool aFlag)
inline void useArtifactFilteringOnCPU(bool aFlag)
inline void useArtefactFilteringOnGPU(bool aFlag)
inline void useArtefactFilteringOnCPU(bool aFlag)
inline bool useArtifactFilteringOnGPU() const
inline bool useArtifactFilteringOnCPU() const
inline bool useArtefactFilteringOnGPU() const
inline bool useArtefactFilteringOnCPU() const
inline unsigned int getMaxRadiusLbufferArtefactFilter() const

Accessor on the max radius of the L-buffer artefact correction filter.

Returns

the radius in number of pixels

inline void setMaxRadiusLbufferArtefactFilter(unsigned int aRadius)

Set the max radius of the L-buffer artefact correction filter.

Parameters

aRadius – the radius in number of pixels

void needUpdateSurfacePerMaterial()

If a surface changes material, it is needed update surfacepermaterial list.

Image<float> getWhiteImage(bool anIntegrateEnergyFlag = true)

Compute the white image (X-ray image without the object).

Parameters

anIntegrateEnergyFlag – if true the energy fluence is returned, otherwise the number of photons is returned (default value: true)

Image<unsigned short> getWhiteImageWithGain(bool anIntegrateEnergyFlag = true)

Compute the white image (X-ray image without the object) when the detector gain is applied.

Parameters

anIntegrateEnergyFlag – if true the energy fluence is returned, otherwise the number of photons is returned (default value: true)

inline const std::vector<VEC3> &getSourcePositionSet() const
inline const std::vector<VEC3> &getDetectorPositionSet() const
inline const std::vector<VEC3> &getDetectorRightVectorSet() const
inline const std::vector<VEC3> &getDetectorUpVectorSet() const

Public Static Functions

static RATIONAL_NUMBER getMuWaterLogLinearInterpolation(const RATIONAL_NUMBER &anIncidentEnergy)

Get the attenuation coefficient of water for a given energy. The value is computed using linear interpolation on a logarithmic scale.

Parameters

anIncidentEnergy – the energy

Returns

the corresponding attenuation coefficient of water

static inline RATIONAL_NUMBER getMuFromHUAndMuWater(const RATIONAL_NUMBER &HU, const RATIONAL_NUMBER &mu_water)

Convert a Hounsfield value into a linear attenuation coefficient ( \(\mu\)).

Parameters
  • HU – the Hounsfield value to convert

  • mu_water – the attenuation coefficient of water at a given energy

Returns

the corresponding attenuation coefficient

static inline RATIONAL_NUMBER getMuFromHU(const RATIONAL_NUMBER &HU, const RATIONAL_NUMBER &anEnergy)

Convert a Hounsfield value into a linear attenuation coefficient ( \(\mu\)).

Parameters
  • HU – the Hounsfield value to convert

  • anEnergy – a given energy

Returns

the corresponding attenuation coefficient

static inline RATIONAL_NUMBER getMassAttenuationFromHU(const RATIONAL_NUMBER &HU, const RATIONAL_NUMBER &anEnergy)

Convert a Hounsfield value into a mass attenuation coefficient ( \(\mu / \rho\)).

Parameters
  • HU – the Hounsfield value to convert

  • anEnergy – a given energy

Returns

the corresponding attenuation coefficient

static inline RATIONAL_NUMBER getDensityFromHU(const RATIONAL_NUMBER &HU)

Get the density ( \(\rho\)) of a tissue given a Hounsfield value.

Parameters

HU – the Hounsfield value to consider

Returns

the corresponding density

static inline RATIONAL_NUMBER getElementMu(const char *anElementSymbol, const RATIONAL_NUMBER &anEnergy)

Get the linear attenuation coefficient ( \(\mu\)) of a chemical element.

Parameters
  • anElementSymbol – the symbol of the chemical element to consider

  • anEnergy – a given energy

Returns

the corresponding attenuation coefficient

Protected Functions

void computeImageUsingOpenGL(const MATRIX4 &aModellingTransformationMatrix, bool anIntegrateEnergyFlag = true)

Compute the X-ray image.

Parameters
  • aModellingTransformationMatrix – a modelling transformation matrix that will be used on all the 3D objects

  • anIntegrateEnergyFlag – if true the energy fluence is returned, otherwise the number of photons is returned (default value: true)

void computeImageUsingOpenMP(const MATRIX4 &aModellingTransformationMatrix, bool anIntegrateEnergyFlag = true)

Compute the X-ray image.

Parameters
  • aModellingTransformationMatrix – a modelling transformation matrix that will be used on all the 3D objects

  • anIntegrateEnergyFlag – if true the energy fluence is returned, otherwise the number of photons is returned (default value: true)

void checkGPUCapabilities()

Check that the device supports all the required OpenGL extensions that are needed.

void initShaders()

Initialise the shaders.

void createFBOs()

Create the FBOs.

void deleteFBOs()

Delete the FBOs.

void createPBO(unsigned int &aPBO)

Create a PBO.

Parameters

aPBO – ID of the PBO to create

void deletePBO(unsigned int &aPBO)

Delete a PBO.

Parameters

aPBO – ID of the PBO to delete

inline void initialisePBOs()

Initialise the PBOs.

inline void init2DTextures()

Initialise the 2D textures.

void init3DData()

Initialise the 3D textures.

void init2DFBO(unsigned int aFBOIndex, unsigned int aColourTextureIndex, unsigned int aZBufferTextureIndex = 0)

Initialise a FBO (e.g. attach textures, etc.).

Parameters
  • aFBOIndex – the FBO to initialise

  • aColourTextureIndex – the colour texture to attach

  • aZBufferTextureIndex – the Z-buffer texture (optional) to attach (default value: 0)

void init3DFBOs()

Initialise a FBO with a 3D texture.

void create2DTexture(unsigned int *apTextureID, int anInternalTextureFormat, int aType)

Create a 2D texture.

Parameters
  • apTextureID – the address on the ID of the texture

  • anInternalTextureFormat – the internal format in which the texture will be stored in the device

  • aType – the type of texls, e.g. GL_RGBA, GL_DEPTH_COMPONENT, etc.

void reset2DBuffer(unsigned int aFrameBuffer)

Reset the value of a FBO to 0.

Parameters

aFrameBuffer – the FBO to reset

void resetLBuffer()

Reset the L-buffer FBO to 0.

inline void resetEnergyFluence()

Reset the energy fluence FBO to 0.

inline void resetSumMuxDx()

Reset the Mu_x * D_x FBO to 0.

void computeInnerSurfaceLBuffer(PolygonMesh &anObject, const VEC3 &aXRaySourceSampleOffset, const MATRIX4 &aModellingTransformationMatrix, bool aGPUStateConservationFlag)

Compute the L-buffer of an internal object.

Parameters
  • anObject – the 3D object to process

  • aXRaySourceSampleOffset – the translation vector to use when the source is not aligned with the detector

  • aModellingTransformationMatrix – the transformation matrix of the 3D object

  • aGPUStateConservationFlag – if true, then restore the OpenGL states as they were before the method was called. If false, leave them as they are. It is useful to leave them when the method is called repetitively, i.e. to save time.

void computeOuterSurfaceLBuffer(PolygonMesh &anObject, const VEC3 &aXRaySourceSampleOffset, const MATRIX4 &aModellingTransformationMatrix)

Compute the L-buffer of an external object.

Parameters
  • anObject – the 3D object to process

  • aXRaySourceSampleOffset – the translation vector to use when the source is not aligned with the detector

  • aModellingTransformationMatrix – the transformation matrix of the 3D object

void updateCumulatedLBuffers(unsigned int anObjectID)

Update the L-buffer of inner surfaces. It integrates the L-buffers of all the inner surfaces.

Parameters

anObjectID – the ID of the surface to integrate. If anObjectID is equal to zero, the cumulated L-buffer is re-initialsed with the L-buffer of this surface. If anObjectID is greater than zero, L-buffer of this surface is integrated into the cumulated L-buffer.

void computeSumMUxDx(int anObjectID, const PhotonCrossSection &aPhotonCrossSection)

Integrate \(\mu(anObjectID) \times \mathrm{d}x\) for a given object (anObjectID) in \(\sum \mu \times \mathrm{d}x\).

Parameters
  • anObjectID – the ID of the surface to integrate.

  • aPhotonCrossSection – the corresponding material composition.

void computeIntegratedEnergy(bool anIntegrateEnergyFlag)

Compute the energy fluence.

Parameters

anIntegrateEnergyFlag – if true the energy fluence is returned, otherwise the number of photons is returned

void cleanLBuffer(const RATIONAL_NUMBER &aCutoffDistance)

Clean the L-buffer, i.e. remove rendering artefacts.

Parameters

aCutoffDistance – the cut-off distance. It is used to handle numerical inacuracies. If the L-buffer pixel value is less than aCutoffDistance, we leave it as it is.

void updateVBO()

Update the VBO of the geometry.

void preComputeLBuffer(GLint *apViewport, const VEC3 &aXRaySourceSampleOffset)
void postComputeLBuffer(const GLint *apViewport, RATIONAL_NUMBER aDiagonal)
void updateSurfacePerMaterialSet()
void addPoissonNoise(Image<PixelType> &anImage)

Use the number of photons to add the Poisson noise.

Parameters
  • anImageImage to alter.

  • aCutoffValue – the value of lambda in a Poisson distribution where a Gaussian distribution is a good enough approximation of the Poisson distribution (default value: 50)

inline std::pair<VEC3, VEC3> getSampleBoundingBox() const
inline VEC3 getSampleBoundingBoxCentre() const

Protected Attributes

XRayDetector *m_p_detector

The X-ray detector.

XRayBeam *m_p_xray_beam

The X-ray beam.

std::vector<SceneGraphNode*> m_p_inner_surface_set

Set of 3D geometries.

SceneGraphNode *m_p_outer_surface

The 3D geometry that will wrap the ones in m_p_inner_surface_set.

std::vector<SceneGraphNode*> m_p_internal_data_storage
std::vector<std::vector<SceneGraphNode*>> m_p_surface_per_material_set
bool m_surface_per_material_set_needs_update
ComputingMode m_computing_mode

The computing mode (OPENGL, CUDA, or OPENCL)

std::vector<unsigned int> m_p_pbo_set

Set of PBOs.

std::vector<unsigned int> m_p_texture_name_set

Set of textures.

std::vector<Shader> m_shader_set

Set of shaders.

Image<PixelType> m_temp_raw_data

The raw data of the last FBO that was loaded in the main memory.

std::vector<FramebufferObject*> m_p_fbo_set

The set of FBOs.

Image<PixelType> m_l_buffer_image

L-buffer.

Image<PixelType> m_cumulated_lbuffer_image

Cumulated L-buffer for all the inner surfaces.

Image<PixelType> m_sum_mux_dx_image

Sum(Mu_x * d_x)

Image<PixelType> m_energy_fluence_image

Energy fluence.

Image<unsigned short> m_energy_fluence_with_gain_image

Energy fluence with gain.

Sinogram<PixelType> m_sinogram_image

Sinogram.

Image<PixelType> m_projection_set

Projection set.

RATIONAL_NUMBER m_min_value_in_simulated_xray_image

Min value in simulated X-ray image.

RATIONAL_NUMBER m_max_value_in_simulated_xray_image

Max value in simulated X-ray image.

unsigned int m_negative_display_flag

Flag to display the result in negative or not.

bool m_use_l_buffer_artefact_filtering_on_gpu

Flag set to true to use L-buffer artefact filtering.

bool m_use_l_buffer_artefact_filtering_on_cpu
unsigned int m_max_radius_Lbuffer_artefact_filter

Max radius of L-buffer artefact filter.

bool m_l_buffer_empty

Flag use for lazy evaluation of the L-Buffer.

bool m_energy_fluence_empty

Flag use for lazy evaluation and blending of the energy fluence.

std::auto_ptr<VBO> m_detector_temporary_geometry

The VBO used to display a rectangle corresponding to the detector.

unsigned int m_zbuffer_texture_id
uint8_t m_mixed_precision_flag
std::default_random_engine *m_p_random_number_generator
std::uniform_real_distribution *m_p_uniform_distribution
std::normal_distribution *m_p_normal_distribution
bool m_use_photon_count_detector
std::string m_CT_projection_output_path
std::string m_CT_screenshot_output_path
RATIONAL_NUMBER m_CT_first_angle
bool m_CT_include_last_angle_flag
RATIONAL_NUMBER m_CT_last_angle
unsigned int m_CT_white_images_in_flat_field
VEC3 m_CT_centre_of_rotation_position
VEC3 m_CT_rotation_axis
std::vector<VEC3> m_source_positions_set
std::vector<VEC3> m_detector_positions_set
std::vector<VEC3> m_detector_right_vector_set
std::vector<VEC3> m_detector_up_vector_set
std::vector<RATIONAL_NUMBER> m_CT_angle_set

Protected Static Functions

static void loadMuWater()

Load the table of water attenuation coefficients.

Protected Static Attributes

static std::vector<AttenuationCoefficient> m_mu_water_set

The table of water energy fluence coefficients.

static unsigned int m_counter
namespace gVirtualXRay

Typedefs

typedef float SinogramType

Type of data used to store sinograms.

typedef float RATIONAL_NUMBER

Type of data used to store real numbers.

typedef Vec2<RATIONAL_NUMBER> VEC2

Type of data used to store 2D vectors.

typedef Vec3<RATIONAL_NUMBER> VEC3

Type of data used to store 3D vectors.

typedef Matrix4x4<RATIONAL_NUMBER> MATRIX4

Type of data used to store 4x4 matrices.

typedef Vec2<double> Vec2d

Vec2d is a class to handle a 2D vector using double precision floating point numbers.

typedef Vec2<float> Vec2f

Vec2f is a class to handle a 2D vector using double precision floating point numbers.

typedef Vec2<int> Vec2i

Vec2i is a class to handle a 2D vector using 32 bits integers.

typedef Vec2<unsigned int> Vec2ui

Vec2ui is a class to handle a 2D vector using unsigned 32 bits integers.

typedef Vec3<double> Vec3d

Vec3d is a class to handle a 3D vector using double precision floating point numbers.

typedef Vec3<float> Vec3f

Vec3f is a class to handle a 3D vector using double precision floating point numbers.

typedef Vec3<int> Vec3i

Vec3i is a class to handle a 3D vector using signed 32 bits integers.

typedef Vec3<unsigned int> Vec3ui

Vec3ui is a class to handle a 3D vector using unsigned 32 bits integers.

typedef Matrix4x4<double> Matrix4x4d

Matrix4x4d is a class to handle a 4x4 matrix using double precision floating point numbers.

typedef Matrix4x4<float> Matrix4x4f

Matrix4x4f is a class to handle a 4x4 matrix using single precision floating point numbers.

Functions

std::ostream &operator<<(std::ostream &anOutputSream, const gVirtualXRay::AtomicElement &anElement)

operator <<

std::istream &operator>>(std::istream &anInputSream, gVirtualXRay::AtomicElement &anElement)

operator >>

inline std::istream &operator>>(std::istream &is, AttenuationCoefficient &obj)

operator>>

Parameters
  • is – the input stream

  • obj – the record to load from the stream

Returns

the input stream

inline std::ostream &operator<<(std::ostream &os, const AttenuationCoefficient &obj)

operator<<

Parameters
  • os – the output stream

  • obj – the record to store in the stream

Returns

the output stream

std::ostream &operator<<(std::ostream &anOutputSream, const gVirtualXRay::ElementSet &anElementSet)

operator <<

inline std::ostream &operator<<(std::ostream &anOutputStream, const Exception &anException)

operator<<

Parameters
  • anOutputStream – the output stream

  • anException – the exception to add to the output stream

Returns

the output stream

template<typename T>
Image<T> operator*(const T &aValue, const Image<T> &anImage)
template<typename T>
Image<T> operator/(const T &aValue, const Image<T> &anImage)
template<typename T>
Image<T> operator+(const T &aValue, const Image<T> &anImage)
template<typename T>
Image<T> operator-(const T &aValue, const Image<T> &anImage)
template<typename T>
Image<T> log(const Image<T> &anImage)
template<typename T>
Image<T> abs(const Image<T> &anImage)
inline std::string getPixelType(const std::string &aFileName)
inline std::string getPixelType(const char *aFileName)
template<typename T>
Image<T> gauss2D(unsigned int aSize, double aSigmaValue)
inline void convert(const Image<float> &aSourceImage, Image<unsigned short> &aTargetImage)
inline void convert(const Image<unsigned short> &aSourceImage, Image<float> &aTargetImage)
inline std::ostream &operator<<(std::ostream &anOutputSream, const MaterialSet &aMaterialSet)
template<typename T>
std::ostream &operator<<(std::ostream &anOutputStream, const Matrix4x4<T> &aMatrix)
void initialiseGLAD(const std::string &anAPI, void *aGLXDisplay = nullptr, int aGLXScreen = 0, void *anEGLDisplay = 0)

Initialise GLAD.

void initializeGLAD(const std::string &anAPI)

Initialize GLAD.

void initialiseGLEW()

Initialise GLEW.

void initializeGLEW()

Initialize GLEW.

void checkOpenGLErrorStatus(const char *aFileName, const char *aFunctionName, int aLineNumber)

Check OpenGL’s error status.

Parameters
  • aFileName – name of the source file where OpenGL is checked

  • aFunctionName – name of the function where OpenGL is checked

  • aLineNumber – name at which OpenGL is checked

void checkFBOErrorStatus(const char *aFileName, const char *aFunctionName, int aLineNumber)

Check the current FBO’s error status.

Parameters
  • aFileName – name of the source file where FBO is checked

  • aFunctionName – name of the function where FBO is checked

  • aLineNumber – name at which FBO is checked

inline void pushProjectionMatrix()

Add the current matrix to the projection matrix stack.

inline void pushModelViewMatrix()

Add the current matrix to the model/view matrix stack.

void pushFBO()

Add the current FBO binding to the FBO stack.

void pushTexture1D()

Add the current 1D texture binding to the texture stack.

void pushTexture2D()

Add the current 2D texture binding to the texture stack.

void pushTextureRectangle()

Add the current rectangle texture binding to the texture stack.

void pushTexture3D()

Add the current 3D texture binding to the texture stack.

void pushEnableDisableState(int aParameter)

Add the enable/disable state to the corresponding stack.

Parameters

aParameter – parameter to add

void pushShaderProgram()

Add the current shader program to the corresponding stack.

inline void popProjectionMatrix()

Restore the matrix from the projection matrix stack, and remove the last matrix of the stack.

inline void popModelViewMatrix()

Restore the matrix from the model/view matrix stack, and remove the last matrix of the stack.

void popFBO()

Restore the FBO binding from the FBO stack, and remove the last FBO of the stack.

void popTexture()

Restore the texture binding from the texture stack, and remove the last texture of the stack.

void popEnableDisableState()

Restore the enable/disable state to the corresponding stack, and remove the last state of the stack.

void popShaderProgram()

Restore the shader program to the corresponding stack, and remove the last state of the stack.

gVirtualXRay::Matrix4x4<float> getCurrentOpenGLMatrix()

Load the current OpenGL matrix.

Returns

the current OpenGL matrix.

inline void loadIdentityProjectionMatrix()

Replace the projection matrix by the identity matrix.

inline void loadIdentityModelViewMatrix()

Replace the model/view matrix by the identity matrix.

inline void loadFrustumProjectionMatrix(double left, double right, double bottom, double top, double near, double far)

Replace the projection matrix by a perspective projection matrix.

Parameters
  • left – Specify the coordinates for the left vertical clipping plane

  • right – Specify the coordinates for the right vertical clipping plane

  • bottom – Specify the coordinates for the bottom horizontal clipping plane

  • top – Specify the coordinates for the top horizontal clipping plane

  • near – Specify the distances to the near clipping plane. The value must be positive

  • far – Specify the distances to the far clipping plane. The value must be positive

inline void loadPerspectiveProjectionMatrix(double fovy, double aspect, double zNear, double zFar)

Replace the projection matrix by a perspective projection matrix.

Parameters
  • fovy – specifies the field of view angle, in degrees, in the y-direction.

  • aspect – Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).

  • zNear – Specifies the distance from the viewer to the near clipping plane (always positive)

  • zFar – Specifies the distance from the viewer to the far clipping plane (always positive).

inline void loadOrthoProjectionMatrix(double left, double right, double bottom, double top, double near, double far)

Replace the projection matrix by a orthographic projection matrix.

Parameters
  • left – Specify the coordinates for the left vertical clipping plane

  • right – Specify the coordinates for the right vertical clipping plane

  • bottom – Specify the coordinates for the bottom horizontal clipping plane

  • top – Specify the coordinates for the top horizontal clipping plane

  • near – Specify the distances to the near clipping plane. The value must be positive

  • far – Specify the distances to the far clipping plane. The value must be positive

inline MATRIX4 buildOrthoProjectionMatrix(double left, double right, double bottom, double top, double near, double far)

Create a orthographic projection matrix.

Parameters
  • left – Specify the coordinates for the left vertical clipping plane

  • right – Specify the coordinates for the right vertical clipping plane

  • bottom – Specify the coordinates for the bottom horizontal clipping plane

  • top – Specify the coordinates for the top horizontal clipping plane

  • near – Specify the distances to the near clipping plane. The value must be positive

  • far – Specify the distances to the far clipping plane. The value must be positive

Returns

the projection matrix

inline MATRIX4 buildFrustumProjectionMatrix(double left, double right, double bottom, double top, double near, double far)

Create a perspective projection matrix.

Parameters
  • left – Specify the coordinates for the left vertical clipping plane

  • right – Specify the coordinates for the right vertical clipping plane

  • bottom – Specify the coordinates for the bottom horizontal clipping plane

  • top – Specify the coordinates for the top horizontal clipping plane

  • near – Specify the distances to the near clipping plane. The value must be positive

  • far – Specify the distances to the far clipping plane. The value must be positive

Returns

the projection matrix

inline MATRIX4 buildPerspectiveProjectionMatrix(double fovy, double aspect, double zNear, double zFar)

Create a perspective projection matrix.

Parameters
  • fovy – specifies the field of view angle, in degrees, in the y-direction.

  • aspect – Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).

  • zNear – Specifies the distance from the viewer to the near clipping plane (always positive)

  • zFar – Specifies the distance from the viewer to the far clipping plane (always positive).

Returns

the projection matrix

inline void loadLookAtModelViewMatrix(const VEC3 &eye, const VEC3 &centre, const VEC3 &up)

Replace the modelling-viewing matrix by a viewing transformation matrix.

Parameters
  • eye – Specifies the position of the eye point

  • centre – Specifies the position of the reference point

  • up – Specifies the direction of the up vector

inline void loadLookAtModelViewMatrix(double eyeX, double eyeY, double eyeZ, double centreX, double centreY, double centreZ, double upX, double upY, double upZ)

Replace the modelling-viewing matrix by a viewing transformation matrix.

Parameters
  • eyeX – Specifies the position of the eye point along the X-axis

  • eyeY – Specifies the position of the eye point along the Y-axis

  • eyeZ – Specifies the position of the eye point along the Z-axis

  • centreX – Specifies the position of the reference point along the X-axis

  • centreY – Specifies the position of the reference point along the Y-axis

  • centreZ – Specifies the position of the reference point along the Z-axis

  • upX – Specifies the direction of the up vector along the X-axis

  • upY – Specifies the direction of the up vector along the Y-axis

  • upZ – Specifies the direction of the up vector along the Z-axis

inline MATRIX4 buildLookAtModelViewMatrix(const VEC3 &eye, const VEC3 &centre, const VEC3 &up)

Create a modelling-viewing matrix.

Parameters
  • eye – Specifies the position of the eye point

  • centre – Specifies the position of the reference point

  • up – Specifies the direction of the up vector

Returns

the modelling-viewing matrix

inline MATRIX4 buildLookAtModelViewMatrix(double eyeX, double eyeY, double eyeZ, double centreX, double centreY, double centreZ, double upX, double upY, double upZ)

Create a modelling-viewing matrix.

Parameters
  • eyeX – Specifies the position of the eye point along the X-axis

  • eyeY – Specifies the position of the eye point along the Y-axis

  • eyeZ – Specifies the position of the eye point along the Z-axis

  • centreX – Specifies the position of the reference point along the X-axis

  • centreY – Specifies the position of the reference point along the Y-axis

  • centreZ – Specifies the position of the reference point along the Z-axis

  • upX – Specifies the direction of the up vector along the X-axis

  • upY – Specifies the direction of the up vector along the Y-axis

  • upZ – Specifies the direction of the up vector along the Z-axis

Returns

the modelling-viewing matrix

void loadProjectionMatrixFromOpenGL()

Replace the projection matrix by OpenGL’s projection matrix.

void loadModelViewMatrixFromOpenGL()

Replace the modelling-viewing matrix by OpenGL’s modelling-viewing matrix.

void applyModelViewMatrix()

Load the modelling-viewing matrix in the current shader program, or replace OpenGL’s modelling-viewing matrix.

bool useOpenGL45()

Check if OpenGL 4.5 is supported by the current OpenGL context.

bool useOpenGL32()

Check if OpenGL 3.2 is supported by the current OpenGL context.

bool useOpenGLCompute()

Check if OpenGL Compute Shaders are supported by the current OpenGL context.

VBO *createVBO()

Create an OpenGL VBO suitable for the current OpenGL context.

OpenGL2VBO *createOpenGL2VBO()

Create an OpenGL 2.x VBO.

OpenGL3VBO *createOpenGL3VBO()

Create an OpenGL 3.x or 4.x VBO.

inline std::string getShaderTypeID(const std::type_info &aTypeID)
inline std::string getShaderImageType(const std::type_info &aTypeID)
inline std::string getShaderPixelType(const std::type_info &aTypeID)
inline std::string getShaderRGBAPixelType(const std::type_info &aTypeID)
inline Vec2ui getMax2DTextureSize()

Access the largest possible 2D texture size on the current environment.

inline Vec3ui getMax3DTextureSize()

Access the largest possible 3D texture size on the current environment.

inline void multiplyOrthoProjectionMatrix(double left, double right, double bottom, double top, double nearPlane, double farPlane)
inline void multiplyPerspectiveProjectionMatrix(double fovy, double aspect, double zNear, double zFar)
inline int getShaderOpenGLType(const std::type_info &aTypeID)
inline std::ostream &operator<<(std::ostream &anOuputStream, const PhotonCrossSection &anInstance)
inline std::vector<double> logspace(const double &a, const double &b, const int &k)
inline std::istream &operator>>(std::istream &is, SpectrumRecord &obj)

operator>>

Parameters
  • is – the input stream

  • obj – the record to load from the stream

Returns

the input stream

inline std::ostream &operator<<(std::ostream &os, const SpectrumRecord &obj)

operator<<

Parameters
  • os – the output stream

  • obj – the record to store in the stream

Returns

the output stream

inline std::ostream &operator<<(std::ostream &anOutputSream, const TissueMaterial &aTissueMaterial)
inline std::istream &operator>>(std::istream &anInputSream, TissueMaterial &aTissueMaterial)
int inflate(const void *src, int srcLen, char **apDst)

Uncompress data using the Zlib.

Parameters
  • src – compressed data

  • srcLen – length of the uncompressed data

  • apDst – uncompressed data

int deflate(const void *src, int srcLen, char **apDst)

Compress data using the Zlib.

Parameters
  • src – uncompressed data

  • srcLen – length of the uncompressed data

  • apDst – compressed data

inline bool isMAT(const char *aFileName)

Check if the extension of a file name is MAT.

Parameters

aFileName – the file name to check

Returns

true if the extension of aFileName is MAT; false if it is not

inline bool isDAT(const char *aFileName)

Check if the extension of a file name is DAT.

Parameters

aFileName – the file name to check

Returns

true if the extension of aFileName is DAT; false if it is not

inline bool isTXT(const char *aFileName)

Check if the extension of a file name is TXT.

Parameters

aFileName – the file name to check

Returns

true if the extension of aFileName is TXT; false if it is not

inline bool isPGM(const char *aFileName)

Check if the extension of a file name is PGM.

Parameters

aFileName – the file name to check

Returns

true if the extension of aFileName is PGM; false if it is not

inline bool isRAW(const char *aFileName)

Check if the extension of a file name is RAW.

Parameters

aFileName – the file name to check

Returns

true if the extension of aFileName is RAW; false if it is not

inline bool isMHA(const char *aFileName)

Check if the extension of a file name is MHA.

Parameters

aFileName – the file name to check

Returns

true if the extension of aFileName is MHA; false if it is not

inline bool isMHD(const char *aFileName)

Check if the extension of a file name is MHD.

Parameters

aFileName – the file name to check

Returns

true if the extension of aFileName is MHD; false if it is not

inline bool isDCM(const char *aFileName)

Check if the extension of a file name is DCM.

Parameters

aFileName – the file name to check

Returns

true if the extension of aFileName is DCM; false if it is not

inline bool isJPEG(const char *aFileName)

Check if the extension of a file name is JPEG.

Parameters

aFileName – the file name to check

Returns

true if the extension of aFileName is JPEG; false if it is not

inline bool isTIFF(const char *aFileName)

Check if the extension of a file name is TIFF.

Parameters

aFileName – the file name to check

Returns

true if the extension of aFileName is TIFF; false if it is not

inline bool isMAT(const std::string &aFileName)

Check if the extension of a file name is MAT.

Parameters

aFileName – the file name to check

Returns

true if the extension of aFileName is MAT; false if it is not

inline bool isDAT(const std::string &aFileName)

Check if the extension of a file name is DAT.

Parameters

aFileName – the file name to check

Returns

true if the extension of aFileName is DAT; false if it is not

inline bool isTXT(const std::string &aFileName)

Check if the extension of a file name is TXT.

Parameters

aFileName – the file name to check

Returns

true if the extension of aFileName is TXT; false if it is not

inline bool isPGM(const std::string &aFileName)

Check if the extension of a file name is PGM.

Parameters

aFileName – the file name to check

Returns

true if the extension of aFileName is PGM; false if it is not

inline bool isRAW(const std::string &aFileName)

Check if the extension of a file name is RAW.

Parameters

aFileName – the file name to check

Returns

true if the extension of aFileName is RAW; false if it is not

inline bool isMHA(const std::string &aFileName)

Check if the extension of a file name is MHA.

Parameters

aFileName – the file name to check

Returns

true if the extension of aFileName is MHA; false if it is not

inline bool isMHD(const std::string &aFileName)

Check if the extension of a file name is MHD.

Parameters

aFileName – the file name to check

Returns

true if the extension of aFileName is MHD; false if it is not

inline bool isDCM(const std::string &aFileName)

Check if the extension of a file name is DCM.

Parameters

aFileName – the file name to check

Returns

true if the extension of aFileName is DCM; false if it is not

inline bool isJPEG(const std::string &aFileName)

Check if the extension of a file name is JPEG.

Parameters

aFileName – the file name to check

Returns

true if the extension of aFileName is JPEG; false if it is not

inline bool isTIFF(const std::string &aFileName)

Check if the extension of a file name is TIFF.

Parameters

aFileName – the file name to check

Returns

true if the extension of aFileName is TIFF; false if it is not

inline bool checkExtension(const char *aFileName, const char *anExtension)
bool checkExtension(const std::string &aFileName, const std::string &anExtension)
inline bool isBigEndian()
inline bool isLittleEndian()
inline bool isLetter(char aValue)
inline bool isUpperCase(char aValue)
inline bool isLowerCase(char aValue)
inline bool isNumber(char aValue)
template<typename T>
void swapBytes(T &aValue)
template<typename T>
T degreeToRadian(const T &aAngleInDegree)
template<typename T>
T radianToDegree(const T &aAngleInRadian)
template<typename T>
int sgn(const T &aValue)
inline double interpolate(const double &a_low, const double &a_high, const double &a0, const double &b_low, const double &b_high)
inline float interpolate(const float &a_low, const float &a_high, const float &a0, const float &b_low, const float &b_high)
template<typename T>
std::ostream &operator<<(std::ostream &anOutputStream, const Vec2<T> &aVector)
template<typename T>
std::ostream &operator<<(std::ostream &anOutputStream, const Vec3<T> &aVector)
template<typename T>
Vec3<T> operator*(const double &aValue, const Vec3<T> &aVector)

Operator * to multiply each component of the vector by a given value.

Parameters
  • aValue – the multiplicative value

  • aVector – the vector to multiply

Returns

the modified vector

inline bool getPrecisionUncleanedLBuffer(uint8_t aFlag)
inline bool getPrecisionCleanedLBuffer(uint8_t aFlag)
inline bool getPrecisionCumulatedLBuffer(uint8_t aFlag)
inline bool getPrecisionEnergyFluence(uint8_t aFlag)
inline bool getPrecisionSumMuXdX(uint8_t aFlag)
inline bool getPrecisionZBuffer(uint8_t aFlag)
inline bool isFullPrecision(uint8_t aFlag)
inline bool isHalfPrecision(uint8_t aFlag)
inline bool isMixedPrecision(uint8_t aFlag)

Variables

const double Pi = 3.14159265358979323846

Pi.

const double Pi_2 = Pi / 2.0

Pi divided by 2.0.

const double N_Avogadro = 6.02552 * 1.0e23

Avogadro number.

const unsigned short Z_H = 1

Hydrogen atomic number.

const unsigned short Z_C = 6

Carbon atomic number.

const unsigned short Z_N = 7

Nitrogen atomic number.

const unsigned short Z_O = 8

Oxygen atomic number.

const unsigned short Z_Na = 11

Sodium atomic number.

const unsigned short Z_Mg = 12

Magnesium atomic number.

const unsigned short Z_P = 15

Phosphorus atomic number.

const unsigned short Z_S = 16

Sulfur atomic number.

const unsigned short Z_Cl = 17

Chlorine atomic number.

const unsigned short Z_Ar = 18

Argon atomic number.

const unsigned short Z_K = 19

Potassium atomic number.

const unsigned short Z_Ca = 20

Calcium atomic number.

const unsigned short Z_Ti = 22

Titanium atomic number.

const unsigned short Z_Fe = 26

Iron atomic number.

const unsigned short Z_Cu = 29

Copper atomic number.

const unsigned short Z_Zn = 30

Zinc atomic number.

const unsigned short Z_Ag = 47

Silver atomic number.

const unsigned short Z_Sn = 50

Tin atomic number.

const unsigned short Z_I = 53

Iodine atomic number.

Logger LOGGER
std::vector<MATRIX4> g_p_modelview_matrix_stack

The stack of model/view matrices.

std::vector<MATRIX4> g_p_projection_matrix_stack

The stack of projection matrix.

MATRIX4 g_current_modelview_matrix

The model/view matrices.

MATRIX4 g_current_projection_matrix

The projection matrix.

std::vector<int> g_frame_buffer_object_stack

The stack of FBO binding.

std::vector<std::pair<int, int>> g_texture_stack

The stack of texture binding.

std::vector<std::pair<int, bool>> g_enable_disable_state_stack

The stack of enable/disable states.

std::vector<int> g_shader_program_stack

The stack of shader programs.

const double kilometer = 1000.0 / 0.001

kilometre

const double hectometer = 100.0 / 0.001

hectometre

const double decameter = 10.0 / 0.001

decametre

const double meter = 1.0 / 0.001

metre

const double decimeter = 0.1 / 0.001

decimetre

const double centimeter = 0.01 / 0.001

centimetre

const double millimeter = 0.001 / 0.001

millimetre

const double micrometer = 1.0e-6 / 0.001

micrometre

const double kilometre = kilometer

kilometre

const double hectometre = hectometer

hectometre

const double decametre = decameter

decametre

const double metre = meter

metre

const double decimetre = decimeter

decimetre

const double centimetre = centimeter

centimetre

const double millimetre = millimeter

millimetre

const double micrometre = micrometer

micrometre

const double km = kilometer

kilometre

const double hm = hectometer

hectometre

const double dam = decameter

decametre

const double m = meter

meter

const double dm = decimeter

decimeter

const double cm = centimeter

centimeter

const double mm = millimeter

millimeter

const double um = micrometer

micrometre

const double km2 = km * km

square kilometre

const double hm2 = hm * hm

square hectometre

const double dam2 = dam * dam

square decametre

const double m2 = m * m

square meter

const double dm2 = dm * dm

square decimeter

const double cm2 = cm * cm

square centimeter

const double mm2 = mm * mm

square millimeter

const double um2 = um * um

square micrometre

const double km3 = km * km * km

cubic kilometre

const double hm3 = hm * hm * hm

cubic hectometre

const double dam3 = dam * dam * dam

cubic decametre

const double m3 = m * m * m

cubic meter

const double dm3 = dm * dm * dm

cubic decimeter

const double cm3 = cm * cm * cm

cubic centimeter

const double mm3 = mm * mm * mm

cubic millimeter

const double um3 = um * um * um

cubic micrometre

const double megaelectronvolt = 1.0

megaelectron volt

const double kiloelectronvolt = megaelectronvolt * 1.0e-3

kiloelectron volt

const double electronvolt = megaelectronvolt * 1.0e-6

electronvolt

const double MeV = megaelectronvolt

megaelectron volt

const double keV = kiloelectronvolt

kiloelectron volt

const double eV = electronvolt

electronvolt

const double kilogram = 1000.0

kilogram

const double hectogram = 100.0

hectogram

const double decagram = 10.0

decagram

const double gram = 1.0

gram

const double decigram = 0.1

decigram

const double centigram = 0.01

centigram

const double milligram = 0.001

milligram

const double microgram = 1e-6

microgram

const double kg = kilogram

kilogram

const double hg = hectogram

hectogram

const double dag = decagram

decagram

const double g = gram

gram

const double dg = decigram

decigram

const double cg = centigram

centigram

const double mg = milligram

milligram

const double ug = microgram

microgram

const double mole = 1.0

mole

const double megavolt = 1.0

mega volt

const double kilovolt = megavolt * 1.0e-3

kilo volt

const double volt = megavolt * 1.0e-6

volt

const double MV = megavolt

mega volt

const double kV = kilovolt

kilo volt

const double V = volt

volt

namespace MixedPrecisionFlags

Variables

constexpr uint8_t UncleanedLBuffer = 1 << 0
constexpr uint8_t CleanedLBuffer = 1 << 1
constexpr uint8_t CumulatedLBuffer = 1 << 2
constexpr uint8_t EnergyFluence = 1 << 3
constexpr uint8_t SumMuXdX = 1 << 4
constexpr uint8_t ZBuffer = 1 << 5
namespace std

STL namespace.

file gVirtualXRayConfig.h
#include <GL/glcorearb.h>

Defines

gVirtualXRay_VERSION_MAJOR
gVirtualXRay_VERSION_MINOR
gVirtualXRay_VERSION_PATCH
GL_GLEXT_PROTOTYPES
M_PI
gvxr_VERSION
file AnatomicalMesh.h
#include <string>
#include “gVirtualXRay/Matrix4x4.h

Class to handle a polygon mesh for tissue.

Version

1.0

Date

18/07/2016

Author

Andreas Meuleman

file AssimpSceneGraphBinder.h
#include <string>
#include “gVirtualXRay/Types.h
file AtomicElement.h
#include <vector>
#include <string>
#include “AtomicElement.inl

Class to manage elements in material.

Todo:

Merge the energy set and mass attenuation set using std::pair<double, double>

Version

1.0

Date

13/10/2014

License BSD 3-Clause License.

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file AtomicElement.inl
#include <xraylib.h>
#include “gVirtualXRay/Units.h

Class to manage elements in material.

License BSD 3-Clause License.

Version

1.0

Date

13/10/2014

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file AttenuationCoefficient.h
#include “gVirtualXRay/Types.h

Class to manage an attenuation coefficient.

License BSD 3-Clause License.

Version

1.0

Date

30/11/2013

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file AttenuationCoefficient.inl

Class to manage an attenuation coefficient.

License BSD 3-Clause License.

Version

1.0

Date

30/11/2013

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file BoneMesh.h

Class to handle a polygon mesh for Bone with thin bumps stored using a 3D texture.

Version

1.0

Date

18/07/2016

Author

Andreas Meuleman

file ConstantValues.h

Constant values, such as the Z number of different atoms, etc.

License BSD 3-Clause License.

Version

1.0

Date

10/04/2024

Author

Prof Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal, Bangor University, Apr 2014-Sept 2023, version 1.1, BSD 3-Clause License (c) by Prof Franck P. Vidal (franck.vidal@stfc.ac.uk), UK Research and Innovation, Oct 2023-present, version 1.1, BSD 3-Clause License

Defines

RATIONAL_NUMBER_MAX

Biggest value that can be stored with a real number.

EPSILON

Smallest value that can be stored with a real number.

file Context.h
#include <string>
#include <vector>

Create an OpenGL context using EGL or GLFW.

License BSD 3-Clause License.

Version

1.0

Date

18/04/2024

Author

Prof Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal, Bangor University, Sept 2020-Sept 2023, version 1.1, BSD 3-Clause License (c) by Prof Franck P. Vidal (franck.vidal@stfc.ac.uk), UK Research and Innovation, Oct 2023-present, version 1.1, BSD 3-Clause License

Defines

EGL_NO_X11
MESA_EGL_NO_X11_HEADERS
file CoordinateSystemMesh.h
#include “gVirtualXRay/LineMesh.h
#include “CoordinateSystemMesh.inl

Class to handle coordinate system meshes.

License BSD 3-Clause License.

Version

1.0

Date

20/11/2023

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Nov 2023, 2023, version 1.1, BSD 3-Clause License

file CoordinateSystemMesh.inl

Class to handle coordinate system meshes.

License BSD 3-Clause License.

Version

1.0

Date

20/11/2023

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Nov 2023, 2023, version 1.1, BSD 3-Clause License

file CubeMesh.h
#include “CubeMesh.inl

Class to handle 3D meshes of cubes.

Todo:

Make it possible to merge vertices if an array of indices exists

Version

1.0

Date

23/03/2014

Author

Dr Franck P. Vidal

License BSD 3-Clause License.

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file CubeMesh.inl

Class to handle 3D meshes of cubes.

Todo:

Make it possible to merge vertices if an array of indices exists

Version

1.0

Date

23/03/2014

Author

Dr Franck P. Vidal

License BSD 3-Clause License.

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file CuboidMesh.h
#include “CuboidMesh.inl

Class to handle 3D meshes of cuboids.

Todo:

Make it possible to merge vertices if an array of indices exists

Version

1.0

Date

26/06/2023

Author

Dr Franck P. Vidal

License BSD 3-Clause License.

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jun 2023, 2023, version 1.0, BSD 3-Clause License

file CuboidMesh.inl

Class to handle 3D meshes of cuboids.

Todo:

Make it possible to merge vertices if an array of indices exists

Version

1.0

Date

26/06/2023

Author

Dr Franck P. Vidal

License BSD 3-Clause License.

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jun 2023, 2023, version 1.0, BSD 3-Clause License

file CylinderMesh.h
#include “gVirtualXRay/Types.h
#include “CylinderMesh.inl

Class to handle 3D meshes of cylinders.

License BSD 3-Clause License.

Version

1.0

Date

16/05/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, May 2017, 2017, version 1.1, BSD 3-Clause License

file CylinderMesh.inl

Class to handle 3D meshes of cylinders.

License BSD 3-Clause License.

Version

1.0

Date

17/04/2024

Author

Prof Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal, Bangor University, May 2017-Sept 2023, version 1.1, BSD 3-Clause License (c) by Prof Franck P. Vidal (franck.vidal@stfc.ac.uk), UK Research and Innovation, Oct 2023-present, version 1.1, BSD 3-Clause License

file DepthMap.h
#include <vector>
#include “gVirtualXRay/Matrix4x4.h
#include “gVirtualXRay/Shader.h

Class to render to a buffer in order to create, for exemple, a shadow map.

Version

1.0

Date

19/07/2016

Author

Andreas Meuleman

file DiaphragmMesh.h

Class to handle a polygon mesh for a diaphragm.

Version

1.0

Date

18/07/2016

Author

Andreas Meuleman

file ElementSet.h
#include <iostream>
#include <map>
#include <string>
#include “ElementSet.inl

Class to manage a table of elements in material.

License BSD 3-Clause License.

Version

1.0

Date

13/10/2014

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file ElementSet.inl

Class to manage a table of elements in material.

License BSD 3-Clause License.

Version

1.0

Date

13/10/2014

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file Exception.h
#include <string>
#include <exception>
#include “Exception.inl

Generic class to handle exceptions.

License BSD 3-Clause License.

Version

1.0

Date

07/11/2013

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file Exception.inl
#include <sstream>

Generic class to handle exceptions.

License BSD 3-Clause License.

Version

1.0

Date

07/11/2013

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file FBOException.h
#include “gVirtualXRay/Exception.h

Class to handle exceptions related to frame buffer objects (FBOs).

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.0, BSD 3-Clause License

file FFT.h
#include <string>
#include “gVirtualXRay/Image.h
#include “FFT.inl

Class to compute the FFT of a greyscale image.

Version

1.0

Date

13/01/2017

Author

Franck Vidal

file FFT.inl
#include <cmath>
#include <complex>
#include “Exception.h

Class to handle a greyscale image.

License BSD 3-Clause License.

Date

17/04/2024

Author

Prof Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal, Bangor University, Nov 2016-Sept 2023, version 1.1, BSD 3-Clause License (c) by Prof Franck P. Vidal (franck.vidal@stfc.ac.uk), UK Research and Innovation, Oct 2023-present, version 1.1, BSD 3-Clause License

file FileDoesNotExistException.h
#include <string>
#include “gVirtualXRay/Exception.h

Class to handle exceptions when trying to open a read-only file that is not accessible.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.0, BSD 3-Clause License

file FileDoesNotExistException.inl
#include <sstream>

Class to handle exceptions when trying to open a read-only file that is not accessible.

License BSD 3-Clause License.

Version

1.0

Date

30/11/2013

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file filesystem.h
#include <experimental/filesystem>

Defines

INCLUDE_STD_FILESYSTEM_EXPERIMENTAL
file framebufferObject.h
#include <iostream>
file GeodeFinder.h
file Image.h
#include <string>
#include <map>
#include “gVirtualXRay/Types.h
#include “Image.inl

Class to handle a greyscale image.

Todo:

Fix problem in marchingCubes (normals?). See bug in demos (ImplicitSurface and SimpleBackProjection)

Version

1.0

Date

30/09/2016

Author

Franck Vidal

Defines

NOMINMAX
TIFF_UINT16_T
TIFF_UINT32_T
file Image.inl
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <vector>
#include <typeinfo>
#include <zlib.h>
#include “gVirtualXRay/Utilities.h
#include “gVirtualXRay/Exception.h
#include “gVirtualXRay/Logger.h
#include “gVirtualXRay/Shader.h

Class to handle a greyscale image.

License BSD 3-Clause License.

Date

17/04/2024

Author

Prof Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal, Bangor University, Nov 2016-Sept 2023, version 1.1, BSD 3-Clause License (c) by Prof Franck P. Vidal (franck.vidal@stfc.ac.uk), UK Research and Innovation, Oct 2023-present, version 1.1, BSD 3-Clause License

Defines

LINE_SIZE
file ImplicitSurface.h
#include <vector>
#include “gVirtualXRay/Types.h
#include “gVirtualXRay/Image.h
#include “ImplicitSurface.inl

Class to build 3D implicit surfaces. To know what implicit surfaces are, please visit Paul Bourke’s tutorial available at http://paulbourke.net/geometry/implicitsurf/.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file ImplicitSurface.inl
#include <cmath>

Class to build 3D implicit surfaces. To know what implicit surfaces are, please visit Paul Bourke’s tutorial available at http://paulbourke.net/geometry/implicitsurf/.

License BSD 3-Clause License.

Version

1.0

Date

08/03/2014

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file InternalOrganMesh.h
#include “gVirtualXRay/Shader.h

Class to handle a polygon mesh for an internal organ.

Version

1.0

Date

13/01/2017

Author

Andreas Meuleman

file InvalidImageSizeException.h
#include “gVirtualXRay/Exception.h

Class to handle exceptions when the image size is wrong.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.0, BSD 3-Clause License

file InvalidImageSizeException.inl
#include <sstream>

Class to handle exceptions when the image size is wrong.

License BSD 3-Clause License.

Version

1.0

Date

26/12/2014

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file InvalidInternalFormalException.h
#include “gVirtualXRay/Exception.h

Class to handle exceptions when an invalid internal format has been specified.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.0, BSD 3-Clause License

file InvalidInternalFormalException.inl

Class to handle exceptions when an invalid internal format has been specified.

License BSD 3-Clause License.

Version

1.0

Date

26/12/2014

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file LineMesh.h
#include “LineMesh.inl

Class to handle 3D meshes of line segments.

Todo:

Make it possible to merge vertices if an array of indices exists

Version

1.0

Date

20/11/2023

Author

Dr Franck P. Vidal

License BSD 3-Clause License.

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Nov 2023, 2023, version 1.0, BSD 3-Clause License

file LineMesh.inl

Class to handle 3D meshes of line segments.

Todo:

Make it possible to merge vertices if an array of indices exists

Version

1.0

Date

20/11/2023

Author

Dr Franck P. Vidal

License BSD 3-Clause License.

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Nov 2023, 2023, version 1.0, BSD 3-Clause License

file LiverMesh.h

Class to handle a polygon mesh for a liver. It uses 3D texture for the bump map and 2D texture for the colour.

Version

1.0

Date

13/01/2017

Author

Andreas Meuleman

file Logger.h
#include <string>
#include <fstream>
file LungsMesh.h

Class to handle a polygon mesh for lungs. It uses 2D texture for the bump map and 3D texture for the colour.

Version

1.0

Date

13/01/2017

Author

Andreas Meuleman

file Material.h
#include “Material.inl

Class to handle a material.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.0, BSD 3-Clause License

file Material.inl

Class to handle a material.

License BSD 3-Clause License.

Version

1.0

Date

21/10/2014

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file MaterialSet.h
#include <iostream>
#include <map>
#include <string>
#include “TissueMaterial.h
#include “MaterialSet.inl

Class to manage a table of materials.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.0, BSD 3-Clause License

file MaterialSet.inl

Class to manage a table of materials.

License BSD 3-Clause License.

Version

1.0

Date

13/10/2014

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file Matrix4x4.h
#include <vector>
#include “gVirtualXRay/Vec3.h
#include “Matrix4x4.inl

Template class to handle a 4x4 matrixs.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.0, BSD 3-Clause License

file Matrix4x4.inl
#include <iostream>
#include <cmath>
#include <cstring>
#include “gVirtualXRay/Exception.h

Template class to handle 4x4 matrices.

License BSD 3-Clause License.

Version

1.0

Date

17/04/2024

Author

Prof Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal, Bangor University, Nov 2013-Sept 2023, version 1.1, BSD 3-Clause License (c) by Prof Franck P. Vidal (franck.vidal@stfc.ac.uk), UK Research and Innovation, Oct 2023-present, version 1.1, BSD 3-Clause License

file Mixture.h
#include <map>
#include <string>
#include “Mixture.inl

Class to manage a mixture (e.g. Ti90Al6V4).

License BSD 3-Clause License.

Version

1.0

Date

27/09/2018

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Sept 2018, 2018, version 1.1, BSD 3-Clause License

file Mixture.inl

Class to manage a mixture (e.g. Ti90Al6V4).

License BSD 3-Clause License.

Version

1.0

Date

27/09/2018

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Sept 2018, 2018, version 1.0, BSD 3-Clause License

file NoBeamException.h
#include “gVirtualXRay/Exception.h
#include “NoBeamException.inl

Class to handle exceptions when no beam spectrum has been registered.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.0, BSD 3-Clause License

file NoBeamException.inl

Class to handle exceptions when no beam spectrum has been registered.

License BSD 3-Clause License.

Version

1.0

Date

26/12/2014

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file NoDetectorException.h
#include “gVirtualXRay/Exception.h
#include “NoDetectorException.inl

Class to handle exceptions when no detector has been registered.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.0, BSD 3-Clause License

file NoDetectorException.inl

Class to handle exceptions when no detector has been registered.

License BSD 3-Clause License.

Version

1.0

Date

26/12/2014

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file NotImplementedException.h
#include “gVirtualXRay/Exception.h

Class to handle exceptions when accessing a function that is not implemented.

License BSD 3-Clause License.

Version

1.0

Date

13/10/2025

Author

Prof Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Prof Franck P. Vidal (franck.vidal@stfc.ac.uk), https://gvirtualxray.sourceforge.io/, Oct 2025, 2025, version 1.1, BSD 3-Clause License

file NotImplementedException.inl

Class to handle exceptions when accessing a function that is not implemented.

License BSD 3-Clause License.

Version

1.0

Date

13/10/2025

Author

Prof Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Prof Franck P. Vidal (franck.vidal@stfc.ac.uk), https://gvirtualxray.sourceforge.io/, Oct 2025, 2025, version 1.1, BSD 3-Clause License

file OpenGL2VBO.h
#include “gVirtualXRay/VBO.h
#include “OpenGL2VBO.inl

Class to handle vertex buffer objects (VBOs) in OpenGL 2.x.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.1, BSD 3-Clause License

file OpenGL2VBO.inl

Class to handle vertex buffer objects (VBOs) in OpenGL 2.x.

License BSD 3-Clause License.

Version

1.0

Date

07/08/2014

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file OpenGL3VBO.h
#include “gVirtualXRay/VBO.h
#include “OpenGL3VBO.inl

Class to handle vertex buffer objects (VBOs) in OpenGL 3.x or 4.x.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.1, BSD 3-Clause License

file OpenGL3VBO.inl

Class to handle vertex buffer objects (VBOs) in OpenGL 3.x or 4.x.

License BSD 3-Clause License.

Version

1.0

Date

07/08/2014

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file OpenGLException.h
#include “gVirtualXRay/Exception.h

Class to handle exceptions related to OpenGL.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.1, BSD 3-Clause License

file OpenGLUtilities.h
#include <vector>
#include “gVirtualXRay/Matrix4x4.h
#include “gVirtualXRay/Types.h
#include “gVirtualXRay/VBO.h
#include “OpenGLUtilities.inl

Some utility functions about OpenGL. Now supports GLSL450 and OpenGL 4.5.

License BSD 3-Clause License.

Version

1.0

Date

25/02/2020

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Feb 2020, 2020, version 1.0, BSD 3-Clause License

file OpenGLUtilities.inl
#include <cmath>
#include “gVirtualXRay/Types.h

Some utility functions about OpenGL. Now supports GLSL450 and OpenGL 4.5.

License BSD 3-Clause License.

Version

1.0

Date

17/04/2024

Author

Prof Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal, Bangor University, Fev 2020-Sept 2023, version 1.1, BSD 3-Clause License (c) by Prof Franck P. Vidal (franck.vidal@stfc.ac.uk), UK Research and Innovation, Oct 2023-present, version 1.1, BSD 3-Clause License

file OpenSceneGraphBinder.h
file OutOfBoundsException.h
#include “gVirtualXRay/Exception.h
#include “OutOfBoundsException.inl

Class to handle exceptions when accessing an array cell that is not accessible, i.e. out of bounds memory access.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.1, BSD 3-Clause License

file OutOfBoundsException.inl

Class to handle exceptions when accessing an array cell that is not accessible, i.e. out of bounds memory access.

License BSD 3-Clause License.

Version

1.0

Date

30/11/2013

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file OutOfMemoryException.h
#include “gVirtualXRay/Exception.h
#include “OutOfMemoryException.inl

Class to handle exceptions when memory cannot be allocated dynamically.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.1, BSD 3-Clause License

file OutOfMemoryException.inl

Class to handle exceptions when memory cannot be allocated dynamically.

License BSD 3-Clause License.

Version

1.0

Date

30/11/2013

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file PhotonCrossSection.h
#include “gVirtualXRay/Mixture.h
#include “PhotonCrossSection.inl

Class to manage photon cross sections of elements, compounds and mixtures.

License BSD 3-Clause License.

Version

1.0

Date

27/09/2018

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file PhotonCrossSection.inl
#include <string>

Class to manage photon cross sections of elements, compounds and mixtures.

License BSD 3-Clause License.

Version

1.0

Date

27/09/2018

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file PolygonMesh.h
#include <string>
#include <vector>
#include <map>
#include <memory>
#include “gVirtualXRay/VBO.h
#include “gVirtualXRay/Types.h
#include “gVirtualXRay/Units.h
#include “gVirtualXRay/Material.h
#include “PolygonMesh.inl

Class to handle polygon (triangles) meshes.

Todo:

Make it possible to merge vertices if an array of indices exists Convert triangle mesh into arbitrary polygon mesh

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

License BSD 3-Clause License.

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.1, BSD 3-Clause License

file PolygonMesh.inl
#include “gVirtualXRay/Utilities.h

Class to handle polygon (triangles) meshes.

Todo:

Make it possible to merge vertices if an array of indices exists Convert triangle mesh into arbitrary polygon mesh

Version

1.0

Date

24/08/2016

Author

Dr Franck P. Vidal

License BSD 3-Clause License.

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file PythonSingleton.h
#include <string>
#include <memory>
#include “PythonSingleton.inl

Singleton to handle the initialisation and release of Python.

License BSD 3-Clause License.

Version

1.0

Date

21/09/2023

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Sept 2023, 2023, version 1.1, BSD 3-Clause License

file PythonSingleton.inl

Singleton to handle the initialisation and release of Python.

License BSD 3-Clause License.

Version

1.0

Date

21/09/2023

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Sept 2023, 2023, version 1.1, BSD 3-Clause License

file Random.h
#include <utility>
#include “gVirtualXRay/Random.inl

Functions

inline float mod(float x, float y)
inline float fract(float x)
inline unsigned int getSeed(float s)
unsigned TausStep(unsigned int &z, int S1, int S2, int S3, unsigned int M)
inline unsigned LCGStep(unsigned int &z, unsigned int A, unsigned int C)
inline float HybridTaus(unsigned int &z1, unsigned int &z2, unsigned int &z3, unsigned int &z4)
inline float generateUniformNoise(unsigned int &z1, unsigned int &z2, unsigned int &z3, unsigned int &z4)
inline std::pair<float, float> generateGaussianNoise(float mu, float sigma, unsigned int &z1, unsigned int &z2, unsigned int &z3, unsigned int &z4)
inline unsigned int generatePoissonNoise(unsigned int aValue, unsigned int &z1, unsigned int &z2, unsigned int &z3, unsigned int &z4, unsigned int aCutOffValue = 50)
file Random.inl
#include <climits>
#include <cmath>

Defines

_USE_MATH_DEFINES
M_PI

Functions

inline float mod(float x, float y)
inline float fract(float x)
inline unsigned int getSeed(float s)
unsigned TausStep(unsigned int &z, int S1, int S2, int S3, unsigned int M)
inline unsigned LCGStep(unsigned int &z, unsigned int A, unsigned int C)
inline float HybridTaus(unsigned int &z1, unsigned int &z2, unsigned int &z3, unsigned int &z4)
inline float generateUniformNoise(unsigned int &z1, unsigned int &z2, unsigned int &z3, unsigned int &z4)
inline std::pair<float, float> generateGaussianNoise(float mu, float sigma, unsigned int &z1, unsigned int &z2, unsigned int &z3, unsigned int &z4)
inline unsigned int generatePoissonNoise(unsigned int aValue, unsigned int &z1, unsigned int &z2, unsigned int &z3, unsigned int &z4, unsigned int aCutOffValue)
file ResourceManager.h
#include <vector>
file SceneGraphBinder.h
#include <map>
#include <string>
#include “gVirtualXRay/Types.h
file SceneGraphNode.h
#include <string>
#include <vector>
#include “gVirtualXRay/Types.h
file Scintillator.h
#include <string>
#include <vector>
#include <utility>
#include “gVirtualXRay/Types.h
#include “Scintillator.inl

Class to generate the energy response due to the scintillator of the X-Ray detector.

License BSD 3-Clause License.

Version

1.0

Date

18/10/2022

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Oct 2022, 2022, version 1.1, BSD 3-Clause License

file Scintillator.inl
#include <cmath>
#include <fstream>
#include <algorithm>
#include <xraylib.h>
#include “gVirtualXRay/Exception.h
#include “gVirtualXRay/Units.h
#include “gVirtualXRay/Utilities.h

Class to generate the energy response due to the scintillator of the X-Ray detector.

License BSD 3-Clause License.

Version

1.0

Date

18/10/2022

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Oct 2022, 2022, version 1.1, BSD 3-Clause License

file Shader.h
#include <string>
#include “Shader.inl

Class to handle GLSL shaders.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.1, BSD 3-Clause License

file Shader.inl

Class to handle GLSL shaders.

License BSD 3-Clause License.

Version

1.0

Date

29/11/2013

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file Sinogram.h
#include <string>
#include “gVirtualXRay/Image.h
#include “Sinogram.inl

Class to reconstruct images from a sinogram.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Franck Vidal

Date

17/04/2024

Author

Prof Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal, Bangor University, Sept 2016-Sept 2023, version 1.1, BSD 3-Clause License (c) by Prof Franck P. Vidal (franck.vidal@stfc.ac.uk), UK Research and Innovation, Oct 2023-present, version 1.1, BSD 3-Clause License

file Sinogram.inl
#include “gVirtualXRay/FFT.h
file SkinMesh.h

Class to handle a polygon mesh for Skin.

Version

1.0

Date

13/01/2017

Author

Andreas Meuleman

file SoftTissueMesh.h

Class to handle a polygon mesh for an internal organ.

Version

1.0

Date

13/01/2017

Author

Andreas Meuleman

file SpectrumRecord.h
#include “gVirtualXRay/Types.h
#include “SpectrumRecord.inl

Class to manage a record of the X-Ray beam, i.e. an energy bin (number of photons, energy of the photons in the bin).

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.1, BSD 3-Clause License

file SpectrumRecord.inl
#include “gVirtualXRay/Units.h

Class to manage a record of the X-Ray beam, i.e. an energy bin (number of photons, energy of the photons in the bin).

License BSD 3-Clause License.

Version

1.0

Date

30/11/2013

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file SphereMesh.h
#include “gVirtualXRay/Types.h
#include “SphereMesh.inl

Class to handle 3D meshes of spheres.

Todo:

Make it possible to merge vertices if an array of indices exists

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

License BSD 3-Clause License.

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.1, BSD 3-Clause License

file SphereMesh.inl

Class to handle 3D meshes of spheres.

Todo:

Make it possible to merge vertices if an array of indices exists

Version

1.0

Date

22/03/2014

Author

Dr Franck P. Vidal

License BSD 3-Clause License.

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file StepWedgeMesh.h
#include “StepWedgeMesh.inl

Class to handle 3D meshes of step wedges.

License BSD 3-Clause License.

Version

1.0

Date

10/07/2024

Author

Prof Franck P. Vidal

Author

Mr Nalin Gupta

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Prof Franck P. Vidal (franck.vidal@stfc.ac.uk), UK Research and Innovation, Jul 2024-present, version 1.1, BSD 3-Clause License (c) by Mr Nalin Gupta, UK Research and Innovation, Jul 2024-present, version 1.1, BSD 3-Clause License

file StepWedgeMesh.inl
#include “gVirtualXRay/Logger.h

Class to handle 3D meshes of step wedges.

License BSD 3-Clause License.

Version

1.0

Date

10/07/2024

Author

Prof Franck P. Vidal

Author

Mr Nalin Gupta

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Prof Franck P. Vidal (franck.vidal@stfc.ac.uk), UK Research and Innovation, Jul 2024-present, version 1.1, BSD 3-Clause License (c) by Mr Nalin Gupta, UK Research and Innovation, Jul 2024-present, version 1.1, BSD 3-Clause License

file StereoHelper.h
#include “gVirtualXRay/Matrix4x4.h
#include “gVirtualXRay/Types.h
#include “StereoHelper.inl

Class to handle stereo vision using OpenGL’s quad buffer. The code is relying on http://www.orthostereo.com/geometryopengl.html.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.1, BSD 3-Clause License

file StereoHelper.inl

Class to handle stereo vision using OpenGL’s quad buffer. The code is relying on // http://www.orthostereo.com/geometryopengl.html.

License BSD 3-Clause License.

Version

1.0

Date

14/02/2014

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file TextRenderer.h
#include <map>
#include <memory>
#include “gVirtualXRay/Shader.h
#include “TextRenderer.inl

Class to render text using OpenGL and FreeType2.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.1, BSD 3-Clause License

file TextRenderer.inl

Class to render text using OpenGL and FreeType2.

License BSD 3-Clause License.

Version

1.0

Date

16/11/2014

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file TissueMaterial.h
#include “gVirtualXRay/Mixture.h
#include <map>
#include <string>
#include “TissueMaterial.inl

Class to manage a material database. It implements the method as follows: Schneider W, Bortfeld T, Schlegel W.: `Correlation between CT numbers and tissue parameters needed for Monte Carlo simulations of clinical dose distributions’, Phys Med Biol. 2000 Feb;45(2):459-78.

License BSD 3-Clause License.

Version

1.0

Date

10/04/2024

Author

Prof Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal, Bangor University, Dec 2013-Sept 2023, version 1.1, BSD 3-Clause License (c) by Prof Franck P. Vidal (franck.vidal@stfc.ac.uk), UK Research and Innovation, Oct 2023-present, version 1.1, BSD 3-Clause License

file TissueMaterial.inl

Class to manage a material database. It implements the method as follows: Schneider W, Bortfeld T, Schlegel W.: `Correlation between CT numbers and tissue parameters needed for Monte Carlo simulations of clinical dose distributions’, Phys Med Biol. 2000 Feb;45(2):459-78.

License BSD 3-Clause License.

Version

1.0

Date

13/10/2014

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file Types.h
#include “gVirtualXRay/Vec3.h
#include “gVirtualXRay/Vec2.h
#include “gVirtualXRay/Matrix4x4.h

Type declarations.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.1, BSD 3-Clause License

file Units.h

Units, such as meters, etc.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.1, BSD 3-Clause License

file Utilities.h
#include <string>
#include “Utilities.inl

Some utility functions that do not fit anywhere else.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.1, BSD 3-Clause License

file Utilities.inl

Some utility functions that do not fit anywhere else.

License BSD 3-Clause License.

Version

1.0

Date

17/04/2024

Author

Prof Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal, Bangor University, Aug 2016-Sept 2023, version 1.1, BSD 3-Clause License (c) by Prof Franck P. Vidal (franck.vidal@stfc.ac.uk), UK Research and Innovation, Oct 2023-present, version 1.1, BSD 3-Clause License

file VBO.h
#include “VBO.inl

Class to handle vertex buffer objects (VBOs).

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.1, BSD 3-Clause License

file VBO.inl
#include <cstring>

Class to handle vertex buffer objects (VBOs).

License BSD 3-Clause License.

Version

1.0

Date

07/11/2013

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

Defines

VBO_BUFFER_OFFSET(a)
VERTEX_SET_ID
TEXT_COORD_SET_ID
NORMAL_SET_ID
ADDITIONAL_DATA_ID
INDEX_SET_ID
file Vec2.h
#include “Vec2.inl

Template class to handle 2D vectors.

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.1, BSD 3-Clause License

file Vec2.inl

Template class to handle 2D vectors.

License BSD 3-Clause License.

Version

1.0

Date

11/11/2013

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file Vec3.h
#include <iostream>
#include “Vec3.inl

Template class to handle 3D vectors.

Todo:

Add an exception in Length(). Add a header for constants, use EPSILON instead of 0.0000001

License BSD 3-Clause License.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.1, BSD 3-Clause License

file Vec3.inl
#include <cmath>

Template class to handle 3D vectors.

Todo:

Add an exception in Length(). Add a header for constants, use EPSILON instead of 0.0000001

License BSD 3-Clause License.

Version

1.0

Date

11/11/2013

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

file XRayBeam.h
#include <vector>
#include <string>
#include <iostream>
#include <memory>
#include “xsec.h”
#include “gVirtualXRay/Types.h
#include “XRayBeam.inl

Class to manage X-Ray beams. The beam spectrum is discretised into energy channels.

Todo:

Make sure the filtration functionality works with photon counting detectors.

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

License BSD 3-Clause License.

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.1, BSD 3-Clause License

file XRayBeam.inl
#include <cfloat>
#include <algorithm>

Class to manage X-Ray beams. The beam spectrum is discretised into energy channels.

License BSD 3-Clause License.

Version

1.0

Date

29/11/2013

Author

Dr Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Dec 2014, 2014, version 1.0, BSD 3-Clause License

Defines

DEFAULT_VOLTAGE
DEFAULT_TUBE_ANGLE
DEFAULT_mAs
file XRayDetector.h
#include <memory>
#include <vector>
#include <utility>
#include “gVirtualXRay/Types.h
#include “gVirtualXRay/Matrix4x4.h
#include “gVirtualXRay/VBO.h
#include “gVirtualXRay/CubeMesh.h
#include “gVirtualXRay/Image.h
#include “XRayDetector.inl

Class to handle virtual X-Ray detectors.

Todo:

Create a class to draw spheres Use this class to display point sources (see line 80 in file XRayDetector.inl)

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

License BSD 3-Clause License.

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net), http://www.fpvidal.net/, Jan 2017, 2017, version 1.1, BSD 3-Clause License

file XRayDetector.inl
#include <cmath>
#include <fstream>
#include <sstream>
#include <iostream>
#include <numeric>

Class to handle virtual X-Ray detectors.

License BSD 3-Clause License.

Version

1.0

Date

10/04/2024

Author

Prof Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal, Bangor University, Nov 2013-Sept 2023, version 1.1, BSD 3-Clause License (c) by Prof Franck P. Vidal (franck.vidal@stfc.ac.uk), UK Research and Innovation, Oct 2023-present, version 1.1, BSD 3-Clause License

file XRayRenderer.h
#include <vector>
#include <map>
#include <string>
#include <memory>
#include <random>
#include <cstdint>
#include “gVirtualXRay/Image.h
#include “gVirtualXRay/Sinogram.h
#include “gVirtualXRay/XRayBeam.h
#include “gVirtualXRay/Shader.h
#include “gVirtualXRay/VBO.h
#include “XRayRenderer.inl

Class to compute and renderer X-ray images on GPU.

Todo:

Make sure m_CT_centre_of_rotation_position works well

Version

1.0

Date

13/01/2017

Author

Dr Franck P. Vidal

Functions to port to OpenMP: resetLBuffer preComputeLBuffer postComputeLBuffer computeInnerSurfaceLBuffer computeOuterSurfaceLBuffer computeSumMUxDx

            - pushProjectionMatrix
            - pushModelViewMatrix
            - popProjectionMatrix
            - popModelViewMatrix
            -
            -
            -
            -
            - updateCumulatedLBuffers
            - pushFBO
            - pushTexture3D
            - pushEnableDisableState
            - popTexture
            - popEnableDisableState
            - popFBO

License
BSD 3-Clause License.

For details on use and redistribution please refer
to http://opensource.org/licenses/BSD-3-Clause

Copyright
(c) by Dr Franck P. Vidal (franck.p.vidal@fpvidal.net),
http://www.fpvidal.net/, Jan 2017, 2017, version 1.1, BSD 3-Clause License

Defines

XRAY_DETECTOR_PBO_NUMBER

The total number of PBOs.

XRAY_DETECTOR_2D_TEXTURE_NUMBER

The total number of 2D textures.

XRAY_DETECTOR_3D_TEXTURE_NUMBER

The total number of 3D textures.

XRAY_DETECTOR_SHADER_NUMBER

program shaders

The total number of

file XRayRenderer.inl
#include <climits>
#include <algorithm>
#include <cmath>
#include <sstream>
#include “gVirtualXRay/Utilities.h

Class to compute and renderer X-ray images on GPU.

License BSD 3-Clause License.

Version

1.0

Date

10/04/2024

Author

Prof Franck P. Vidal

For details on use and redistribution please refer to http://opensource.org/licenses/BSD-3-Clause

Copyright (c) by Dr Franck P. Vidal, Bangor University, Dec 2013-Sept 2023, version 1.1, BSD 3-Clause License (c) by Prof Franck P. Vidal (franck.vidal@stfc.ac.uk), UK Research and Innovation, Oct 2023-present, version 1.1, BSD 3-Clause License

Defines

XRAY_DETECTOR_UNCLEANED_LBUFFER_FBO_ID
XRAY_DETECTOR_CLEANED_LBUFFER_FBO_ID
XRAY_DETECTOR_CUMULATED_LBUFFERS_FBO_ID
XRAY_DETECTOR_ENERGY_FLUENCE_FBO_ID
XRAY_DETECTOR_SUM_MUx_Dx_FBO_ID
XRAY_DETECTOR_UNCLEANED_LBUFFER_TEXTURE_NAME_ID
XRAY_DETECTOR_CLEANED_LBUFFER_TEXTURE_NAME_ID
XRAY_DETECTOR_CUMULATED_LBUFFERS_TEXTURE_NAME_ID
XRAY_DETECTOR_ENERGY_FLUENCE_TEXTURE_NAME_ID
XRAY_DETECTOR_SUM_MUx_Dx_TEXTURE_NAME_ID
XRAY_DETECTOR_ZBUFFER_TEXTURE_NAME_ID
page todo

File AtomicElement.h

Merge the energy set and mass attenuation set using std::pair<double, double>

File CubeMesh.h

Make it possible to merge vertices if an array of indices exists

File CubeMesh.inl

Make it possible to merge vertices if an array of indices exists

File CuboidMesh.h

Make it possible to merge vertices if an array of indices exists

File CuboidMesh.inl

Make it possible to merge vertices if an array of indices exists

File Image.h

Fix problem in marchingCubes (normals?). See bug in demos (ImplicitSurface and SimpleBackProjection)

File LineMesh.h

Make it possible to merge vertices if an array of indices exists

File LineMesh.inl

Make it possible to merge vertices if an array of indices exists

File PolygonMesh.h

Make it possible to merge vertices if an array of indices exists Convert triangle mesh into arbitrary polygon mesh

File PolygonMesh.inl

Make it possible to merge vertices if an array of indices exists Convert triangle mesh into arbitrary polygon mesh

File SphereMesh.h

Make it possible to merge vertices if an array of indices exists

File SphereMesh.inl

Make it possible to merge vertices if an array of indices exists

File Vec3.h

Add an exception in Length(). Add a header for constants, use EPSILON instead of 0.0000001

File Vec3.inl

Add an exception in Length(). Add a header for constants, use EPSILON instead of 0.0000001

File XRayBeam.h

Make sure the filtration functionality works with photon counting detectors.

File XRayDetector.h

Create a class to draw spheres Use this class to display point sources (see line 80 in file XRayDetector.inl)

File XRayRenderer.h

Make sure m_CT_centre_of_rotation_position works well

dir /io/build-doc/gvxr/gVirtualXRay
dir /io/gvxr/include/gVirtualXRay
dir /io/gvxr
dir /io/gvxr/include