Commit 341224bc authored by Stefan Philips's avatar Stefan Philips

[CHANGE] Remove resize for spherical harmonics coefficients, because the...

[CHANGE] Remove resize for spherical harmonics coefficients, because the resize function of the Eigen vector (WVector_2) destroys the stored values.
parent f7932bf9
......@@ -418,7 +418,6 @@ void WMTeemGlyphs::GlyphGeneration::minMaxNormalization( limnPolyData *glyph, co
max = norm;
}
}
// std::cerr << "max: " << max << " min: " << min;
double dist = max - min;
if( dist != 0.0 )
......@@ -540,25 +539,14 @@ void WMTeemGlyphs::GlyphGeneration::operator()( size_t id, size_t numThreads, WB
size_t nbVerts = m_sphere->xyzwNum;
const tijk_type *type = 0; // Initialized to quiet compiler
switch( m_order )
{
case 2:
type = tijk_2o3d_sym;
break;
case 4:
type = tijk_4o3d_sym;
break;
case 6:
type = tijk_6o3d_sym;
break;
default:
WAssert( false, "order above 6 not supported yet." );
}
const tijk_type *typeOrder2 = tijk_2o3d_sym;
const tijk_type *typeOrder4 = tijk_4o3d_sym;
const tijk_type *typeOrder6 = tijk_6o3d_sym;
// memory for the tensor and spherical harmonics data.
float* ten = new float[type->num];
float* res = new float[type->num];
float* esh = new float[type->num];
float* ten = new float[ typeOrder6->num ];
float* res = new float[ typeOrder6->num ];
float* esh = new float[ typeOrder6->num ];
size_t chunkSize = m_nA / ( numThreads - 1 );
......@@ -619,31 +607,53 @@ void WMTeemGlyphs::GlyphGeneration::operator()( size_t id, size_t numThreads, WB
}
WVector_2 coeffs = m_dataSet->getSphericalHarmonicAt( posId ).getCoefficients();
int countOfCoeffsToUse = 0;
switch( m_order )
{
case 2:
coeffs.resize( 6 );
countOfCoeffsToUse = 6;
break;
case 4:
coeffs.resize( 15 );
countOfCoeffsToUse = 15;
break;
case 6:
countOfCoeffsToUse = 28;
break;
default:
WAssert( false, "order above 6 not supported yet." );
}
countOfCoeffsToUse = std::min( static_cast< int >( coeffs.size() ), countOfCoeffsToUse );
// determine order to use
int useOrder = 0;
switch( countOfCoeffsToUse )
{
case 6:
coeffs.resize( 28 );
useOrder = 2;
type = typeOrder2;
break;
case 15:
useOrder = 4;
type = typeOrder4;
break;
case 28:
useOrder = 6;
type = typeOrder6;
break;
default:
WAssert( false, "order above 6 not supported yet." );
}
for( size_t coeffId = 0; coeffId < coeffs.size(); coeffId++ )
for( int coeffId = 0; coeffId < countOfCoeffsToUse; ++coeffId )
{
esh[coeffId] = coeffs[coeffId];
esh[ coeffId ] = coeffs( coeffId );
}
// change Descoteaux basis to Schulz/teem basis
// Descoteaux basis: see his PhD thesis page 66
// Schultz basis: see PDF "Real Spherical Harmonic basis" - Luke Bloy 9. December 2009
size_t k = 0;
for ( int l = 0; l <= static_cast<int>( m_order ); l += 2 )
for ( int l = 0; l <= useOrder; l += 2 )
{
for ( int m = -l; m <= l; ++m )
{
......@@ -660,7 +670,7 @@ void WMTeemGlyphs::GlyphGeneration::operator()( size_t id, size_t numThreads, WB
}
// convert even-order spherical harmonics to higher-order tensor
tijk_esh_to_3d_sym_f( ten, esh, m_order );
tijk_esh_to_3d_sym_f( ten, esh, useOrder );
const char normalize = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment