fw4spl
fwData::Mesh Class Reference

Data holding a geometric structure composed of points, lines, triangles, quads or polygons. More...

#include <Mesh.hpp>

+ Inheritance diagram for fwData::Mesh:
+ Collaboration diagram for fwData::Mesh:

Public Types

enum  CellTypesEnum {
  NO_CELL = 0, POINT, EDGE, TRIANGLE,
  QUAD, POLY, TETRA
}
 
enum  ColorArrayTypes { RGB = 3, RGBA = 4 }
 
typedef std::map< std::string,::fwData::Array::sptr > ArrayMapType
 
typedef std::uint64_t Id
 
typedef float PointValueType
 
typedef std::uint8_t ColorValueType
 
typedef float NormalValueType
 
typedef float TexCoordValueType
 
typedef Id CellValueType
 
typedef Id CellDataOffsetType
 
typedef std::uint8_t CellTypes
 
typedef boost::multi_array_ref< PointValueType, 2 > PointsMultiArrayType
 
typedef boost::multi_array_ref< CellTypes, 1 > CellTypesMultiArrayType
 
typedef boost::multi_array_ref< CellValueType, 1 > CellDataMultiArrayType
 
typedef boost::multi_array_ref< CellDataOffsetType, 1 > CellDataOffsetsMultiArrayType
 
typedef boost::multi_array_ref< ColorValueType, 2 > PointColorsMultiArrayType
 
typedef boost::multi_array_ref< ColorValueType, 2 > CellColorsMultiArrayType
 
typedef boost::multi_array_ref< NormalValueType, 2 > PointNormalsMultiArrayType
 
typedef boost::multi_array_ref< NormalValueType, 2 > CellNormalsMultiArrayType
 
typedef boost::multi_array_ref< TexCoordValueType, 2 > PointTexCoordsMultiArrayType
 
typedef boost::multi_array_ref< TexCoordValueType, 2 > CellTexCoordsMultiArrayType
 
typedef boost::const_multi_array_ref< PointValueType, 2 > ConstPointsMultiArrayType
 
typedef boost::const_multi_array_ref< CellTypes, 1 > ConstCellTypesMultiArrayType
 
typedef boost::const_multi_array_ref< CellValueType, 1 > ConstCellDataMultiArrayType
 
typedef boost::const_multi_array_ref< CellDataOffsetType, 1 > ConstCellDataOffsetsMultiArrayType
 
typedef boost::const_multi_array_ref< ColorValueType, 2 > ConstPointColorsMultiArrayType
 
typedef boost::const_multi_array_ref< ColorValueType, 2 > ConstCellColorsMultiArrayType
 
typedef boost::const_multi_array_ref< NormalValueType, 2 > ConstPointNormalsMultiArrayType
 
typedef boost::const_multi_array_ref< NormalValueType, 2 > ConstCellNormalsMultiArrayType
 
typedef boost::const_multi_array_ref< TexCoordValueType, 2 > ConstPointTexCoordsMultiArrayType
 
typedef boost::const_multi_array_ref< TexCoordValueType, 2 > ConstCellTexCoordsMultiArrayType
 
typedef ::fwCom::Signal< void() > VertexModifiedSignalType
 Type of signal when vertex are modified.
 
typedef ::fwCom::Signal< void() > PointColorsModifiedSignalType
 Type of signal when point colors are modified.
 
typedef ::fwCom::Signal< void() > CellColorsModifiedSignalType
 Type of signal when cell colors are modified.
 
typedef ::fwCom::Signal< void() > PointNormalsModifiedSignalType
 Type of signal when point normals are modified.
 
typedef ::fwCom::Signal< void() > CellNormalsModifiedSignalType
 Type of signal when cell normals are modified.
 
typedef ::fwCom::Signal< void() > PointTexCoordsModifiedSignalType
 Type of signal when point tex coords are modified.
 
typedef ::fwCom::Signal< void() > CellTexCoordsModifiedSignalType
 Type of signal when cell tex coords are modified.
 
- Public Types inherited from fwData::Object
typedef ::fwData::factory::Key Key
 
typedef std::string FieldNameType
 
typedef std::vector< FieldNameType > FieldNameVectorType
 
typedef ::std::unordered_map< FieldNameType,::fwData::Object::sptr > FieldMapType
 
typedef ::std::unordered_map< ::fwData::Object::csptr,::fwData::Object::sptr > DeepCopyCacheType
 
typedef ::fwCom::Signal< void() > ModifiedSignalType
 Type of signal m_sigModified.
 
