NormalsHelperInterface Class Reference

#include <normalshelper.h>

Detailed Description

Normal generation utilities for shading of meshes.

Static Public Member Functions

static MAXON_METHOD Result< void > CalculatePolygonNormals (const Block< const Vector > &points, const Block< const SimplePolygon > &polygons, Bool normalized, Block< Vector32 > &polygonNormals)
 
static MAXON_METHOD Result< void > CalculatePolygonNormals (const Block< const Vector > &points, const Block< const SimplePolygon > &polygons, Bool normalized, Block< Vector > &polygonNormals)
 
static MAXON_METHOD Result< void > CalculatePolygonNormals (const Block< const Vector32 > &points, const Block< const SimplePolygon > &polygons, Bool normalized, Block< Vector32 > &polygonNormals)
 
static MAXON_METHOD Result< void > CalculatePointNormalsAveraged (NORMALS_STYLE style, const Block< const Vector > &points, const Block< const SimplePolygon > &polygons, const Block< const Vector32 > &polygonNormals, Block< Vector32 > &pointNormals)
 
static MAXON_METHOD Result< void > CalculateShadingNormalsAveraged (NORMALS_STYLE style, const Block< const Vector > &points, const Block< const SimplePolygon > &polygons, const Block< const Vector32 > &polygonNormals, Block< Vector32 > &shadingNormals)
 
static MAXON_METHOD Result< void > CalculateShadingNormals (NORMALS_STYLE style, const Block< const Vector > &points, const Block< const SimplePolygon > &polygons, const Block< const Vector32 > &polygonNormals, Float32 angle, const Block< const UChar > &shadingBreaks, Block< Vector32 > &shadingNormals)
 

Private Member Functions

 MAXON_INTERFACE_NONVIRTUAL (NormalsHelperInterface, MAXON_REFERENCE_STATIC, "net.maxon.geom.normalshelper")
 

Member Function Documentation

◆ MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( NormalsHelperInterface  ,
MAXON_REFERENCE_STATIC  ,
"net.maxon.geom.normalshelper"   
)
private

◆ CalculatePolygonNormals() [1/3]

static MAXON_METHOD Result<void> CalculatePolygonNormals ( const Block< const Vector > &  points,
const Block< const SimplePolygon > &  polygons,
Bool  normalized,
Block< Vector32 > &  polygonNormals 
)
static

Computes the polygon normals for the given polygons and points. If normalized is set to True, the output polygon normals will be normalized to range [0-1]. Otherwise, the normals will be scaled with the polygon area. If using the UNIFORM or ANGLE_WEIGHTED normals style, one should normalize the normals.

Parameters
[in]pointsBlock containing the points of the mesh.
[in]polygonsBlock containing the polygons of the mesh. For triangles, polygon.c == polygon.d
[in]normalizedWhether the output normals should be normalized to [0-1] range.
[out]polygonNormalsThe generated polygon normals. This block should be resized before, such that the size of the block equals the number of polygons.
Returns
OK on success, otherwise error.

◆ CalculatePolygonNormals() [2/3]

static MAXON_METHOD Result<void> CalculatePolygonNormals ( const Block< const Vector > &  points,
const Block< const SimplePolygon > &  polygons,
Bool  normalized,
Block< Vector > &  polygonNormals 
)
static

Computes the polygon normals for the given polygons and points. If normalized is set to True, the output polygon normals will be normalized to range [0-1]. Otherwise, the normals will be scaled with the polygon area. If using the UNIFORM or ANGLE_WEIGHTED normals style, one should normalize the normals.

Parameters
[in]pointsBlock containing the points of the mesh.
[in]polygonsBlock containing the polygons of the mesh. For triangles, polygon.c == polygon.d
[in]normalizedWhether the output normals should be normalized to [0-1] range.
[out]polygonNormalsThe generated polygon normals. This block should be resized before, such that the size of the block equals the number of polygons.
Returns
OK on success, otherwise error.

◆ CalculatePolygonNormals() [3/3]

static MAXON_METHOD Result<void> CalculatePolygonNormals ( const Block< const Vector32 > &  points,
const Block< const SimplePolygon > &  polygons,
Bool  normalized,
Block< Vector32 > &  polygonNormals 
)
static

Computes the polygon normals for the given polygons and points. If normalized is set to True, the output polygon normals will be normalized to range [0-1]. Otherwise, the normals will be scaled with the polygon area. If using the UNIFORM or ANGLE_WEIGHTED normals style, one should normalize the normals.

