qCC_db version 2.13.alpha (Qt) - 31 May 2022
CloudCompare 3D entities
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
ccNormalVectors Class Reference

Compressed normal vectors handler. More...

#include <ccNormalVectors.h>

Collaboration diagram for ccNormalVectors:
Collaboration graph
[legend]

Public Types

enum  Orientation {
  PLUS_X = 0 , MINUS_X = 1 , PLUS_Y = 2 , MINUS_Y = 3 ,
  PLUS_Z = 4 , MINUS_Z = 5 , PLUS_BARYCENTER = 6 , MINUS_BARYCENTER = 7 ,
  PLUS_ORIGIN = 8 , MINUS_ORIGIN = 9 , PREVIOUS = 10 , PLUS_SENSOR_ORIGIN = 11 ,
  MINUS_SENSOR_ORIGIN = 12 , UNDEFINED = 255
}
 'Default' orientations More...
 

Public Member Functions

const CCVector3 & getNormal (unsigned normIndex) const
 Returns the precomputed normal corresponding to a given compressed index.
 
virtual ~ccNormalVectors ()=default
 Default destructor.
 
bool enableNormalHSVColorsArray ()
 Allocates normal HSV colors array. More...
 
const ccColor::RgbgetNormalHSVColor (unsigned index) const
 Returns the HSV color equivalent to a given compressed normal index.
 
const std::vector< ccColor::Rgb > & getNormalHSVColorArray () const
 Returns the HSV color array.
 

Static Public Member Functions

static ccNormalVectorsGetUniqueInstance ()
 Returns unique instance.
 
static void ReleaseUniqueInstance ()
 Releases unique instance. More...
 
static unsigned GetNumberOfVectors ()
 Returns the number of compressed normal vectors.
 
static const CCVector3 & GetNormal (unsigned normIndex)
 Static access to ccNormalVectors::getNormal.
 
static CompressedNormType GetNormIndex (const PointCoordinateType N[])
 Returns the compressed index corresponding to a normal vector.
 
static CompressedNormType GetNormIndex (const CCVector3 &N)
 Returns the compressed index corresponding to a normal vector (shortcut)
 
static bool ComputeCloudNormals (ccGenericPointCloud *cloud, NormsIndexesTableType &theNormsCodes, CCCoreLib::LOCAL_MODEL_TYPES localModel, PointCoordinateType localRadius, Orientation preferredOrientation=UNDEFINED, CCCoreLib::GenericProgressCallback *progressCb=nullptr, CCCoreLib::DgmOctree *inputOctree=nullptr)
 Computes normal at each point of a given cloud. More...
 
static bool UpdateNormalOrientations (ccGenericPointCloud *theCloud, NormsIndexesTableType &theNormsCodes, Orientation preferredOrientation)
 Updates normals orientation based on a preferred orientation. More...
 
static void ConvertNormalToStrikeAndDip (const CCVector3 &N, PointCoordinateType &strike_deg, PointCoordinateType &dip_deg)
 Converts a normal vector to geological 'strike & dip' parameters (N[dip]°E - [strike]°) More...
 
static void ConvertNormalToDipAndDipDir (const CCVector3 &N, PointCoordinateType &dip_deg, PointCoordinateType &dipDir_deg)
 Converts a normal vector to geological 'dip direction & dip' parameters. More...
 
static CCVector3 ConvertDipAndDipDirToNormal (PointCoordinateType dip_deg, PointCoordinateType dipDir_deg, bool upward=true)
 Converts a couple of geological 'dip direction & dip' parameters to a unit normal vector. More...
 
static QString ConvertStrikeAndDipToString (double &strike_deg, double &dip_deg)
 Converts geological 'strike & dip' parameters (N[dip]°E - [strike]°) to a string. More...
 
static QString ConvertDipAndDipDirToString (PointCoordinateType dip_deg, PointCoordinateType dipDir_deg)
 Converts geological 'dip direction & dip' parameters to a string. More...
 
static void ConvertNormalToHSV (const CCVector3 &N, float &H, float &S, float &V)
 Converts a normal vector to HSV color space. More...
 
static ccColor::Rgb ConvertNormalToRGB (const CCVector3 &N)
 Converts a normal vector to RGB color space. More...
 
static bool ComputeNormalWithLS (CCCoreLib::GenericIndexedCloudPersist *pointAndNeighbors, CCVector3 &N)
 Helper: computes the normal (with best LS fit)
 