typedef std::map< std::string,::fwData::Object::sptr > FieldsContainerType
 Type of signal m_sigModified.
 
typedef ::fwCom::Signal< void(FieldsContainerType) > AddedFieldsSignalType
 Type of signal when objects are added.
 
typedef ::fwCom::Signal< void(FieldsContainerType, FieldsContainerType) > ChangedFieldsSignalType
 Type of signal when objects are changed (newObjects, oldObjects)
 
typedef ::fwCom::Signal< void(FieldsContainerType) > RemovedFieldsSignalType
 Type of signal when objects are removed.
 
- Public Types inherited from fwCom::HasSignals
typedef std::shared_ptr< HasSignalssptr
 
typedef std::shared_ptr< const HasSignalscsptr
 

Public Member Functions

virtual bool isA (const std::string &type) const override
 
FWDATA_API Mesh (::fwData::Object::Key key)
 Constructor. More...
 
virtual FWDATA_API ~Mesh ()
 Destructor.
 
FWDATA_API void shallowCopy (const Object::csptr &_source) override
 Defines shallow copy.
 
FWDATA_API void cachedDeepCopy (const Object::csptr &_source, DeepCopyCacheType &cache) override
 Defines deep copy.
 
FWDATA_API size_t allocate (size_t nbPts, size_t nbCells, size_t nbCellsData=0)
 Allocate Mesh memory. More...
 
FWDATA_API size_t allocatePointNormals ()
 Allocates normals array according to the number of points of the mesh.
 
FWDATA_API size_t allocatePointColors (ColorArrayTypes t)
 Allocates colors array according to the number of points of the mesh.
 
FWDATA_API size_t allocatePointTexCoords ()
 Allocates texCoords array according to the number of points of the mesh.
 
FWDATA_API size_t allocateCellNormals ()
 Allocates normals array according to the number of cells of the mesh.
 
FWDATA_API size_t allocateCellColors (ColorArrayTypes t)
 Allocates colors array according to the number of cells of the mesh.
 
FWDATA_API size_t allocateCellTexCoords ()
 Allocates texCoords array according to the number of cells of the mesh.
 
FWDATA_API bool adjustAllocatedMemory ()
 Adjust mesh memory usage. More...
 
FWDATA_API void setPointsArray (const ::fwData::Array::sptr &array)
 Sets the internal corresponding array.
 
FWDATA_API void setCellTypesArray (const ::fwData::Array::sptr &array)
 Sets the internal corresponding array.
 
FWDATA_API void setCellDataArray (const ::fwData::Array::sptr &array)
 Sets the internal corresponding array.
 
FWDATA_API void setCellDataOffsetsArray (const ::fwData::Array::sptr &array)
 Sets the internal corresponding array.
 
FWDATA_API void setPointColorsArray (const ::fwData::Array::sptr &array)
 Sets the internal corresponding array.
 
FWDATA_API void setCellColorsArray (const ::fwData::Array::sptr &array)
 Sets the internal corresponding array.
 
FWDATA_API void setPointNormalsArray (const ::fwData::Array::sptr &array)
 Sets the internal corresponding array.
 
FWDATA_API void setCellNormalsArray (const ::fwData::Array::sptr &array)
 Sets the internal corresponding array.
 
FWDATA_API void setPointTexCoordsArray (const ::fwData::Array::sptr &array)
 Sets the internal corresponding array.
 
FWDATA_API void setCellTexCoordsArray (const ::fwData::Array::sptr &array)
 Sets the internal corresponding array.
 
FWDATA_API::fwData::Array::sptr getPointsArray () const
 Returns the internal corresponding array.
 
FWDATA_API::fwData::Array::sptr getCellTypesArray () const
 Returns the internal corresponding array.
 
FWDATA_API::fwData::Array::sptr getCellDataArray () const
 Returns the internal corresponding array.
 
FWDATA_API::fwData::Array::sptr getCellDataOffsetsArray () const
 Returns the internal corresponding array.
 
FWDATA_API::fwData::Array::sptr getPointColorsArray () const
 Returns the internal corresponding array.
 
FWDATA_API::fwData::Array::sptr getCellColorsArray () const
 Returns the internal corresponding array.
 
FWDATA_API::fwData::Array::sptr getPointNormalsArray () const
 Returns the internal corresponding array.
 
FWDATA_API::fwData::Array::sptr getCellNormalsArray () const
 Returns the internal corresponding array.
 
