Workspace 6.21.5
Public Types | Public Member Functions | List of all members
MultiNodeNormals Class Reference

Provides a set of normals associated with a node based on attached elements. More...

#include <Mesh/DataStructures/multinodenormals.h>

Public Types

using NormalsVector = QVector< Vector3d >
 

Public Member Functions

 MultiNodeNormals ()
 
 ~MultiNodeNormals ()
 
Vector3d getClosestNormal (const NodeHandle &node, const Vector3d &v) const
 
double getEdgeBreakAngle () const
 
bool getElementNormal (const ElementType::Type &type, const ElementHandle &element, Vector3d &result) const
 
bool getIncludeZeroLengthNormals () const
 
unsigned getLocalIndexOfClosestNormal (const NodeHandle &node, const Vector3d &v) const
 
bool getMultiOnConvexOnly () const
 
Vector3d getNodeNormal (const NodeHandle &node, unsigned index) const
 
NormalsVector getNodeNormals (const NodeHandle &node) const
 
const QString & getNormalStateName () const
 
unsigned getNumNormalsForNode (const NodeHandle &node) const
 
unsigned getTotalNodes () const
 
unsigned getTotalNormals () const
 
bool getUseExistingNodeNormalsState () const
 
void setEdgeBreakAngle (double angle)
 
void setIncludeAngleWeightedAverageOfElementNormals (bool b)
 
void setIncludeZeroLengthNormals (bool b)
 
void setMultiOnConvexOnly (bool b)
 
bool setNodeNormals (const NodeHandle &node, const NormalsVector &val)
 
void setNormalStateName (const QString &val)
 
void setUseExistingNodeNormalsState (bool b)
 
int update (const MeshModelInterface &model)
 

Detailed Description

A node normal can be provided through the node state "normal" or it can be omitted, in which case the node normal will be calculated and included in the distinct normals.

Member Typedef Documentation

◆ NormalsVector

using NormalsVector = QVector<Vector3d>

Constructor & Destructor Documentation

◆ MultiNodeNormals()

◆ ~MultiNodeNormals()

~MultiNodeNormals ( )
default

Member Function Documentation

◆ getClosestNormal()

Vector3d getClosestNormal ( const NodeHandle node,
const Vector3d v 
) const
Returns
The pre-calculated normal for node closest to v or a zero vector if node has no pre-calculated normals. Normals are calculated by update().

◆ getEdgeBreakAngle()

double getEdgeBreakAngle ( ) const
Returns
The break angle threshold.
See also
setEdgeBreakAngle()

◆ getElementNormal()

bool getElementNormal ( const ElementType::Type type,
const ElementHandle element,
Vector3d result 
) const

◆ getIncludeZeroLengthNormals()

bool getIncludeZeroLengthNormals ( ) const

◆ getLocalIndexOfClosestNormal()

unsigned getLocalIndexOfClosestNormal ( const NodeHandle node,
const Vector3d v 
) const
Returns
The local index of the pre-calculated normal for node closest to v or -1 if node has no pre-calculated normals. Normals are calculated by update().

◆ getMultiOnConvexOnly()

bool getMultiOnConvexOnly ( ) const
Returns
True if distinct normals are only potentially added for convex edges.
See also
setMultiOnConvexOnly()

◆ getNodeNormal()

Vector3d getNodeNormal ( const NodeHandle node,
unsigned  index 
) const
Precondition
index < getNumNormalsForNode(node)

◆ getNodeNormals()

CSIRO::Mesh::MultiNodeNormals::NormalsVector getNodeNormals ( const NodeHandle node) const
Parameters
nodeThe node to get the vectors on
Returns
Returns the vector of node normals on the node. An empty vector is returned in the case of the node not being present in the internal map.

◆ getNormalStateName()

const QString & getNormalStateName ( ) const

◆ getNumNormalsForNode()

unsigned getNumNormalsForNode ( const NodeHandle node) const

◆ getTotalNodes()

unsigned getTotalNodes ( ) const
Returns
Total number of unique nodes including all nodes duplicated to have a unique normal as part of any edge break. Also includes nodes without normals (nodes that are not part of any element).

◆ getTotalNormals()

unsigned getTotalNormals ( ) const
Returns
Total number of unique normals including all nodes duplicated to have unique normal as part of any edge break. Note this may be less than the number of nodes as nodes without elements have no normals.

◆ getUseExistingNodeNormalsState()

bool getUseExistingNodeNormalsState ( ) const

◆ setEdgeBreakAngle()

void setEdgeBreakAngle ( double  angle)
Parameters
angleThe break angle threshold between any two element normals for elements sharing a particular node. Conceptually, you can think of it as the angle from planar beyond which two elements sharing an edge can be considered a sharp edge. The angle is specified in degrees.
See also
getEdgeBreakAngle()

◆ setIncludeAngleWeightedAverageOfElementNormals()

void setIncludeAngleWeightedAverageOfElementNormals ( bool  b)
Parameters
bIf false, then we don't include the node normal that would be calculated using calculateNodeNormal (in meshmodelutils.h)

◆ setIncludeZeroLengthNormals()

void setIncludeZeroLengthNormals ( bool  b)

◆ setMultiOnConvexOnly()

void setMultiOnConvexOnly ( bool  b)
Parameters
bIf true, then an extra normal is only potentially added to the normal set for a pair of adjacent elements if their shared edge is convex. There are some special cases where you don't want an extra normal for concave edges, so for those scenarios call this function with the parameter set to true. The default value is set to false in the constructor.
See also
getMultiOnConvexOnly()

◆ setNodeNormals()

bool setNodeNormals ( const NodeHandle node,
const NormalsVector val 
)
Parameters
nodeThe node to set the vectors on
valThe set of values to set the normals to
Returns
Returns false if the node normals could not be set (node not in existing list)

◆ setNormalStateName()

void setNormalStateName ( const QString &  val)

◆ setUseExistingNodeNormalsState()

void setUseExistingNodeNormalsState ( bool  b)

◆ update()

int update ( const MeshModelInterface model)
Parameters
modelThe model for which multiple node normals need to be calculated.
Returns
The number of extra normals generated.

The function populates internal data structures for model, computes the normals and returns. Holds a reference to the model for the life of the object which is used when useExistingNodeNormalsState option set. When called, any previous results are discarded.