static bool ComputeNormalWithTri (CCCoreLib::GenericIndexedCloudPersist *pointAndNeighbors, CCVector3 &N)
 Helper: computes the normal (with Delaunay 2.5D) More...
 
static bool ComputeNormalWithQuadric (CCCoreLib::GenericIndexedCloudPersist *points, const CCVector3 &P, CCVector3 &N)
 Helper: computes the normal (with Delaunay 2.5D) More...
 

Protected Member Functions

 ccNormalVectors ()
 Default constructor. More...
 
bool init ()
 Inits internal structures.
 

Static Protected Member Functions

static bool ComputeNormsAtLevelWithQuadric (const CCCoreLib::DgmOctree::octreeCell &cell, void **additionalParameters, CCCoreLib::NormalizedProgress *nProgress=nullptr)
 Cellular method for octree-based normal computation.
 
static bool ComputeNormsAtLevelWithLS (const CCCoreLib::DgmOctree::octreeCell &cell, void **additionalParameters, CCCoreLib::NormalizedProgress *nProgress=nullptr)
 Cellular method for octree-based normal computation.
 
static bool ComputeNormsAtLevelWithTri (const CCCoreLib::DgmOctree::octreeCell &cell, void **additionalParameters, CCCoreLib::NormalizedProgress *nProgress=nullptr)
 Cellular method for octree-based normal computation.
 

Protected Attributes

std::vector< CCVector3 > m_theNormalVectors
 Compressed normal vectors.
 
std::vector< ccColor::Rgbm_theNormalHSVColors
 'HSV' colors corresponding to each compressed normal index More...
 

Detailed Description

Compressed normal vectors handler.

Member Enumeration Documentation

◆ Orientation

'Default' orientations

Enumerator
PLUS_X 

N.x always positive.

MINUS_X 

N.x always negative.

PLUS_Y 

N.y always positive.

MINUS_Y 

N.y always negative.

PLUS_Z 

N.z always positive.

MINUS_Z 

N.z always negative.

PLUS_BARYCENTER 

Normals always opposite to the cloud barycenter.

MINUS_BARYCENTER 

Normals always towards the cloud barycenter.

PLUS_ORIGIN 

Normals always opposite to the origin.

MINUS_ORIGIN 

Normals always towards the origin.

PREVIOUS 

Re-use previous normal (if any)

PLUS_SENSOR_ORIGIN 

Normals opposite to the associated sensor origin (if any, and if multiple, the first one will be used)

MINUS_SENSOR_ORIGIN 

Normals towards the associated sensor origin (if any, and if multiple, the first one will be used)

UNDEFINED 

Undefined (no orientation is required)

Constructor & Destructor Documentation

◆ ccNormalVectors()

ccNormalVectors::ccNormalVectors ( )
protected

Default constructor.

Shouldn't be called directly. Use 'GetUniqueInstance' instead.

Member Function Documentation

◆ ComputeCloudNormals()

bool ccNormalVectors::ComputeCloudNormals ( ccGenericPointCloud cloud,
NormsIndexesTableType theNormsCodes,
CCCoreLib::LOCAL_MODEL_TYPES  localModel,
PointCoordinateType  localRadius,
Orientation  preferredOrientation = UNDEFINED,
CCCoreLib::GenericProgressCallback *  progressCb = nullptr,
CCCoreLib::DgmOctree *  inputOctree = nullptr 
)
static

Computes normal at each point of a given cloud.

Parameters
cloudpoint cloud on which to process the normals.
theNormsCodesarray in which the normals indexes are stored
localModelwhich kind of model to use for the computation (LS = plane, QUADRIC = quadratic Height Function, TRI = triangulation)
localRadiuslocal neighborhood radius (not necessary for TRI)
preferredOrientationspecifies a preferred orientation for normals (optional)
progressCbprogress notification (optional)
inputOctreeinputOctree input cloud octree (optional).
Returns
success

◆ ComputeNormalWithQuadric()

bool ccNormalVectors::ComputeNormalWithQuadric ( CCCoreLib::GenericIndexedCloudPersist *  points,
const CCVector3 &  P,
CCVector3 &  N 
)
static

Helper: computes the normal (with Delaunay 2.5D)

The normal is computed at the first point (assuming the others are its neighbors).

◆ ComputeNormalWithTri()

bool ccNormalVectors::ComputeNormalWithTri ( CCCoreLib::GenericIndexedCloudPersist *  pointAndNeighbors,
CCVector3 &  N 
)
static

Helper: computes the normal (with Delaunay 2.5D)

The normal is computed at the first point (assuming the others are its neighbors).

◆ ConvertDipAndDipDirToNormal()