FWDATA_API::fwData::Array::sptr getPointTexCoordsArray () const
 Returns the internal corresponding array.
 
FWDATA_API::fwData::Array::sptr getCellTexCoordsArray () const
 Returns the internal corresponding array.
 
FWDATA_API void clearPoints ()
 Clear mesh points. Calling this method don't impact memory allocation.
 
FWDATA_API void clearCells ()
 Clear mesh cells. Calling this method don't impact memory allocation.
 
FWDATA_API void clear ()
 Remove all data contained in the mesh. Memory is freed.
 
FWDATA_API void clearPointNormals ()
 Remove corresponding array, memory is freed.
 
FWDATA_API void clearPointColors ()
 Remove corresponding array, memory is freed.
 
FWDATA_API void clearPointTexCoords ()
 Remove corresponding array, memory is freed.
 
FWDATA_API void clearCellNormals ()
 Remove corresponding array, memory is freed.
 
FWDATA_API void clearCellColors ()
 Remove corresponding array, memory is freed.
 
FWDATA_API void clearCellTexCoords ()
 Remove corresponding array, memory is freed.
 
FWDATA_API void setNumberOfPoints (Id nb)
 Set number of points.
 
FWDATA_API Id getNumberOfPoints () const
 Get number of points.
 
FWDATA_API void setNumberOfCells (Id nb)
 Set number of cells.
 
FWDATA_API Id getNumberOfCells () const
 Get number of cells.
 
FWDATA_API void setCellDataSize (Id nb)
 Set cell data size.
 
FWDATA_API Id getCellDataSize () const
 Get cell data size.
 
FWDATA_API size_t getDataSizeInBytes () const
 Get the mesh data size in bytes. More...
 
FWDATA_API size_t getAllocatedSizeInBytes () const
 Get the amount of memory allocated in this mesh. Mey be bigger than getDataSizeInBytes(). More...
 
FWDATA_API void addDataArray (const std::string &name,::fwData::Array::sptr array)
 Add an array in the mesh array-map.
 
FWDATA_API::fwData::Array::sptr getDataArray (const std::string &name) const
 Get an array in the mesh array-map.
 
FWDATA_API void removeDataArray (const std::string &name)
 Remove an array in the mesh array-map.
 
FWDATA_API std::vector< std::string > getDataArrayNames () const
 Return all array names stock in the mesh array-map.
 
- Public Member Functions inherited from fwData::Object
FWDATA_API::fwData::Object::sptr getField (const FieldNameType &name,::fwData::Object::sptr defaultValue=::fwData::Object::sptr()) const
 Returns a pointer of corresponding field (null if non exist). More...
 
template<typename DATA_TYPE >
std::shared_ptr< DATA_TYPE > getField (const FieldNameType &name) const
 Returns a pointer of corresponding field. More...
 
template<typename DATA_TYPE >
std::shared_ptr< DATA_TYPE > getField (const FieldNameType &name, std::shared_ptr< DATA_TYPE > defaultValue) const
 Returns a pointer of corresponding field. More...
 
template<typename DATA_TYPE >
std::shared_ptr< DATA_TYPE > setDefaultField (const FieldNameType &name, std::shared_ptr< DATA_TYPE > defaultValue)
 Returns a pointer of corresponding field. If field did not exist, it is set to defaultValue if defaultValue is not null. More...
 
FWDATA_API::fwData::Object::csptr getConstField (const FieldNameType &name) const
 Returns a pointer of corresponding field (null if non exist). More...
 
FWDATA_API const FieldMapType & getFields () const
 Returns fields map.
 
FWDATA_API FieldNameVectorType getFieldNames () const
 Returns vector of field names.
 
FWDATA_API void setField (const FieldNameType &name,::fwData::Object::sptr obj)
 Register field with specified name. If the name does already exist, the matching field will be replaced. More...
 
FWDATA_API void setFields (const FieldMapType &fieldMap)
 Replace the field map content.
 
FWDATA_API void removeField (const FieldNameType &name)
 Removes field with specified name. More...
 
virtual FWDATA_API void shallowCopy (const ::fwData::Object::csptr &source)
 A shallow copy of fields (objects in m_children) More...
 
FWDATA_API void deepCopy (const ::fwData::Object::csptr &source)
 Make a deep copy from the source Calling this method may invalidate any DumpLock, RescursiveLock or helper on the object. Prefer using fwData::Object::copy instead.
 
FWDATA_API void fieldShallowCopy (const ::fwData::Object::csptr &source)
 A shallow copy of fields (objects in m_children) More...
 
