geomc 1.0
A c++ linear algebra template library
Public Member Functions | Public Attributes | Protected Attributes | List of all members
ZonalHarmonics< T, Bands > Class Template Reference

Represents a function on the N-sphere with axial symmetry. More...

#include <geomc/function/SphericalHarmonics.h>

Public Member Functions

 ZonalHarmonics ()
 
 ZonalHarmonics (index_t n)
 
 ZonalHarmonics (const SphericalHarmonics< T, Bands > &sh)
 
const T * get () const
 
T * get ()
 
index_t bands () const
 
T & coeff (index_t n)
 
coeff (index_t n) const
 
template<index_t B>
dot (const ZonalHarmonics< T, B > &zh) const
 
void generate_lambertian (index_t order=-1)
 
void generate_spot (T cos_angle)
 
eval (T cos_alt) const
 
void project (T cos_alt, T val)
 
void convolve (const ZonalHarmonics< T, Bands > &kernel)
 
void diffuse (T t)
 
void normalize ()
 
void clear ()
 

Public Attributes

UniqueStorage< T, Bands > coeffs
 Coefficient vector.
 

Protected Attributes

Dimension< Bands >::storage_t n_bands
 

Detailed Description

template<typename T, index_t Bands>
class geom::ZonalHarmonics< T, Bands >

Represents a function on the N-sphere with axial symmetry.

Useful as a convolution kernel for a SphericalHarmonics or another ZonalHarmonics function.

ZonalHarmonics require O(n) storage space on the number of bands and are generally much more efficient than SphericalHarmonics.

Constructor & Destructor Documentation

◆ ZonalHarmonics() [1/3]

ZonalHarmonics ( )
inline

Construct a new ZonalHarmonics.

If dynamically sized, only a single DC band will be allocated.

◆ ZonalHarmonics() [2/3]

ZonalHarmonics ( index_t  n)
inline

Construct a new ZonalHarmonics (dynamic size).

Parameters
nNumber of bands to allocate. Ignored if the number of bands is not dynamic.

◆ ZonalHarmonics() [3/3]

ZonalHarmonics ( const SphericalHarmonics< T, Bands > &  sh)
inline

Construct a new ZonalHarmonics representing the given SphericalHarmonics function smoothed by a rotation about its polar axis.

Parameters
shA SphericalHarmonics funciton.

Member Function Documentation

◆ bands()

index_t bands ( ) const
inline
Returns
The number of bands in the representation.

◆ clear()

void clear ( )
inline

Set all coefficients to zero.

◆ coeff() [1/2]

T & coeff ( index_t  n)
inline
Returns
The nth band coefficient.

◆ coeff() [2/2]

T coeff ( index_t  n) const
inline
Returns
The nth band coefficient.

◆ convolve()

void convolve ( const ZonalHarmonics< T, Bands > &  kernel)
inline

Blur this ZonalHarmonics function using kernel as a point spread funciton.

Parameters
kernelPoint spread function.

◆ diffuse()

void diffuse ( t)
inline

Convert this ZonalHarmonics function to its form after t self-convolutions.

If t is 0, this function becomes an N-band approximation of the dirac (identity) kernel. If t is 1, this function remains unchanged.

Parameters
tReal number of times to self-convolve.

◆ dot()

T dot ( const ZonalHarmonics< T, B > &  zh) const
inline
Returns
The inner product of this ZonalHarmonics with zh.

◆ eval()

T eval ( cos_alt) const
inline

Evaluate this ZonalHarmonics function at the given angle.

Parameters
cos_alt
Returns

◆ generate_lambertian()

void generate_lambertian ( index_t  order = -1)
inline

Replace this ZonalHarmonics function with an n-th order approximation of the Lambertian diffuse reflectance function (i.e. max(0, cos(alt))).

Parameters
orderNumber of bands to use in the approximation. If no count is specified, all available bands will be used. Note that very high-order approximations may be vulernable to numerical instability.

◆ generate_spot()

void generate_spot ( cos_angle)
inline

Replace this ZonalHarmonics function with an n-th order approximation of a circular spot on the sphere having value 1 and the given angular radius.

Parameters
cos_angleCosine of the radial angle of the spot (between -1 and 1).

◆ get() [1/2]

T * get ( )
inline

Return a pointer to the array of coefficients.

◆ get() [2/2]

const T * get ( ) const
inline

Return a pointer to the array of coefficients.

◆ normalize()

void normalize ( )
inline

Ensure the integral over the entire sphere is 1. If the integral is currently 0, no change will be made.

◆ project()

void project ( cos_alt,
val 
)
inline

Project the sample having value val at angle given by cos_alt to this ZonalHarmonics function.

Parameters
cos_altCosine of the angle from the polar axis to the sample.
valValue of the sample.

The documentation for this class was generated from the following files: