CCCoreLib 31 May 2022
CloudCompare Core algorithms
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CCCoreLib::ScalarField Class Reference

A simple scalar field (to be associated to a point cloud) More...

#include <ScalarField.h>

Inheritance diagram for CCCoreLib::ScalarField:
Inheritance graph
[legend]
Collaboration diagram for CCCoreLib::ScalarField:
Collaboration graph
[legend]

Public Member Functions

CC_CORE_LIB_API ScalarField (const char *name=nullptr)
 Default constructor. More...
 
CC_CORE_LIB_API ScalarField (const ScalarField &sf)
 Copy constructor. More...
 
CC_CORE_LIB_API void setName (const char *name)
 Sets scalar field name.
 
const char * getName () const
 Returns scalar field name.
 
CC_CORE_LIB_API void computeMeanAndVariance (ScalarType &mean, ScalarType *variance=nullptr) const
 Computes the mean value (and optionally the variance value) of the scalar field. More...
 
virtual CC_CORE_LIB_API void computeMinAndMax ()
 Determines the min and max values.
 
void flagValueAsInvalid (std::size_t index)
 Sets the value as 'invalid' (i.e. CCCoreLib::NAN_VALUE)
 
ScalarType getMin () const
 Returns the minimum value.
 
ScalarType getMax () const
 Returns the maximum value.
 
void fill (ScalarType fillValue=0)
 Fills the array with a particular value.
 
CC_CORE_LIB_API bool reserveSafe (std::size_t count)
 Reserves memory (no exception thrown)
 
CC_CORE_LIB_API bool resizeSafe (std::size_t count, bool initNewElements=false, ScalarType valueForNewElements=0)
 Resizes memory (no exception thrown)
 
ScalarType & getValue (std::size_t index)
 
const ScalarType & getValue (std::size_t index) const
 
void setValue (std::size_t index, ScalarType value)
 
void addElement (ScalarType value)
 
unsigned currentSize () const
 
void swap (std::size_t i1, std::size_t i2)
 
- Public Member Functions inherited from CCShareable
 CCShareable ()
 Default constructor.
 
virtual void link ()
 Increase counter. More...
 
virtual void release ()
 Decrease counter and deletes object when 0. More...
 
virtual unsigned getLinkCount () const
 Returns the current link count. More...
 

Static Public Member Functions

static ScalarType NaN ()
 Returns the specific NaN value.
 
static bool ValidValue (ScalarType value)
 Returns whether a scalar value is valid or not.
 

Protected Member Functions

CC_CORE_LIB_API ~ScalarField () override=default
 Default destructor. More...
 
- Protected Member Functions inherited from CCShareable
virtual ~CCShareable ()
 Destructor. More...
 

Protected Attributes

char m_name [256]
 Scalar field name.
 
ScalarType m_minVal
 Minimum value.
 
ScalarType m_maxVal
 Maximum value.
 
- Protected Attributes inherited from CCShareable
unsigned m_linkCount
 Links counter.
 

Detailed Description

A simple scalar field (to be associated to a point cloud)

A monodimensional array of scalar values. It has also specific parameters for display purposes.

Invalid values can be represented by CCCoreLib::NAN_VALUE.

Constructor & Destructor Documentation

◆ ScalarField() [1/2]

ScalarField::ScalarField ( const char *  name = nullptr)
explicit

Default constructor.

[SHAREABLE] Call 'link' when associating this structure to an object.

Parameters
namescalar field name

◆ ScalarField() [2/2]

ScalarField::ScalarField ( const ScalarField sf)

Copy constructor.

Parameters
sfscalar field to copy
Warning
May throw a std::bad_alloc exception

◆ ~ScalarField()

CC_CORE_LIB_API CCCoreLib::ScalarField::~ScalarField ( )
overrideprotecteddefault

Default destructor.

Call release instead.

Member Function Documentation

◆ computeMeanAndVariance()

void ScalarField::computeMeanAndVariance ( ScalarType &  mean,
ScalarType *  variance = nullptr 
) const

Computes the mean value (and optionally the variance value) of the scalar field.

Parameters
meana field to store the mean value
varianceif not void, the variance will be computed and stored here

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