FWDATA_API void fieldDeepCopy (const ::fwData::Object::csptr &source)
 A deep copy of fields (objects in m_children) More...
 
::fwCore::mt::ReadWriteMutexgetMutex () const
 Returns the object's mutex.
 
- Public Member Functions inherited from fwTools::Object
- Public Member Functions inherited from fwCore::BaseObject
- Public Member Functions inherited from fwCom::HasSignals
std::shared_ptr< SignalBasesignal (const Signals::SignalKeyType &key) const
 
template<typename SignalType >
std::shared_ptr< SignalType > signal (const Signals::SignalKeyType &key) const
 
template<typename SignalType >
std::shared_ptr< SignalType > newSignal (const Signals::SignalKeyType &key)
 

Static Public Member Functions

static bool isTypeOf (const std::string &type)
 
- Static Public Member Functions inherited from fwData::Object
static bool isTypeOf (const std::string &type)
 
static FWDATA_API::fwData::Object::sptr copy (const ::fwData::Object::csptr &source)
 return a copy of the source. if source is a null pointer, return a null pointer.
 
template<typename DATA_TYPE >
static std::shared_ptr< DATA_TYPE > copy (const std::shared_ptr< const DATA_TYPE > &source)
 return a copy of the source. if source is a null pointer, return a null pointer.
 
template<typename DATA_TYPE >
static std::shared_ptr< DATA_TYPE > copy (const std::shared_ptr< DATA_TYPE > &source)
 return a copy of the source. if source is a null pointer, return a null pointer.
 
static const std::string & classname ()
 return full object's classname with its namespace, i.e. fwCore::BaseObject
 
- Static Public Member Functions inherited from fwTools::Object
static bool isTypeOf (const std::string &type)
 
static const std::string & classname ()
 return full object's classname with its namespace, i.e. fwCore::BaseObject
 
- Static Public Member Functions inherited from fwCore::BaseObject
static bool isTypeOf (const std::string &type)
 
static const std::string & leafClassname ()
 return object's classname without its namespace, i.e. BaseObject
 
static const std::string & classname ()
 return object's classname without its namespace, i.e. BaseObject
 

Static Public Attributes

static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_VERTEX_MODIFIED_SIG = "vertexModified"
 Key in m_signals map of signal m_sigVertexModified.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_POINT_COLORS_MODIFIED_SIG = "pointColorsModified"
 Key in m_signals map of signal m_sigPointColorsModified.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_CELL_COLORS_MODIFIED_SIG = "cellColorsModified"
 Key in m_signals map of signal m_sigCellColorsModified.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_POINT_NORMALS_MODIFIED_SIG = "pointNormalsModified"
 Key in m_signals map of signal m_sigPointNormalsModified.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_CELL_NORMALS_MODIFIED_SIG = "cellNormalsModified"
 Key in m_signals map of signal m_sigCellNormalsModified.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_POINT_TEX_COORDS_MODIFIED_SIG = "pointTexCoordsModified"
 Key in m_signals map of signal m_sigPointTexCoorddModified.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_CELL_TEX_COORDS_MODIFIED_SIG = "cellTexCoordsModified"
 Key in m_signals map of signal m_sigCellTexCoorddModified.
 
- Static Public Attributes inherited from fwData::Object
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_MODIFIED_SIG = "modified"
 Key in m_signals map of signal m_sigModified.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_ADDED_FIELDS_SIG = "addedFields"
 Type of signal m_sigModified.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_CHANGED_FIELDS_SIG = "changedFields"
 Type of signal m_sigModified.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_REMOVED_FIELDS_SIG = "removedFields"
 Type of signal m_sigModified.
 

Protected Member Functions

FWDATA_API void initArrays ()
 Initializes points, cell-types, cell-data, and cell-data-offsets arrays.
 
- Protected Member Functions inherited from fwData::Object
FWDATA_API void fieldDeepCopy (const ::fwData::Object::csptr &source, DeepCopyCacheType &cache)
 Internal-use methods to implement Object's deepCopy.
 
virtual FWDATA_API void cachedDeepCopy (const ::fwData::Object::csptr &source, DeepCopyCacheType &cache)=0
 Internal-use methods to implement Object's deepCopy.
 
- Protected Member Functions inherited from fwTools::fwID
FWTOOLS_API bool hasID () const
 Return true if the object has an id set. More...
 
