Shaders for Shadows
Shader code for rendering shadows of translucent occluders, soft shadows and single scattering with moment shadow maps.
 All Classes Files Functions Variables Pages
Macros | Functions
ComplexAlgebra.fx File Reference

Go to the source code of this file.

Macros

#define POLYNOMIAL_DEGREE   1
 
#define POLYNOMIAL_DEGREE   2
 
#define POLYNOMIAL_DEGREE   3
 
#define POLYNOMIAL_DEGREE   4
 
#define POLYNOMIAL_DEGREE   5
 
#define POLYNOMIAL_DEGREE   6
 
#define POLYNOMIAL_DEGREE   7
 
#define POLYNOMIAL_DEGREE   8
 

Functions

float2 Conjugate (float2 Z)
 
float2 Multiply (float2 LHS, float2 RHS)
 
float Magnitude (float2 Z)
 
float2 Divide (float2 Numerator, float2 Denominator)
 
float2 Reciprocal (float2 Z)
 
float2 Square (float2 Z)
 
float2 Cube (float2 Z)
 
float2 SquareRootUnsafe (float2 Z)
 
float2 SquareRoot (float2 Z)
 
float2 CubicRoot (float2 Z)
 
float2 EvaluatePolynomial (float2 pCoefficient[POLYNOMIAL_DEGREE+1], float2 X)
 
float2x2 Conjugate (float2x2 Vector)
 
float3x2 Conjugate (float3x2 Vector)
 
float4x2 Conjugate (float4x2 Vector)
 
void Conjugate (out float2 OutConjugateVector[5], float2 Vector[5])
 

Detailed Description

This header defines utility functions to deal with complex numbers and complex polynomials.

Definition in file ComplexAlgebra.fx.

Function Documentation

float2 Conjugate ( float2  Z)

Returns the complex conjugate of the given complex number (i.e. it changes the sign of the y-component).

Definition at line 7 of file ComplexAlgebra.fx.

float2x2 Conjugate ( float2x2  Vector)

Returns the complex conjugate of the given complex vector (i.e. it changes the second column resp the y-component).

Definition at line 73 of file ComplexAlgebra.fx.

float2 Cube ( float2  Z)

This utility function implements complex computation of the third power.

Definition at line 33 of file ComplexAlgebra.fx.

float2 CubicRoot ( float2  Z)

This utility function computes one cubic root of the given complex value. The other roots can be found by multiplication by cubic roots of unity.

Note
This function has various discontinuities.

Definition at line 62 of file ComplexAlgebra.fx.

float2 Divide ( float2  Numerator,
float2  Denominator 
)

This function computes the quotient of two complex numbers. The denominator must not be zero.

Definition at line 20 of file ComplexAlgebra.fx.

float2 EvaluatePolynomial ( float2  pCoefficient[POLYNOMIAL_DEGREE+1],
float2  X 
)

This function evaluates the polynomial with the given coefficients at the given value. The complex number given by pCoefficient[j] is used as coefficient for the j-th power. All other coefficients are zero.

Definition at line 94 of file ComplexAlgebra.fx.

float Magnitude ( float2  Z)

This function computes the magnitude of the given complex number.

Definition at line 15 of file ComplexAlgebra.fx.

float2 Multiply ( float2  LHS,
float2  RHS 
)

This function implements complex multiplication.

Definition at line 11 of file ComplexAlgebra.fx.

float2 Reciprocal ( float2  Z)

This function implements computation of the reciprocal of the given non-zero complex number.

Definition at line 25 of file ComplexAlgebra.fx.

float2 Square ( float2  Z)

This utility function implements complex squaring.

Definition at line 29 of file ComplexAlgebra.fx.

float2 SquareRoot ( float2  Z)

This utility function computes one square root of the given complex value. The other one can be found using the unary minus operator.

Note
This function has discontinuities for values with real part zero.
See Also
SquareRootUnsafe()

Definition at line 54 of file ComplexAlgebra.fx.

float2 SquareRootUnsafe ( float2  Z)

This utility function computes one root of the given complex value. The other one can be found using the unary minus operator.

Warning
This function is continuous but not defined on the negative real axis (and cannot be continued continuously there).
See Also
SquareRoot()

Definition at line 41 of file ComplexAlgebra.fx.