maxon::TangentSpaceNormalHelper Namespace Reference

Classes

struct  NormalVertexCycle
 
class  NormalVertexCycles
 
struct  NeighborWrapper
 
class  TangentSpaceNormalData
 

Functions

Vector ComputeNormal (const Vector &prevPoint, const Vector &currPoint, const Vector &nextPoint)
 
Vector ComputeTangent (const Vector &prevPoint, const Vector &currPoint, const Vector &nextPoint)
 
Vector ConvertToTangentSpaceNormal (const Vector &prevPoint, const Vector &currPoint, const Vector &nextPoint, const Vector &objectSpaceNormal)
 
Vector ConvertToObjectSpaceNormal (const Vector &prevPoint, const Vector &currPoint, const Vector &nextPoint, const Vector &tangentSpaceNormal)
 
Vector ComputeNormal (const Block< const Vector > &points, const Block< const Int32 > polygonPoints, Int32 index)
 
Vector ComputeTangent (const Block< const Vector > &points, const Block< const Int32 > polygonPoints, Int32 index)
 
Vector ComputeBiTangent (const Vector &normal, const Vector &tangent)
 
Vector ConvertToTangentSpaceNormal (const Block< const Vector > &points, const Block< const Int32 > polygonPoints, Int32 index, const Vector &objectSpaceNormal)
 
Vector ConvertToObjectSpaceNormal (const Block< const Vector > &points, const Block< const Int32 > polygonPoints, Int32 index, const Vector &tangentSpaceNormal)
 

Function Documentation

◆ ComputeNormal() [1/2]

Vector maxon::TangentSpaceNormalHelper::ComputeNormal ( const Vector prevPoint,
const Vector currPoint,
const Vector nextPoint 
)

Computes the normal of a triangle from the three points.

Parameters
[in]prevPointPrevious triangle point.
[in]currPointCorner triangle point.
[in]nextPointNext triangle point.
Returns
The normal vector for the triangle.

◆ ComputeTangent() [1/2]

Vector maxon::TangentSpaceNormalHelper::ComputeTangent ( const Vector prevPoint,
const Vector currPoint,
const Vector nextPoint 
)

Computes the tangent of a triangle from the three points.

Parameters
[in]prevPointPrevious triangle point.
[in]currPointCorner triangle point.
[in]nextPointNext triangle point.
Returns
The tangent vector for the triangle.

◆ ConvertToTangentSpaceNormal() [1/2]

Vector maxon::TangentSpaceNormalHelper::ConvertToTangentSpaceNormal ( const Vector prevPoint,
const Vector currPoint,
const Vector nextPoint,
const Vector objectSpaceNormal 
)

Computes the tangent space normal from the object space normal in the space of the given triangle points.

Parameters
[in]prevPointPrevious triangle point.
[in]currPointCorner triangle point.
[in]nextPointNext triangle point.
[in]objectSpaceNormalThe normal in object space.
Returns
The normal vector in tangent space.

◆ ConvertToObjectSpaceNormal() [1/2]

Vector maxon::TangentSpaceNormalHelper::ConvertToObjectSpaceNormal ( const Vector prevPoint,
const Vector currPoint,
const Vector nextPoint,
const Vector tangentSpaceNormal 
)

Computes the object space normal from the tangent space normal in the space of the given triangle points.

Parameters
[in]prevPointPrevious triangle point.
[in]currPointCorner triangle point.
[in]nextPointNext triangle point.
[in]tangentSpaceNormalThe normal in tangent space.
Returns
The normal vector in object space.

◆ ComputeNormal() [2/2]

Vector maxon::TangentSpaceNormalHelper::ComputeNormal ( const Block< const Vector > &  points,
const Block< const Int32 polygonPoints,
Int32  index 
)

Computes the normal of the given polygon, at the corner specified by the given index. The normal is computed in object space, as the cross product of the incoming and outgoing edges.

Parameters
[in]pointsThe points of the polygon object.
[in]polygonPointsThe vertex indices which form the current polygon. The list should not contain duplicate entries. In case of a triangle, three vertices should be provided.
[in]indexThe index which specifies the corner of the polygon, for which the normal will be calculated. always in range [0, polygonPoints.GetCount() - 1]
Returns
The normal for the specified corner of the given polygon in object space. Normalized to length == 1.0_f.

◆ ComputeTangent() [2/2]

Vector maxon::TangentSpaceNormalHelper::ComputeTangent ( const Block< const Vector > &  points,
const Block< const Int32 polygonPoints,
Int32  index 
)

Computes the tangent of the given polygon, at the corner specified by the given index. The tangent is computed as a vector which points from the point specified by the index, to a point which is defined as the sum of vectors, defined by the incoming and outgoing edges into this vertex. By definition, the tangent computed by this function will be perpendicular to the normal computed by ComputeNormal().

Parameters
[in]pointsThe points of the polygon object.
[in]polygonPointsThe vertex indices which form the current polygon. The list should not contain duplicate entries. In case of a triangle, three vertices should be provided.
[in]indexThe index which specifies the corner of the polygon, for which the normal will be calculated. always in range [0, polygonPoints.GetCount() - 1]
Returns
The tangent for the specified corner of the given polygon in object space. Normalized to length == 1.0_f.

◆ ComputeBiTangent()

Vector maxon::TangentSpaceNormalHelper::ComputeBiTangent ( const Vector normal,
const Vector tangent 
)

The bitangent is a vector that is perpendicular both to the tangent, computed by ComputeTangent() and the normal, computed by ComputeNormal() Simply, it is a cross product of the normal and the tangent vector. The three vectors(normal, tangent, binormal) will form the basis of a matrix used to convert the custom vertex normals from object space to tangent (local to polygon) space.

Parameters
[in]normalThe computed normal for the corner of a polygon. Computed by ComputeNormal().
[in]tangentThe computed tangent for the corner of a polygon. Computed by ComputeTangent().
Returns
The bitangent for the specified corner of the given polygon in object space. Normalized to length == 1.0_f.

◆ ConvertToTangentSpaceNormal() [2/2]

Vector maxon::TangentSpaceNormalHelper::ConvertToTangentSpaceNormal ( const Block< const Vector > &  points,
const Block< const Int32 polygonPoints,
Int32  index,
const Vector objectSpaceNormal 
)

Converts the given object space custom vertex normal, to a tangent space normal, for the specified corner of the given polygon. For the conversion, a matrix using the normal, tangent and binormal will be used.

Parameters
[in]pointsThe points of the polygon object.
[in]polygonPointsThe vertex indices which form the current polygon. The list should not contain duplicate entries. In case of a triangle, three vertices should be provided.
[in]indexThe index which specifies the corner of the polygon, for which the normal will be calculated. always in range [0, polygonPoints.GetCount() - 1]
[in]objectSpaceNormalThe custom vertex normal (in object space) that should be converted to tangent space.
Returns
The custom normal vector, converted to tangent space.

◆ ConvertToObjectSpaceNormal() [2/2]

Vector maxon::TangentSpaceNormalHelper::ConvertToObjectSpaceNormal ( const Block< const Vector > &  points,
const Block< const Int32 polygonPoints,
Int32  index,
const Vector tangentSpaceNormal 
)

Converts the given tangent space custom vertex normal, to an object space normal, for the specified corner of the given polygon. For the conversion, a matrix using the normal, tangent and binormal will be used.

Parameters
[in]pointsThe points of the polygon object.
[in]polygonPointsThe vertex indices which form the current polygon. The list should not contain duplicate entries. In case of a triangle, three vertices should be provided.
[in]indexThe index which specifies the corner of the polygon, for which the normal will be calculated. always in range [0, polygonPoints.GetCount() - 1]
[in]tangentSpaceNormalThe custom vertex normal (in tangent space) that should be converted to object space.
Returns
The custom normal vector, converted to object space.