FWTOOLS_API IDType getID (Policy policy=GENERATE) const
 Returns the id of the object. If it is not set and the policy value is. More...
 
virtual FWTOOLS_API void setID (IDType newID)
 Set a newID for the object, (newID must not exist in fwID), the oldest one is released. More...
 
FWTOOLS_API void resetID ()
 Release the id for the object. More...
 
 fwID ()
 Constructor : does nothing.
 
- Protected Member Functions inherited from fwCom::HasSignals
 HasSignals (const HasSignals &)
 Copy constructor forbidden.
 
HasSignalsoperator= (const HasSignals &)
 Copy operator forbidden.
 

Protected Attributes

Id m_nbPoints
 Number of points defined for the mesh.
 
Id m_nbCells
 Number of cells defined for the mesh.
 
Id m_cellsDataSize
 Number of point index defined for mesh (size of m_cellData)
 
::fwData::Array::sptr m_points
 Mesh point array : 3-components 1-dimension float array, size = m_nbPoints x 3. More...
 
::fwData::Array::sptr m_cellTypes
 Cell types array : 1-components 1-dimension uint8 array, size = m_nbCells. More...
 
::fwData::Array::sptr m_cellData
 Cell data array : 1-components 1-dimension uint64 array, size = m_cellsDataSize. More...
 
::fwData::Array::sptr m_cellDataOffsets
 Cell data offsets array : 1-components 1-dimension uint64 array, size = m_nbCells. More...
 
::fwData::Array::sptr m_pointColors
 point colors array : 3 or 4-components 1-dimension float array, size = m_nbPoints. More...
 
::fwData::Array::sptr m_cellColors
 Mesh point array : 3 or 4-components 1-dimension uint8_t array, size = m_nbCells. More...
 
::fwData::Array::sptr m_pointNormals
 Mesh point array : 3-components 1-dimension uint8_t array, size = m_nbPoints. More...
 
::fwData::Array::sptr m_cellNormals
 Mesh point array : 3-components 1-dimension float array, size = m_nbCells. More...
 
::fwData::Array::sptr m_pointTexCoords
 Mesh texCoord array : 2-components 1-dimension float array, size = m_nbPoints. More...
 
::fwData::Array::sptr m_cellTexCoords
 Mesh texCoord array : 2-components 1-dimension float array, size = m_nbCells. More...
 
ArrayMapType m_arrayMap
 Array map where you can add few additional arrays registered thanks to a key to perform/conserve some specific.
 
- Protected Attributes inherited from fwData::Object
FieldMapType m_fields
 Fields.
 
mutable::fwCore::mt::ReadWriteMutex m_mutex
 Mutex to protect object access.
 
- Protected Attributes inherited from fwTools::Object
std::shared_ptr< ::fwTools::UUIDm_uuid
 UUID used to identify the object, notably for serialization.
 
- Protected Attributes inherited from fwCom::HasSignals
Signals m_signals
 

Friends

template<class , class , class >
class ::fwTools::ClassFactory
 
class ::fwTools::Factory
 

Demangling methods

virtual const std::string & getLeafClassname () const override
 return object's classname without its namespace, i.e. BaseObject
 
virtual const std::string & getClassname () const override
 return full object's classname with its namespace, i.e. fwCore::BaseObject
 
static const std::string & leafClassname ()
 return object's classname without its namespace, i.e. BaseObject
 
static const std::string & classname ()
 return object's classname without its namespace, i.e. BaseObject
 

Additional Inherited Members

- Protected Types inherited from fwTools::fwID
enum  Policy { EMPTY = 1, GENERATE, MUST_EXIST }
 
typedef std::string IDType
 
- Static Protected Member Functions inherited from fwData::Object
static FWDATA_API::fwData::Object::sptr copy (const ::fwData::Object::csptr &source, DeepCopyCacheType &cache)
 Internal-use methods to implement Object's deepCopy.
 
template<typename DATA_TYPE >
static std::shared_ptr< DATA_TYPE > copy (const std::shared_ptr< const DATA_TYPE > &source, DeepCopyCacheType &cache)
 Internal-use methods to implement Object's deepCopy.
 
template<typename DATA_TYPE >
static std::shared_ptr< DATA_TYPE > copy (const std::shared_ptr< DATA_TYPE > &source, DeepCopyCacheType &cache)
 Internal-use methods to implement Object's deepCopy.
 
- Static Protected Member Functions inherited from fwTools::fwID
static bool isTypeOf (const std::string &type)
 
static FWTOOLS_API bool exist (IDType _id)
 