Parameters
[in]pointsBlock containing the points of the mesh.
[in]polygonsBlock containing the polygons of the mesh. For triangles, polygon.c == polygon.d
[in]normalizedWhether the output normals should be normalized to [0-1] range.
[out]polygonNormalsThe generated polygon normals. This block should be resized before, such that the size of the block equals the number of polygons.
Returns
OK on success, otherwise error.

◆ CalculatePointNormalsAveraged()

static MAXON_METHOD Result<void> CalculatePointNormalsAveraged ( NORMALS_STYLE  style,
const Block< const Vector > &  points,
const Block< const SimplePolygon > &  polygons,
const Block< const Vector32 > &  polygonNormals,
Block< Vector32 > &  pointNormals 
)
static

Computes the point normals (average normal of all adjacent polygons) using the style specified. Polygons will share the same normal for each point. This version does not take into consideration the shading break angle, or the shading break edges. If style is set to UNIFORM or ANGLE_WEIGHTED, the given polygon normals should be normalized. Note that ANGLE_WEIGHTED style can have a significant performance impact.

Parameters
[in]styleThe style of the normals to generate.
[in]pointsBlock containing the points of the mesh.
[in]polygonsBlock containing the polygons of the mesh. For triangles, polygon.c == polygon.d
[in]polygonNormalsThe input array of polygon normals, size of which will correspond to the number of polygons. Depending on the style, the normals may or may not need to be normalized.
[out]pointNormalsThe generated point normals. The size of this block should correspond to the point count.
Returns
OK on success, otherwise error.

◆ CalculateShadingNormalsAveraged()

static MAXON_METHOD Result<void> CalculateShadingNormalsAveraged ( NORMALS_STYLE  style,
const Block< const Vector > &  points,
const Block< const SimplePolygon > &  polygons,
const Block< const Vector32 > &  polygonNormals,
Block< Vector32 > &  shadingNormals 
)
static

Computes the shading (per polygon vertex) normals Each polygon will have four resulting normals, one for each point in the polygon. Polygons will share the same normal for each point. This version does not take into consideration the shading break angle, or the shading break edges. If style is set to UNIFORM or ANGLE_WEIGHTED, the given polygon normals should be normalized. Note that ANGLE_WEIGHTED style can have a significant performance impact.

Parameters
[in]styleThe style of the normals to generate.
[in]pointsBlock containing the points of the mesh.
[in]polygonsBlock containing the polygons of the mesh. For triangles, polygon.c == polygon.d
[in]polygonNormalsThe input array of polygon normals, size of which will correspond to the number of polygons. Depending on the style, the normals may or may not need to be normalized.
[out]shadingNormalsThe generated shading normals. The size of this block should correspond to 4 * polygonCount.
Returns
OK on success, otherwise error.

◆ CalculateShadingNormals()

static MAXON_METHOD Result<void> CalculateShadingNormals ( NORMALS_STYLE  style,
const Block< const Vector > &  points,
const Block< const SimplePolygon > &  polygons,
const Block< const Vector32 > &  polygonNormals,
Float32  angle,
const Block< const UChar > &  shadingBreaks,
Block< Vector32 > &  shadingNormals 
)
static

Computes the shading (per polygon vertex) normals Each polygon will have four resulting normals, one for each point in the polygon. This version takes into consideration the shading break angle, as well as the shading break edges. If style is set to UNIFORM or ANGLE_WEIGHTED, the given polygon normals should be normalized. Note that ANGLE_WEIGHTED style can have a significant performance impact.

Parameters
[in]styleThe style of the normals to generate.
[in]pointsBlock containing the points of the mesh.
[in]polygonsBlock containing the polygons of the mesh. For triangles, polygon.c == polygon.d
[in]polygonNormalsThe input array of polygon normals, size of which will correspond to the number of polygons. Depending on the style, the normals may or may not need to be normalized.
[in]angleThe angle threshold at which to break the shading.
[in]shadingBreaksThe Compacted array which denotes the shading break edges. for each polygon, the individual bits correspond to the individual edges of that polygon. An empty block can be given, to avoid checking the edges.
[out]shadingNormalsThe generated shading normals. The size of this block should correspond to 4 * polygonCount.
Returns
OK on success, otherwise error.