CCVector3 ccNormalVectors::ConvertDipAndDipDirToNormal ( PointCoordinateType  dip_deg,
PointCoordinateType  dipDir_deg,
bool  upward = true 
)
static

Converts a couple of geological 'dip direction & dip' parameters to a unit normal vector.

Parameters
[in]dip_degvalue (in degrees)
[in]dipDir_degdip direction value(in degrees)
[in]upwardwhether the output normal vector should point towards Z+ (true) or Z- (false)
Returns
unit normal vector

◆ ConvertDipAndDipDirToString()

QString ccNormalVectors::ConvertDipAndDipDirToString ( PointCoordinateType  dip_deg,
PointCoordinateType  dipDir_deg 
)
static

Converts geological 'dip direction & dip' parameters to a string.

Parameters
[in]dip_degdip angle value (in degrees)
[in]dipDir_degdip direction value (in degrees)
Returns
formatted string "Dip direction: [dipDir]° - Dip angle: [dip]°"

◆ ConvertNormalToDipAndDipDir()

void ccNormalVectors::ConvertNormalToDipAndDipDir ( const CCVector3 &  N,
PointCoordinateType &  dip_deg,
PointCoordinateType &  dipDir_deg 
)
static

Converts a normal vector to geological 'dip direction & dip' parameters.

See http://en.wikipedia.org/wiki/Strike_and_dip The dip direction is the azimuth of the direction (in [0,360[). The dip is always in [0,90].

Parameters
[in]Nnormal (should be normalized!)
[out]dip_degvalue (in degrees)
[out]dipDir_degdip direction value (in degrees)

◆ ConvertNormalToHSV()

void ccNormalVectors::ConvertNormalToHSV ( const CCVector3 &  N,
float &  H,
float &  S,
float &  V 
)
static

Converts a normal vector to HSV color space.

Uses 'strike & dip' parameters (H=strike, S=dip, V=constant)

Parameters
[in]Nnormal (should be normalized!)
[out]Hhue [0;360[
[out]Ssaturation [0;1]
[out]Vvalue [0;1]

◆ ConvertNormalToRGB()

ccColor::Rgb ccNormalVectors::ConvertNormalToRGB ( const CCVector3 &  N)
static

Converts a normal vector to RGB color space.

Uses 'ConvertNormalToHSV' then converts HSV to RGB.

Parameters
[in]Nnormal (should be normalized!)
Returns
RGB value (components between 0 and MAX_COLOR_COMP)

◆ ConvertNormalToStrikeAndDip()

void ccNormalVectors::ConvertNormalToStrikeAndDip ( const CCVector3 &  N,
PointCoordinateType &  strike_deg,
PointCoordinateType &  dip_deg 
)
static

Converts a normal vector to geological 'strike & dip' parameters (N[dip]°E - [strike]°)

Parameters
[in]Nnormal (should be normalized!)
[out]strike_degstrike value (in degrees)
[out]dip_degdip value (in degrees)

◆ ConvertStrikeAndDipToString()

QString ccNormalVectors::ConvertStrikeAndDipToString ( double &  strike_deg,
double &  dip_deg 
)
static

Converts geological 'strike & dip' parameters (N[dip]°E - [strike]°) to a string.

Parameters
[in]strike_degstrike value (in degrees)
[in]dip_degdip value (in degrees)
Returns
formatted string "N[strike]°E - [dip]°"

◆ enableNormalHSVColorsArray()

bool ccNormalVectors::enableNormalHSVColorsArray ( )

Allocates normal HSV colors array.

Mandatory for HSV color related methods (getNormalHSVColor, etc.)

◆ ReleaseUniqueInstance()

void ccNormalVectors::ReleaseUniqueInstance ( )
static

Releases unique instance.

Call to this method is now optional.

◆ UpdateNormalOrientations()

bool ccNormalVectors::UpdateNormalOrientations ( ccGenericPointCloud theCloud,
NormsIndexesTableType theNormsCodes,
Orientation  preferredOrientation 
)
static

Updates normals orientation based on a preferred orientation.

Parameters
theCloudpoint cloud on which to process the normals.
theNormsCodesarray in which the normals indexes are stored
preferredOrientationspecifies a preferred orientation for normals
Returns
success

Member Data Documentation

◆ m_theNormalHSVColors

std::vector<ccColor::Rgb> ccNormalVectors::m_theNormalHSVColors
protected

'HSV' colors corresponding to each compressed normal index

In fact, HSV color has already been converted to RGB here for faster display.


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