static FWTOOLS_API std::shared_ptr< ::fwTools::ObjectgetObject (IDType requestID)
 Retrieve the object attached to the given id. Return a null sptr if no correspondence exist. More...
 
static const std::string & leafClassname ()
 return object's classname without its namespace, i.e. BaseObject
 
static const std::string & classname ()
 return object's classname without its namespace, i.e. BaseObject
 

Detailed Description

Data holding a geometric structure composed of points, lines, triangles, quads or polygons.

It is the new structure that represent mesh in fw4spl. For the moment, this new structure is available to register mesh with triangle cells, with quad cells or with triangle and quad cells. Peharps, in future work other cell type will be available (ex: POLYGON)

This structure contains some information stock in fwData::Array
An array (m_points) which contains point coord (x,y,z)
An array (m_cellTypes) which contains cell type (TRIAN or QUAD for the moment)
An array (m_cellData) which contains point indexes in m_points used to create cells, 3 indexes are necessary to create a triangle cell, 4 for quad cell.
An array (m_cellDataOffsets) which contains indexes relative to m_cellData, to retrieve the first point necessary to the cell creation.
Example :
m_points.size = number of mesh points * 3
m_points = [ x0, y0, z0, x1, y1, z1, x2, y2, z2, x3, y3, z3, ... ]
m_cellTypes.size = number of mesh cells
m_cellTypes = [TRIANGLE, TRIANGLE, QUAD, QUAD, TRIANGLE ... ]
m_cellDataOffsets.size = number of mesh cells
m_cellDataOffsets = [0, 3, 6, 10, 14, ... ] (offset shifting in m_cellData = +3 if triangle cell rr +4 if quad cell)
number of mesh cells * 3 (if only triangle cell) < m_cellData.size < number of mesh cells * 4 (if only quad cell)
m_cellData = [0, 1, 2, 0, 1, 3, 0, 1, 3, 5... ] ( correspond to point id )
Get the points coordinates of the third cell
m_cellTypes[2] => cell type = QUAD
m_cellDataOffsets[2] => index in m_cellData of cell definition = 6
index of p1 = m_cellData[6] = 0
index of p2 = m_cellData[6+1] = 1
index of p3 = m_cellData[6+2] = 3
index of p4 = m_cellData[6+3] = 5
p1 = [ x0=m_points[0] y0 z0 ] ( 0 * 3 = 0 )
p2 = [ x1=m_points[3] y1 z1 ] ( 1 * 3 = 3 )
p3 = [ x3=m_points[9] y3 z3 ] ( 3 * 3 = 9 )
p4 = [ x5=m_points[15] y5 z5 ] ( 5 * 3 = 15 )
We have another array to stock normal by points, normal by edges, color by points or color by cells, to short :
Normal arrays contains normal vector (x,y,z)
normals.size = number of mesh points (respc cells) * 3
normals = [ x0, y0, z0, x1, y1, z1, x2, y2, z2, x3, y3, z3, ... ]
Color arrays contains RGB or RGBA colors ( check the number of components 3 or 4 of array )
colors.size = number of mesh points (respc cells) * 3 (respc 4)
colors = [ r0, g0, b0, r1, g1, b1, ... ]
or colors = [ r0, g0, b0, a0, r1, g1, b1, a1, ... ]

Definition at line 72 of file core/fwData/include/fwData/Mesh.hpp.

Constructor & Destructor Documentation

fwData::Mesh::Mesh ( ::fwData::Object::Key  key)

Constructor.

Parameters
keyPrivate construction key

Definition at line 41 of file core/fwData/src/fwData/Mesh.cpp.

References initArrays(), s_CELL_COLORS_MODIFIED_SIG, s_CELL_NORMALS_MODIFIED_SIG, s_CELL_TEX_COORDS_MODIFIED_SIG, s_POINT_COLORS_MODIFIED_SIG, s_POINT_NORMALS_MODIFIED_SIG, s_POINT_TEX_COORDS_MODIFIED_SIG, and s_VERTEX_MODIFIED_SIG.

+ Here is the call graph for this function:

Member Function Documentation

bool fwData::Mesh::adjustAllocatedMemory ( )

Adjust mesh memory usage.

The array (points, cell-types, cell-data, cell-data-offsets, and if they exists point-colors/normals and cell-colors/normals) will be resized according to the number of points and cells of the mesh (they may have been defined before adjusting by setNumberOfPoints or setNumberOfCells). Arrays in array-map are not impacted by this method.

