Commit 96e2dfdf authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - removed WMatrixFixed::norm. Replaced by length as non-friend-non-member function

parent 0909ea9f
......@@ -66,7 +66,7 @@ void tesselateIcosahedron( std::vector< WVector3d_2 >* vertices, std::vector< un
for( std::vector< WVector3d_2 >::iterator it = vertices->begin(); it != vertices->end(); ++it )
{
*it = it->normalized();
*it = normalize( *it );
}
// add triangle indices
......@@ -114,7 +114,7 @@ void tesselateIcosahedron( std::vector< WVector3d_2 >* vertices, std::vector< un
WVector3d_2 v0 = vertices->at( e.first );
WVector3d_2 v1 = vertices->at( e.second );
WVector3d_2 v = v0 + v1;
v = v.normalized();
v = normalize( v );
vertices->push_back( v );
edgeVertices[ e ] = vertices->size() - 1;
}
......
......@@ -63,13 +63,13 @@ void WLine::reverseOrder()
double pathLength( const WLine& line )
{
double length = 0;
double len = 0;
// incase of size() <= 1 the for loop will not run!
for( size_t i = 1; i < line.size(); ++i )
{
length += ( line[i - 1] - line[i] ).norm();
len += length( line[i - 1] - line[i] );
}
return length;
return len;
}
void WLine::resampleByNumberOfPoints( size_t numPoints )
......@@ -85,14 +85,14 @@ void WLine::resampleByNumberOfPoints( size_t numPoints )
newLine.push_back( front() );
for( size_t i = 0; i < ( size() - 1 ); ++i )
{
remainingLength += ( at( i ) - at( i + 1 ) ).norm();
remainingLength += length( at( i ) - at( i + 1 ) );
while( ( remainingLength > newSegmentLength ) || std::abs( remainingLength - newSegmentLength ) < delta )
{
remainingLength -= newSegmentLength;
// TODO(math): fix numerical issuses: newSegmentLength may be wrong => great offset by many intraSegment sample points
// remainingLength may be wrong => ...
// Take a look at the unit test testNumericalStabilityOfResampling
WPosition_2 newPoint = at( i + 1 ) + remainingLength * ( at( i ) - at( i + 1 ) ).normalized();
WPosition_2 newPoint = at( i + 1 ) + remainingLength * normalize( at( i ) - at( i + 1 ) );
newLine.push_back( newPoint );
// std::cout << "line size so far" << newLine.size() << " lenght so far: " << newLine.pathLength() << std::endl;
// std::cout << numPoints - newLine.size() << std::endl;
......@@ -132,7 +132,7 @@ void WLine::removeAdjacentDuplicates()
newLine.push_back( front() );
for( const_iterator cit = begin()++; cit != end(); ++cit )
{
if( ( *cit - newLine.back() ).norm() > wlimits::DBL_EPS )
if( length( *cit - newLine.back() ) > wlimits::DBL_EPS )
{
newLine.push_back( *cit );
}
......@@ -153,14 +153,14 @@ void WLine::resampleBySegmentLength( double newSegmentLength )
newLine.push_back( front() );
for( size_t i = 1; i < size(); )
{
if( ( newLine.back() - ( *this )[i] ).norm() > newSegmentLength )
if( length( newLine.back() - ( *this )[i] ) > newSegmentLength )
{
const WVector3d_2& pred = ( *this )[i - 1];
if( pred == newLine.back() )
{
// Then there is no triangle and the old Segment Length is bigger as the new segment
// length
newLine.push_back( newLine.back() + ( ( *this )[i] - pred ).normalized() * newSegmentLength );
newLine.push_back( newLine.back() + normalize( ( *this )[i] - pred ) * newSegmentLength );
continue;
}
else // this is the general case, and the point we search is inbetween the pred and the current position
......@@ -199,9 +199,9 @@ void WLine::resampleBySegmentLength( double newSegmentLength )
}
++i;
}
if( ( newLine.back() - ( *this )[size() - 1] ).norm() > newSegmentLength / 2.0 )
if( length( newLine.back() - ( *this )[size() - 1] ) > newSegmentLength / 2.0 )
{
WVector3d_2 direction = ( ( *this )[size() - 1] - newLine.back() ).normalized();
WVector3d_2 direction = normalize( ( *this )[size() - 1] - newLine.back() );
newLine.push_back( newLine.back() + direction * newSegmentLength );
}
this->WMixinVector< WPosition_2 >::operator=( newLine );
......@@ -239,7 +239,7 @@ double maxSegmentLength( const WLine& line )
}
for( size_t i = 0; i < line.size() - 1; ++i )
{
result = std::max( result, ( line[i] - line[i+1] ).norm() );
result = std::max( result, length( line[i] - line[i+1] ) );
}
return result;
}
......
......@@ -51,7 +51,7 @@ bool intersectPlaneSegment( const WPlane& p,
const WPosition_2& p2,
boost::shared_ptr< WPosition_2 > pointOfIntersection )
{
const WVector3d_2& normal = p.getNormal().normalized();
const WVector3d_2& normal = normalize( p.getNormal() );
double const d = dot( normal, p.getPosition() );
WAssert( pointOfIntersection.get(), "Place to store a point of intersection is not ready!" );
*pointOfIntersection = p.getPosition(); // otherwise it would be undefined
......
......@@ -135,7 +135,7 @@ public:
*/
void setNormal( const WVector3d_2& normal )
{
m_normal = normal.normalized();
m_normal = normalize( normal );
WVector3d_2 gen( 1, 0, 0 );
if( cross( normal, gen ) == WVector3d_2( 0, 0, 0 ) )
{
......
......@@ -996,14 +996,7 @@ public:
double normalize() // 28 files use this
{
}
MatrixType normalized() const // 19 files use this
{
}
ValueType norm() const // 32 files use this
{
return 0.0;
}
private:
......
......@@ -168,8 +168,8 @@ public:
line.push_back( WPosition_2( 1, 2, 3 ) );
line.push_back( WPosition_2( 4, 5, 6 ) );
line.push_back( WPosition_2( 7, 8, 9 ) );
double expected = ( WPosition_2( 1, 2, 3 ) - WPosition_2( 4, 5, 6 ) ).norm() +
( WPosition_2( 4, 5, 6 ) - WPosition_2( 7, 8, 9 ) ).norm();
double expected = length( WPosition_2( 1, 2, 3 ) - WPosition_2( 4, 5, 6 ) ) +
length( WPosition_2( 4, 5, 6 ) - WPosition_2( 7, 8, 9 ) );
TS_ASSERT_EQUALS( expected, pathLength( line ) );
}
......
......@@ -117,14 +117,14 @@ public:
WSymmetricSphericalHarmonic i( w );
std::vector< WUnitSphereCoordinates > orientations;
orientations.push_back( WUnitSphereCoordinates( WVector3d_2( 1.0, 0.0, 0.0 ).normalized() ) );
orientations.push_back( WUnitSphereCoordinates( WVector3d_2( 0.6, -0.1, 0.2 ).normalized() ) );
orientations.push_back( WUnitSphereCoordinates( WVector3d_2( 1.0, 1.0, 1.0 ).normalized() ) );
orientations.push_back( WUnitSphereCoordinates( WVector3d_2( -0.1, -0.3, 0.5 ).normalized() ) );
orientations.push_back( WUnitSphereCoordinates( WVector3d_2( 0.56347, 0.374, 0.676676 ).normalized() ) );
orientations.push_back( WUnitSphereCoordinates( WVector3d_2( 0.56347, 0.374, -0.676676 ).normalized() ) );
orientations.push_back( WUnitSphereCoordinates( WVector3d_2( 0.0, 0.0, -4.0 ).normalized() ) );
orientations.push_back( WUnitSphereCoordinates( WVector3d_2( 0.0, 4.0, 1.0 ).normalized() ) );
orientations.push_back( WUnitSphereCoordinates( normalize( WVector3d_2( 1.0, 0.0, 0.0 ) ) ) );
orientations.push_back( WUnitSphereCoordinates( normalize( WVector3d_2( 0.6, -0.1, 0.2 ) ) ) );
orientations.push_back( WUnitSphereCoordinates( normalize( WVector3d_2( 1.0, 1.0, 1.0 ) ) ) );
orientations.push_back( WUnitSphereCoordinates( normalize( WVector3d_2( -0.1, -0.3, 0.5 ) ) ) );
orientations.push_back( WUnitSphereCoordinates( normalize( WVector3d_2( 0.56347, 0.374, 0.676676 ) ) ) );
orientations.push_back( WUnitSphereCoordinates( normalize( WVector3d_2( 0.56347, 0.374, -0.676676 ) ) ) );
orientations.push_back( WUnitSphereCoordinates( normalize( WVector3d_2( 0.0, 0.0, -4.0 ) ) ) );
orientations.push_back( WUnitSphereCoordinates( normalize( WVector3d_2( 0.0, 4.0, 1.0 ) ) ) );
WMatrix_2 SHToTensor = WSymmetricSphericalHarmonic::calcSHToTensorSymMatrix( 2, orientations );
// TODO(all): remove the WValue from the following line, when WTensorSym supports WVector_2
......
......@@ -88,9 +88,9 @@ public:
TS_ASSERT_DELTA( dot( sys[0].second, sys[1].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[1].second, sys[2].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[2].second., sys[0].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( sys[0].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[1].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[2].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[0].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[1].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[2].second ), 1.0, 1e-9 );
// 1 2 -3
t( 0, 0 ) = 1.0;
......@@ -105,9 +105,9 @@ public:
TS_ASSERT_DELTA( dot( sys[0].second, sys[1].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[1].second, sys[2].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[2].second., sys[0].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( sys[0].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[1].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[2].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[0].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[1].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[2].second ), 1.0, 1e-9 );
// 1 2 2
t( 0, 0 ) = 1.0;
......@@ -122,9 +122,9 @@ public:
TS_ASSERT_DELTA( dot( sys[0].second, sys[1].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[1].second, sys[2].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[2].second., sys[0].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( sys[0].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[1].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[2].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[0].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[1].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[2].second ), 1.0, 1e-9 );
// -1 -1 -1
t( 0, 0 ) = -1.0;
......@@ -139,9 +139,9 @@ public:
TS_ASSERT_DELTA( dot( sys[0].second, sys[1].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[1].second, sys[2].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[2].second., sys[0].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( sys[0].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[1].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[2].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[0].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[1].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[2].second ), 1.0, 1e-9 );
// 1 0 1
t( 0, 0 ) = 1.0;
......@@ -156,9 +156,9 @@ public:
TS_ASSERT_DELTA( dot( sys[0].second, sys[1].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[1].second, sys[2].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[2].second., sys[0].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( sys[0].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[1].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[2].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[0].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[1].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[2].second ), 1.0, 1e-9 );
// 0 0 0
t( 0, 0 ) = 0.0;
......@@ -173,9 +173,9 @@ public:
TS_ASSERT_DELTA( dot( sys[0].second, sys[1].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[1].second, sys[2].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[2].second., sys[0].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( sys[0].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[1].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[2].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[0].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[1].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[2].second ), 1.0, 1e-9 );
// similar eigenvalues
// 2.000001 0.0 1.999998
......@@ -191,9 +191,9 @@ public:
TS_ASSERT_DELTA( dot( sys[0].second, sys[1].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[1].second, sys[2].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[2].second., sys[0].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( sys[0].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[1].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[2].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[0].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[1].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[2].second ), 1.0, 1e-9 );
// very large eigenvalues
// 3.824572321236e1000 1 2
......@@ -209,9 +209,9 @@ public:
TS_ASSERT_DELTA( dot( sys[0].second, sys[1].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[1].second, sys[2].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[2].second., sys[0].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( sys[0].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[1].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[2].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[0].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[1].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[2].second ), 1.0, 1e-9 );
// very small eigenvalues
// 3.824572321236e-1000 1 2
......@@ -227,9 +227,9 @@ public:
TS_ASSERT_DELTA( dot( sys[0].second, sys[1].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[1].second, sys[2].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[2].second., sys[0].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( sys[0].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[1].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[2].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[0].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[1].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[2].second ), 1.0, 1e-9 );
// some more sophisticated tests
// (using similarity transformations on diagonal matrices to create test cases)
......@@ -249,9 +249,9 @@ public:
TS_ASSERT_DELTA( dot( sys[0].second, sys[1].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[1].second, sys[2].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[2].second., sys[0].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( sys[0].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[1].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[2].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[0].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[1].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[2].second ), 1.0, 1e-9 );
compare_results( t, sys );
t = WTensorSym< 2, 3 >();
......@@ -272,9 +272,9 @@ public:
TS_ASSERT_DELTA( dot( sys[0].second, sys[1].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[1].second, sys[2].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[2].second., sys[0].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( sys[0].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[1].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[2].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[0].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[1].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[2].second ), 1.0, 1e-9 );
compare_results( t, sys );
t = WTensorSym< 2, 3 >();
......@@ -295,9 +295,9 @@ public:
TS_ASSERT_DELTA( dot( sys[0].second, sys[1].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[1].second, sys[2].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( dot( sys[2].second., sys[0].second ), 0.0, 1e-9 );
TS_ASSERT_DELTA( sys[0].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[1].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( sys[2].second.norm(), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[0].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[1].second ), 1.0, 1e-9 );
TS_ASSERT_DELTA( length( sys[2].second ), 1.0, 1e-9 );
compare_results( t, sys );
}
......@@ -620,9 +620,9 @@ public:
std::vector< WVector3d_2 > gradients;
gradients.push_back( WVector3d_2( 1.0, 0.0, 0.0 ) );
gradients.push_back( WVector3d_2( 0.0, 1.0, 0.0 ) );
gradients.push_back( WVector3d_2( 1.0, 1.0, 0.0 ).normalized() );
gradients.push_back( WVector3d_2( 0.3, 0.4, 0.5 ).normalized() );
gradients.push_back( WVector3d_2( -7.0, 3.0, -1.0 ).normalized() );
gradients.push_back( normalize( WVector3d_2( 1.0, 1.0, 0.0 ) ) );
gradients.push_back( normalize( WVector3d_2( 0.3, 0.4, 0.5 ) ) );
gradients.push_back( normalize( WVector3d_2( -7.0, 3.0, -1.0 ) ) );
for( int k = 0; k < 5; ++k )
{
......
......@@ -263,7 +263,7 @@ Data_T WDataSetTimeSeries::interpolate( WVector3d_2 const& pos, float time, bool
{
static const float inf = std::numeric_limits< float >::infinity();
WAssert( success, "" );
WAssert( !wlimits::isnan( pos.norm() ), "" );
WAssert( !wlimits::isnan( length( pos ) ), "" );
WAssert( !wlimits::isnan( time ), "" );
if( time < getMinTime() || time > getMaxTime() )
{
......
......@@ -52,7 +52,7 @@ WGridTransformOrtho::WGridTransformOrtho( WMatrix< double > const& mat )
m_directionY = WVector3d_2( mat( 0, 1 ), mat( 1, 1 ), mat( 2, 1 ) );
m_directionZ = WVector3d_2( mat( 0, 2 ), mat( 1, 2 ), mat( 2, 2 ) );
m_scaling = WVector3d_2( m_directionX.norm(), m_directionY.norm(), m_directionZ.norm() );
m_scaling = WVector3d_2( length( m_directionX ), length( m_directionY ), length( m_directionZ ) );
WPrecond( m_scaling[ 0 ] != 0.0 && m_scaling[ 1 ] != 0.0 && m_scaling[ 2 ] != 0.0, "" );
m_directionX /= m_scaling[ 0 ];
......
......@@ -42,7 +42,7 @@ namespace wtracking
// find matching direction
WVector3d_2 dir = dirFunc( dataset, job );
if( fabs( dir.norm() - 1.0 ) > TRACKING_EPS )
if( fabs( length( dir ) - 1.0 ) > TRACKING_EPS )
{
return false;
}
......@@ -210,7 +210,7 @@ namespace wtracking
j.second = e;
std::vector< WVector3d_2 > fiber;
if( fabs( e.norm() - 1.0 ) > TRACKING_EPS )
if( fabs( length( e ) - 1.0 ) > TRACKING_EPS )
{
if( m_fiberVisitor )
{
......@@ -228,7 +228,7 @@ namespace wtracking
// forward integration
for( std::size_t k = 0; k < m_maxPoints; ++k )
{
if( fabs( j.second.norm() - 1.0 ) > TRACKING_EPS )
if( fabs( length( j.second ) - 1.0 ) > TRACKING_EPS )
{
break;
}
......@@ -249,7 +249,7 @@ namespace wtracking
j.second = e * -1.0;
for( std::size_t k = 0; k < m_maxPoints; ++k )
{
if( fabs( j.second.norm() - 1.0 ) > TRACKING_EPS )
if( fabs( length( j.second ) - 1.0 ) > TRACKING_EPS )
{
break;
}
......
......@@ -233,7 +233,7 @@ void WFiberCluster::elongateCenterLine() const
{
if( intersectPlaneLineNearCP( p, *cit, cutPoint ) )
{
if( ( *cutPoint - p.getPosition() ).norm() < 20 )
if( length( *cutPoint - p.getPosition() ) < 20 )
{
// avg += *cutPoint;
intersectingFibers++;
......@@ -286,7 +286,7 @@ void WFiberCluster::elongateCenterLine() const
{
if( intersectPlaneLineNearCP( q, *cit, cutPoint ) )
{
if( ( *cutPoint - q.getPosition() ).norm() < 20 )
if( length( *cutPoint - q.getPosition() ) < 20 )
{
// avg += *cutPoint;
intersectingFibers++;
......
......@@ -146,9 +146,9 @@ public:
WGridTransformOrtho t( mat );
WGridRegular3D grid( 3, 3, 3, t );
TS_ASSERT_DELTA( grid.getOffsetX(), x.norm(), m_delta );
TS_ASSERT_DELTA( grid.getOffsetY(), y.norm(), m_delta );
TS_ASSERT_DELTA( grid.getOffsetZ(), z.norm(), m_delta );
TS_ASSERT_DELTA( grid.getOffsetX(), length( x ), m_delta );
TS_ASSERT_DELTA( grid.getOffsetY(), length( y ), m_delta );
TS_ASSERT_DELTA( grid.getOffsetZ(), length( z ), m_delta );
}
/**
......
......@@ -118,8 +118,8 @@ public:
TS_ASSERT_EQUALS( v.getOffsetX(), sqrt( 8.0 ) );
TS_ASSERT_EQUALS( v.getOffsetY(), sqrt( 18.0 ) );
TS_ASSERT_EQUALS( v.getOffsetZ(), 4.4 );
TS_ASSERT_DELTA( ( v.getUnitDirectionX() - WVector3d_2( 0.5 * sqrt( 2.0 ), 0.5 * sqrt( 2.0 ), 0.0 ) ).norm(), 0.0, 1e-13 );
TS_ASSERT_DELTA( ( v.getUnitDirectionY() - WVector3d_2( -0.5 * sqrt( 2.0 ), 0.5 * sqrt( 2.0 ), 0.0 ) ).norm(), 0.0, 1e-13 );
TS_ASSERT_DELTA( length( v.getUnitDirectionX() - WVector3d_2( 0.5 * sqrt( 2.0 ), 0.5 * sqrt( 2.0 ), 0.0 ) ), 0.0, 1e-13 );
TS_ASSERT_DELTA( length( v.getUnitDirectionY() - WVector3d_2( -0.5 * sqrt( 2.0 ), 0.5 * sqrt( 2.0 ), 0.0 ) ), 0.0, 1e-13 );
TS_ASSERT_EQUALS( v.getUnitDirectionZ(), WVector3d_2( 0.0, 0.0, 1.0 ) );
TS_ASSERT_EQUALS( v.getDirectionX(), WVector3d_2( 2.0, 2.0, 0.0 ) );
TS_ASSERT_EQUALS( v.getDirectionY(), WVector3d_2( -3.0, 3.0, 0.0 ) );
......@@ -266,10 +266,10 @@ public:
WGridTransformOrtho t( mat );
TS_ASSERT_DELTA( ( WVector3d_2( 1.0, 1.0, 1.0 ) // NOLINT
- t.positionToGridSpace( WVector3d_2( 0.0, 7.0, 4.9 ) ) ).norm(), 0.0, 1e-13 );
TS_ASSERT_DELTA( ( WVector3d_2( 1.0, 1.0, 1.0 ) // NOLINT
- t.directionToGridSpace( WVector3d_2( -1.0, 5.0, 4.4 ) ) ).norm(), 0.0, 1e-13 );
TS_ASSERT_DELTA( length( WVector3d_2( 1.0, 1.0, 1.0 ) // NOLINT
- t.positionToGridSpace( WVector3d_2( 0.0, 7.0, 4.9 ) ) ), 0.0, 1e-13 );
TS_ASSERT_DELTA( length( WVector3d_2( 1.0, 1.0, 1.0 ) // NOLINT
- t.directionToGridSpace( WVector3d_2( -1.0, 5.0, 4.4 ) ) ), 0.0, 1e-13 );
}
}
};
......
......@@ -183,7 +183,7 @@ public:
TS_ASSERT( !wtracking::WTrackingUtility::onBoundary( g, j.first ) );
TS_ASSERT( g->encloses( j.first ) );
v += x * 0.8;
TS_ASSERT_DELTA( ( j.first - v ).norm(), 0.0, 2.0 * TRACKING_EPS );
TS_ASSERT_DELTA( length( j.first - v ), 0.0, 2.0 * TRACKING_EPS );
}
}
......
......@@ -206,13 +206,13 @@ public:
//
// double delta = 1e-7;
// WVector3d_2 expectedNormal( -0.40824829, 0.816496581, -0.40824829 );
// TS_ASSERT_DELTA( expectedNormal.norm(), 1, delta ); // check ouu expectance :-)
// TS_ASSERT_DELTA( length( expectedNormal ), 1, delta ); // check ouu expectance :-)
//
// TS_ASSERT_DELTA( mesh.m_triNormals[0].norm(), 1, delta );
// TS_ASSERT_DELTA( length( mesh.m_triNormals[0] ), 1, delta );
// TS_ASSERT_DELTA( mesh.m_triNormals[0][0], expectedNormal[0], delta );
// TS_ASSERT_DELTA( mesh.m_triNormals[0][1], expectedNormal[1], delta );
// TS_ASSERT_DELTA( mesh.m_triNormals[0][2], expectedNormal[2], delta );
// TS_ASSERT_DELTA( mesh.m_triNormals[1].norm(), 1, delta );
// TS_ASSERT_DELTA( length( mesh.m_triNormals[1] ), 1, delta );
// };
//
// /**
......@@ -261,7 +261,7 @@ public:
// // check this triangle stuff too. We need the tri normals for the vert normals
// TS_ASSERT_EQUALS( mesh.m_computedTriNormals, true );
// TS_ASSERT_EQUALS( mesh.m_triNormals.size(), 2 );
// TS_ASSERT_DELTA( mesh.m_triNormals[0].norm(), 1, delta );
// TS_ASSERT_DELTA( length( mesh.m_triNormals[0] ), 1, delta );
// TS_ASSERT_DELTA( mesh.m_triNormals[0][0], expectedNormal0[0], delta );
// TS_ASSERT_DELTA( mesh.m_triNormals[0][1], expectedNormal0[1], delta );
// TS_ASSERT_DELTA( mesh.m_triNormals[0][2], expectedNormal0[2], delta );
......
......@@ -210,7 +210,7 @@ void WMBermanTracking::moduleMain()
std::vector< WUnitSphereCoordinates > c;
for( std::size_t i = 0; i < m_dataSetResidual->getOrientations().size(); ++i )
{
if( m_dataSetResidual->getOrientations().at( i ).norm() != 0.0 )
if( length( m_dataSetResidual->getOrientations().at( i ) ) != 0.0 )
{
c.push_back( WUnitSphereCoordinates( m_dataSetResidual->getOrientations().at( i ) ) );
}
......@@ -514,7 +514,7 @@ WVector3d_2 WMBermanTracking::getBestDirectionFromSH( WSymmetricSphericalHarmoni
{
r = WVector3d_2( 0.0, 0.0, 0.0 );
}
else if( j.second.norm() == 0.0 )
else if( length( j.second ) == 0.0 )
{
int i = static_cast< int >( static_cast< double >( ( *m_random )() ) / ( 1.0 + static_cast< double >( 0u - 1u ) ) * ( 2.0 * k ) );
WAssert( i >= 0 && i <= 2 * k, "" );
......
......@@ -98,12 +98,12 @@ void WMCalculateTensors::moduleMain()
// calc sh->tensor conversion matrix
std::vector< WUnitSphereCoordinates > orientations;
orientations.push_back( WUnitSphereCoordinates( WVector3d_2( 1.0, 0.0, 0.0 ).normalized() ) );
orientations.push_back( WUnitSphereCoordinates( WVector3d_2( 0.6, -0.1, 0.2 ).normalized() ) );
orientations.push_back( WUnitSphereCoordinates( WVector3d_2( 1.0, 1.0, 1.0 ).normalized() ) );
orientations.push_back( WUnitSphereCoordinates( WVector3d_2( -0.1, -0.3, 0.5 ).normalized() ) );
orientations.push_back( WUnitSphereCoordinates( WVector3d_2( -0.56347, 0.374, -0.676676 ).normalized() ) );
orientations.push_back( WUnitSphereCoordinates( WVector3d_2( 0.0, 4.0, 1.0 ).normalized() ) );
orientations.push_back( WUnitSphereCoordinates( normalize( WVector3d_2( 1.0, 0.0, 0.0 ) ) ) );
orientations.push_back( WUnitSphereCoordinates( normalize( WVector3d_2( 0.6, -0.1, 0.2 ) ) ) );
orientations.push_back( WUnitSphereCoordinates( normalize( WVector3d_2( 1.0, 1.0, 1.0 ) ) ) );
orientations.push_back( WUnitSphereCoordinates( normalize( WVector3d_2( -0.1, -0.3, 0.5 ) ) ) );
orientations.push_back( WUnitSphereCoordinates( normalize( WVector3d_2( -0.56347, 0.374, -0.676676 ) ) ) );
orientations.push_back( WUnitSphereCoordinates( normalize( WVector3d_2( 0.0, 4.0, 1.0 ) ) ) );
m_SHToTensorMat = WSymmetricSphericalHarmonic::calcSHToTensorSymMatrix( 2, orientations );
......
......@@ -81,13 +81,13 @@ WVector3d_2 WTalairachConverter::ACPC2Talairach( const WVector3d_2 point )
double y = point[1];
double z = point[2];
// double X1 = ( m_pp - m_pc ).norm();
// double X2 = ( m_ac - m_pc ).norm();
// double X3 = ( m_ap - m_ac ).norm();
// double Y1 = ( m_ac - m_rp ).norm();
// double Y2 = ( m_lp - m_ac ).norm();
// double Z1 = ( m_ac - m_ip ).norm();
// double Z2 = ( m_sp - m_ac ).norm();
// double X1 = length( m_pp - m_pc );
// double X2 = length( m_ac - m_pc );
// double X3 = length( m_ap - m_ac );
// double Y1 = length( m_ac - m_rp );
// double Y2 = length( m_lp - m_ac );
// double Z1 = length( m_ac - m_ip );
// double Z2 = length( m_sp - m_ac );
double X1 = fabs( m_pp[0] - m_pc[0] );
double X2 = fabs( m_ac[0] - m_pc[0] );
......@@ -150,13 +150,13 @@ WVector3d_2 WTalairachConverter::Talairach2ACPC( const WVector3d_2 point )
double yt = point[1];
double zt = point[2];
// double X1 = ( m_pp - m_pc ).norm();
// double X2 = ( m_ac - m_pc ).norm();
// double X3 = ( m_ap - m_ac ).norm();
// double Y1 = ( m_ac - m_rp ).norm();