private void InitHoughMap( )
{
if ( needToInitialize )
{
needToInitialize = false;
houghHeight = (int) ( 2 * maxSkewToDetect * stepsPerDegree );
thetaStep = ( 2 * maxSkewToDetect * Math.PI / 180 ) / houghHeight;
// precalculate Sine and Cosine values
sinMap = new double[houghHeight];
cosMap = new double[houghHeight];
double minTheta = 90.0 - maxSkewToDetect;
for ( int i = 0; i < houghHeight; i++ )
{
sinMap[i] = Math.Sin( ( minTheta * Math.PI / 180 ) + ( i * thetaStep ) );
cosMap[i] = Math.Cos( ( minTheta * Math.PI / 180 ) + ( i * thetaStep ) );
}
}
}
}