SphericalGridViewer.exe
: This executable
provides an interactive tool for visualizing spherical functions. Running:
% SphericalGridViewer function.sgrid
will open up an OpenGL window, visualizing the spherical function by displacing points on the surface
of the sphere in proportion to the magnitude of the value of the function at the point. (Points with
positive value are drawn in red, points with negative value are drawn in blue.)
You can interact with the visualization by:
Mesh2SphericalGrid.exe
: If you have access to
3D models in .ply format, you can use this executable to compute the spherical extent function. Running:
% Mesh2SphericalGrid model.ply res model.sgrid
will read in the 3D model from "model.ply" and write out a "res"x"res" SphericalGrid
to the
file "model.sgrid". (Keep in mind that the implementations of the spherical harmonic transform and Wigner D-transform expect the resolution of the spherical grid to be a power of two.)
FourierKeyS2
and FourierKeySO3
classes respectively. Because it is assumed that the spherical and rotational functions are real-valued, there will be redundancy in these coefficients akin to the redundancy in the Fourier coefficients of real-valued circular functions. As a result, only half of the coefficients are stored, resulting in some tricky indexing:
FourierKeyS2
: Up to scaling, the spherical harmonic coefficients of a real-valued function have the property that (l,-m)-th spherical harmonic coefficient is the complex conjugate of the (l,m)-th spherical harmonic coefficient. As a result, we only store the spherical harmonic coefficients for non-negative values of m.
Given an instance of the FourierKeyS2
class, the spherical harmonic coefficients can be accessed as follows:
FourierKeyS2< > key;
for ( int i = 0 ; i < key.bandWidth( ) ; i++ )
for ( int j = 0 ; j <= i ; j++ )
{
key( i , j ) =...;
}
FourierKeySO3
: Up to scaling, the Wigner D-coefficients of a real-valued function have the property that (l,-m,-m')-th coefficient is the complex conjugate of the (l,m,m')-th coefficient. As a result, we only store the Wigner D-coefficients of the pairs of indices (m,m') for which m is non-negative.
Given an instance of the FourierKeySO3
class, the Wigner D-coefficients can be accessed as follows:
FourierKeySO3< > key;Note that, in the implementation, the key value indexed by (i,j,k) corresponds to the Wigner-D function Dikj(R) = <ρR(Yik),Yij>.
for ( int i = 0 ; i < key.bandWidth( ) ; i++ )
for ( int j = 0 ; j <= i ; j++ )
for ( int k = -i ; k <= i ; k++ )
{
key( i , j , k ) =...;
}
SphericalGrid
: To access a spherical function you may want to use the coordinates of a 3D point rather than the 2D spherical index. To transition between the 2D(floating point) index and a 3D point, you should use the SphericalGrid::setCoordinates
function:
SphericalGrid<Real>::setCoordinates(const Real& i,const Real& j,Real coords[3])
:
This method takes in a 2D index in the spherical array and returns the associated point on the unit sphere.
SphericalGrid<Real>::setCoordinates(const Real coords[3],const Real& i,const Real& j)
:
This method takes in a 3D point and returns the associated 2D index in the spherical array. (Note that the code will normalize the 3D point so that it has norm one, so you do not need to worry about this.)
RotationGrid
: To access a rotational function you may want to use the entries of a 3x3 rotation matrix rather than the 3D Euler index. To transition between the 3D (floating point) index a rotation, you should use the RotationGrid::setCoordinates
function:
RotationGrid<Real>::setCoordinates(const Real& i,const Real& j,const Real& k,Real matrix[3][3])
:
This method takes in a 3D index in the rotational array and returns the 3x3 rotation matrix. (Note that matrix[i][j] corresponds to the entry in the matrix at column i and row j.)
Rotation<Real>::setCoordinates(const Real matrix[3][3],const Real& i,const Real& j,const Real& k)
:
This method takes in a rotation matrix and returns the associated 3D index in the rotational function.
Rotation<Real>::SetCoordinates(const Real axis[3],const Real& theta,Real matrix[3][3])
:
Given an axis an angle of rotation, this method will set the entries 3x3 of the matrix corresponding to this rotation.