qCC_db  version 2.5.4 (Qt) - 19 Apr 2014
 All Classes Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | 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 Member Functions

const CCVector3 & getNormal (unsigned normIndex) const
 Returns the precomputed normal corresponding to a given compressed index.
 
virtual ~ccNormalVectors ()
 Default destructor.
 
bool enableNormalHSVColorsArray ()
 Allocates normal HSV colors array. More...
 
const colorType * getNormalHSVColor (unsigned index) const
 Returns the HSV color equivalent to a given compressed normal index.
 
const colorType * 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 void ComputeNormal (normsType normIndex, PointCoordinateType N[])
 Computes the normal corresponding to a given compressed index. More...
 
static normsType GetNormIndex (const PointCoordinateType N[])
 Returns the compressed index corresponding to a normal vector.
 
static normsType GetNormIndex (const CCVector3 &N)
 Returns the compressed index corresponding to a normal vector (shortcut)
 
static void InvertNormal (normsType &code)
 Inverts normal corresponding to a given compressed index. More...
 
static bool ComputeCloudNormals (ccGenericPointCloud *theCloud, NormsIndexesTableType &theNormsCodes, CC_LOCAL_MODEL_TYPES method, PointCoordinateType radius, int preferedOrientation=-1, CCLib::GenericProgressCallback *progressCb=0, CCLib::DgmOctree *inputOctree=0)
 Computes normal at each point of a given cloud. More...
 
static bool UpdateNormalOrientations (ccGenericPointCloud *theCloud, NormsIndexesTableType &theNormsCodes, int preferedOrientation)
 Updates normals orientation based on a preferred orientation. More...
 
static void ConvertNormalToStrikeAndDip (const CCVector3 &N, double &strike_deg, double &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 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, double &H, double &S, double &V)
 Converts a normal vector to HSV color space. More...
 
static void ConvertNormalToRGB (const CCVector3 &N, colorType &R, colorType &G, colorType &B)
 Converts a normal vector to RGB color space. More...
 
static void ConvertHSVToRGB (double H, double S, double V, colorType &R, colorType &G, colorType &B)
 Converts a HSV color to RGB color space. More...
 

Static Public Attributes

static const unsigned NORMALS_QUANTIZE_LEVEL = 6
 Compressed normals quantization level (number of directions/bits: 2^(2*N+3))
 

Protected Member Functions

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

Static Protected Member Functions

static void Quant_dequantize_normal (unsigned q, unsigned level, PointCoordinateType *res)
 Decompression algorithm. More...
 
static unsigned Quant_quantize_normal (const PointCoordinateType *n, unsigned level)
 Compression algorithm. More...
 
static bool ComputeNormsAtLevelWithHF (const CCLib::DgmOctree::octreeCell &cell, void **additionalParameters, CCLib::NormalizedProgress *nProgress=0)
 Cellular method for octree-based normal computation.
 
static bool ComputeNormsAtLevelWithLS (const CCLib::DgmOctree::octreeCell &cell, void **additionalParameters, CCLib::NormalizedProgress *nProgress=0)
 Cellular method for octree-based normal computation.
 
static bool ComputeNormsAtLevelWithTri (const CCLib::DgmOctree::octreeCell &cell, void **additionalParameters, CCLib::NormalizedProgress *nProgress=0)
 Cellular method for octree-based normal computation.
 

Protected Attributes

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

Detailed Description

Compressed normal vectors handler.

Constructor & Destructor Documentation

ccNormalVectors::ccNormalVectors ( )
protected

Default constructor.

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

Member Function Documentation

bool ccNormalVectors::ComputeCloudNormals ( ccGenericPointCloud theCloud,
NormsIndexesTableType theNormsCodes,
CC_LOCAL_MODEL_TYPES  method,
PointCoordinateType  radius,
int  preferedOrientation = -1,
CCLib::GenericProgressCallback *  progressCb = 0,
CCLib::DgmOctree *  inputOctree = 0 
)
static