Returns
true if memory usage changed
Exceptions
fwData::Exception

Definition at line 266 of file core/fwData/src/fwData/Mesh.cpp.

References getAllocatedSizeInBytes(), getDataSizeInBytes(), initArrays(), m_cellColors, m_cellData, m_cellDataOffsets, m_cellNormals, m_cellsDataSize, m_cellTexCoords, m_cellTypes, m_nbCells, m_nbPoints, m_pointColors, m_pointNormals, m_points, m_pointTexCoords, and SLM_ASSERT.

+ Here is the call graph for this function:

size_t fwData::Mesh::allocate ( size_t  nbPts,
size_t  nbCells,
size_t  nbCellsData = 0 
)

Allocate Mesh memory.

Initializes points, cell-types, cell-data, and cell-data-offsets arrays with informations given by the parameters. if nbCellData is zero, it will be initialized to 3*nbCells

Parameters
nbPts
nbCells
nbCellsData
Returns
Exceptions
fwData::Exception

Definition at line 164 of file core/fwData/src/fwData/Mesh.cpp.

References m_cellData, m_cellDataOffsets, m_cellTypes, and m_points.

size_t fwData::Mesh::getAllocatedSizeInBytes ( ) const

Get the amount of memory allocated in this mesh. Mey be bigger than getDataSizeInBytes().

Returns
Mesh data size in bytes

Definition at line 578 of file core/fwData/src/fwData/Mesh.cpp.

References m_cellColors, m_cellData, m_cellDataOffsets, m_cellNormals, m_cellTexCoords, m_cellTypes, m_pointColors, m_pointNormals, m_points, and m_pointTexCoords.

Referenced by adjustAllocatedMemory().

+ Here is the caller graph for this function:

size_t fwData::Mesh::getDataSizeInBytes ( ) const

Get the mesh data size in bytes.

Returns
Mesh data size in bytes

Definition at line 558 of file core/fwData/src/fwData/Mesh.cpp.

References m_cellColors, m_cellData, m_cellDataOffsets, m_cellNormals, m_cellsDataSize, m_cellTexCoords, m_cellTypes, m_nbCells, m_nbPoints, m_pointColors, m_pointNormals, m_points, and m_pointTexCoords.

Referenced by adjustAllocatedMemory().

+ Here is the caller graph for this function:

Member Data Documentation

::fwData::Array::sptr fwData::Mesh::m_cellColors
protected

Mesh point array : 3 or 4-components 1-dimension uint8_t array, size = m_nbCells.

This array contains cell colors : [ R1 G1 B1 R2 G2 B2 ... ] or [ R1 G1 B1 A1 R2 G2 B2 A2 ... ]

Definition at line 426 of file core/fwData/include/fwData/Mesh.hpp.

Referenced by adjustAllocatedMemory(), allocateCellColors(), cachedDeepCopy(), clearCellColors(), getAllocatedSizeInBytes(), getCellColorsArray(), getDataSizeInBytes(), setCellColorsArray(), and shallowCopy().

::fwData::Array::sptr fwData::Mesh::m_cellData
protected

Cell data array : 1-components 1-dimension uint64 array, size = m_cellsDataSize.

Contains cell data : cell points ids are contiguously stored regardless of the cell type. Size depends of cell type. If we have only TRIANGLE type, size = m_nbCells x 3.

This array contains point indexes (index in m_points) : [ TRIAN_ID1, TRIAN_ID2, TRIAN_ID3, QUAD_ID1, QUAD_ID2, QUAD_ID3, QUAD_ID4, ... ]

Definition at line 402 of file core/fwData/include/fwData/Mesh.hpp.

Referenced by adjustAllocatedMemory(), allocate(), cachedDeepCopy(), clear(), getAllocatedSizeInBytes(), getCellDataArray(), getDataSizeInBytes(), initArrays(), setCellDataArray(), and shallowCopy().

::fwData::Array::sptr fwData::Mesh::m_cellDataOffsets
protected

Cell data offsets array : 1-components 1-dimension uint64 array, size = m_nbCells.

Contains cell data offsets : for each cell, gives the offset of the first item of this cell in m_cellData.

This array contains cell indexes m_cellData : [ INDEX_TRIAN_1, INDEX_QUAD_1, INDEX_QUAD_2 ... ]

Definition at line 412 of file core/fwData/include/fwData/Mesh.hpp.

Referenced by adjustAllocatedMemory(), allocate(), cachedDeepCopy(), clear(), getAllocatedSizeInBytes(), getCellDataOffsetsArray(), getDataSizeInBytes(), initArrays(), setCellDataOffsetsArray(), and shallowCopy().

::fwData::Array::sptr fwData::Mesh::m_cellNormals
protected

Mesh point array : 3-components 1-dimension float array, size = m_nbCells.

This array contains cell normals : [ nx1 ny1 nz1 nx2 ny2 nz2 ... ]

Definition at line 440 of file core/fwData/include/fwData/Mesh.hpp.

Referenced by adjustAllocatedMemory(), allocateCellNormals(), cachedDeepCopy(), clearCellNormals(), getAllocatedSizeInBytes(), getCellNormalsArray(), getDataSizeInBytes(), setCellNormalsArray(), and shallowCopy().

::fwData::Array::sptr fwData::Mesh::m_cellTexCoords
protected

Mesh texCoord array : 2-components 1-dimension float array, size = m_nbCells.

This array contains cell texCoords : [ tx1 ty1 tx2 ty2 ... ]

Definition at line 454 of file core/fwData/include/fwData/Mesh.hpp.

Referenced by adjustAllocatedMemory(), allocateCellTexCoords(), cachedDeepCopy(), clearCellTexCoords(), getAllocatedSizeInBytes(), getCellTexCoordsArray(), getDataSizeInBytes(), setCellTexCoordsArray(), and shallowCopy().

::fwData::Array::sptr fwData::Mesh::m_cellTypes
protected

Cell types array : 1-components 1-dimension uint8 array, size = m_nbCells.

This array each cell type : [ TRIANGLE QUAD QUAD ... TRIANGLE TRIANGLE QUAD ]

Definition at line 391 of file core/fwData/include/fwData/Mesh.hpp.

Referenced by adjustAllocatedMemory(), allocate(), cachedDeepCopy(), clear(), getAllocatedSizeInBytes(), getCellTypesArray(), getDataSizeInBytes(), initArrays(), setCellTypesArray(), and shallowCopy().

::fwData::Array::sptr fwData::Mesh::m_pointColors
protected

point colors array : 3 or 4-components 1-dimension float array, size = m_nbPoints.

This array contains point colors : [ R1 G1 B1 R2 G2 B2 ... ] or [ R1 G1 B1 A1 R2 G2 B2 A2 ... ]

Definition at line 419 of file core/fwData/include/fwData/Mesh.hpp.

Referenced by adjustAllocatedMemory(), allocatePointColors(), cachedDeepCopy(), clearPointColors(), getAllocatedSizeInBytes(), getDataSizeInBytes(), getPointColorsArray(), setPointColorsArray(), and shallowCopy().

::fwData::Array::sptr fwData::Mesh::m_pointNormals
protected

Mesh point array : 3-components 1-dimension uint8_t array, size = m_nbPoints.

This array contains point normals : [ nx1 ny1 nz1 nx2 ny2 nz2 ... ]

Definition at line 433 of file core/fwData/include/fwData/Mesh.hpp.

Referenced by adjustAllocatedMemory(), allocatePointNormals(), cachedDeepCopy(), clearPointNormals(), getAllocatedSizeInBytes(), getDataSizeInBytes(), getPointNormalsArray(), setPointNormalsArray(), and shallowCopy().

::fwData::Array::sptr fwData::Mesh::m_points
protected

Mesh point array : 3-components 1-dimension float array, size = m_nbPoints x 3.

This array contains points : [ x1 y1 z1 x2 y2 z2 ... xn yn zn ]

Definition at line 384 of file core/fwData/include/fwData/Mesh.hpp.

Referenced by adjustAllocatedMemory(), allocate(), cachedDeepCopy(), clear(), getAllocatedSizeInBytes(), getDataSizeInBytes(), getPointsArray(), initArrays(), setPointsArray(), and shallowCopy().

::fwData::Array::sptr fwData::Mesh::m_pointTexCoords
protected

Mesh texCoord array : 2-components 1-dimension float array, size = m_nbPoints.

This array contains point texCoords : [ tx1 ty1 tx2 ty2 ... ]

Definition at line 447 of file core/fwData/include/fwData/Mesh.hpp.

Referenced by adjustAllocatedMemory(), allocatePointTexCoords(), cachedDeepCopy(), clearPointTexCoords(), getAllocatedSizeInBytes(), getDataSizeInBytes(), getPointTexCoordsArray(), setPointTexCoordsArray(), and shallowCopy().


The documentation for this class was generated from the following files: