### [REFAC] moved method from class to separate namespace

parent 3b3a2a0d
 ... ... @@ -382,7 +382,7 @@ std::pair WMPickingDVR::calculateIntervalsWYSIWYP( const std::vector vecFirstDerivative; std::vector vecSecondDerivative; calculateDerivativesWYSIWYP( vecAlphaAcc, vecFirstDerivative, vecSecondDerivative ); PickingDVRHelper::calculateDerivativesWYSIWYP( vecAlphaAcc, vecFirstDerivative, vecSecondDerivative ); // Upper bounds temporary variable ... will not be returned std::vector vecIndicesUpperBounds; ... ... @@ -436,118 +436,6 @@ std::pair WMPickingDVR::calculateIntervalsWYSIWYP( const std::vector& values, std::vector& vecFirstDerivative, std::vector& vecSecondDerivative ) { //Fourth Order Finite Differencing by Daniel Gerlicher unsigned int n = values.size(); double deriv = 0.0; double coeff = 1.0 / 12.0; //Calculate first derivative for( unsigned int j = 0; j < n; j++ ) { //Forward Diff if( j == 0 ) { deriv = coeff * ( -25 * values[j] + 48 * values[j+1] - 36 * values[j+2] + 16 * values[j+3] - 3 * values[j+4] ); } else if( j == 1 ) { deriv = coeff * ( -3 * values[j-1] - 10 * values[j] + 18 * values[j+1] - 6 * values[j+2] + 1 * values[j+3] ); } //Backward Diff else if( j == n - 1 ) { deriv = coeff * ( 25 * values[j] - 48 * values[j-1] + 36 * values[j-2] - 16 * values[j-3] + 3 * values[j-4] ); } else if( j == n - 2 ) { deriv = coeff * ( +3 * values[j+1] + 10 * values[j] - 18 * values[j-1] + 6 * values[j-2] - 1 * values[j-3] ); } //Center else { deriv = coeff * ( -1 * values[j+2] + 8 * values[j+1] - 8 * values[j-1] + 1 * values[j-2] ); } vecFirstDerivative.push_back( deriv ); } //Calculate Second derivative, by applying the first derivative for( unsigned int j = 0; j < n; j++ ) { //Forward Diff if( j == 0 ) { deriv = coeff * ( -25 * vecFirstDerivative[j] + 48 * vecFirstDerivative[j+1] - 36 * vecFirstDerivative[j+2] + 16 * vecFirstDerivative[j+3] - 3 * vecFirstDerivative[j+4] ); } else if( j == 1 ) { deriv = coeff * ( -3 * vecFirstDerivative[j-1] - 10 * vecFirstDerivative[j] + 18 * vecFirstDerivative[j+1] - 6 * vecFirstDerivative[j+2] + 1 * vecFirstDerivative[j+3] ); } //Backward Diff else if( j == n - 1 ) { deriv = coeff * ( 25 * vecFirstDerivative[j] - 48 * vecFirstDerivative[j-1] + 36 * vecFirstDerivative[j-2] - 16 * vecFirstDerivative[j-3] + 3 * vecFirstDerivative[j-4] ); } else if( j == n - 2 ) { deriv = coeff * ( +3 * vecFirstDerivative[j+1] + 10 * vecFirstDerivative[j] - 18 * vecFirstDerivative[j-1] + 6 * vecFirstDerivative[j-2] - 1 * vecFirstDerivative[j-3] ); } //Center else { deriv = coeff * ( -1 * vecFirstDerivative[j+2] + 8 * vecFirstDerivative[j+1] - 8 * vecFirstDerivative[j-1] + 1 * vecFirstDerivative[j-2] ); } vecSecondDerivative.push_back( deriv ); } } void WMPickingDVR::updatePositionIndicator( osg::Vec3f position ) { osg::ref_ptr< osg::Geometry > geometry; ... ...
 ... ... @@ -133,17 +133,6 @@ private: std::pair calculateIntervalsWYSIWYP( const std::vector& vecAlphaAcc, std::vector& vecIndicesLowerBounds ); /** * Computes the first and second derivatives of a vector of values * * \param values Values for which the derivatives will be computed * \param vecFirstDerivative The first derivative of the values * \param vecSecondDerivative The second derivative of the values */ void calculateDerivativesWYSIWYP( const std::vector& values, std::vector& vecFirstDerivative, std::vector& vecSecondDerivative ); /** * Set the new position of the graphical representation * of the picked position. ... ...