Computes normal at each point of a given cloud.

Parameters
theCloudpoint cloud on which to process the normals.
theNormsCodesarray in which the normals indexes are stored
methodwhich kind of model to use for the computation (LS = plane, HF = quadratic Height Function, TRI = triangulation)
radiuslocal neighborhood radius (not necessary for TRI)
preferedOrientationspecifies a preferred orientation for normals (-1: no preferred orientation, 0:+X, 1:-X, 2:+Y, 3:-Y, 4:+Z, 5:-Z, 6:+Barycenter, 7:-Barycenter)
progressCbprogress bar
inputOctreeoctree associated with theCloud.
Returns
success
static void ccNormalVectors::ComputeNormal ( normsType  normIndex,
PointCoordinateType  N[] 
)
inlinestatic

Computes the normal corresponding to a given compressed index.

Warning: slower than 'GetNormal' (but avoids computation of the whole table)

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]"
static void ccNormalVectors::ConvertHSVToRGB ( double  H,
double  S,
double  V,
colorType &  R,
colorType &  G,
colorType &  B 
)
static

Converts a HSV color to RGB color space.

Parameters
H[out] hue [0;360[
S[out] saturation [0;1]
V[out] value [0;1]
R[out] red [0;MAX_COLOR_COMP]
G[out] green [0;MAX_COLOR_COMP]
B[out] blue [0;MAX_COLOR_COMP]
static 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)
static void ccNormalVectors::ConvertNormalToHSV ( const CCVector3 &  N,
double &  H,
double &  S,
double &  V 
)
static

Converts a normal vector to HSV color space.

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

Parameters
N[in] normal (should be normalized!)
H[out] hue [0;360[
S[out] saturation [0;1]
V[out] value [0;1]
static void ccNormalVectors::ConvertNormalToRGB ( const CCVector3 &  N,
colorType &  R,
colorType &  G,
colorType &  B 
)
static

Converts a normal vector to RGB color space.

Uses 'ConvertNormalToHSV' then converts HSV to RGB.

Parameters
N[in] normal (should be normalized!)
R[out] red [0;MAX_COLOR_COMP]
G[out] green [0;MAX_COLOR_COMP]
B[out] blue [0;MAX_COLOR_COMP]
void ccNormalVectors::ConvertNormalToStrikeAndDip ( const CCVector3 &  N,
double &  strike_deg,
double &  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)

Adapted from Andy Michael's 'stridip.c': Finds strike and dip of plane given normal vector having components n, e, and u output is in degrees north of east and then uses a right hand rule for the dip of the plane

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]"
bool ccNormalVectors::enableNormalHSVColorsArray ( )

Allocates normal HSV colors array.

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

void ccNormalVectors::InvertNormal ( normsType &  code)
static

Inverts normal corresponding to a given compressed index.

Warning: compressed index is directly updated!

void ccNormalVectors::Quant_dequantize_normal ( unsigned  q,
unsigned  level,
PointCoordinateType *  res 
)
staticprotected

Decompression algorithm.

special case for level = 0

recompute the box in the sector...

unsigned ccNormalVectors::Quant_quantize_normal ( const PointCoordinateType *  n,
unsigned  level 
)
staticprotected

Compression algorithm.

compute in which sector lie the elements

scale the sectored vector - early return for null vector

compute the box

then for each required level, quantize...

do not do the last operation ...

void ccNormalVectors::ReleaseUniqueInstance ( )
static

Releases unique instance.

Call to this method is now optional.

bool ccNormalVectors::UpdateNormalOrientations ( ccGenericPointCloud theCloud,
NormsIndexesTableType theNormsCodes,
int  preferedOrientation 
)
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
preferedOrientationspecifies a preferred orientation for normals (0:+X, 1:-X, 2:+Y, 3:-Y, 4:+Z, 5:-Z, 6:+Barycenter, 7:-Barycenter, 8:+Zero, 9:-Zero)
Returns
success

Member Data Documentation

colorType* 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: