Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
96e2dfdf
Commit
96e2dfdf
authored
May 03, 2011
by
Sebastian Eichelbaum
Browse files
[CHANGE] - removed WMatrixFixed::norm. Replaced by length as non-friend-non-member function
parent
0909ea9f
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
110 additions
and
117 deletions
+110
-117
src/common/math/WGeometryFunctions.cpp
src/common/math/WGeometryFunctions.cpp
+2
-2
src/common/math/WLine.cpp
src/common/math/WLine.cpp
+11
-11
src/common/math/WMath.cpp
src/common/math/WMath.cpp
+1
-1
src/common/math/WPlane.h
src/common/math/WPlane.h
+1
-1
src/common/math/linearAlgebra/WMatrixFixed.h
src/common/math/linearAlgebra/WMatrixFixed.h
+1
-8
src/common/math/test/WLine_test.h
src/common/math/test/WLine_test.h
+2
-2
src/common/math/test/WSymmetricSphericalHarmonic_test.h
src/common/math/test/WSymmetricSphericalHarmonic_test.h
+8
-8
src/common/math/test/WTensorFunctions_test.h
src/common/math/test/WTensorFunctions_test.h
+39
-39
src/dataHandler/WDataSetTimeSeries.h
src/dataHandler/WDataSetTimeSeries.h
+1
-1
src/dataHandler/WGridTransformOrtho.cpp
src/dataHandler/WGridTransformOrtho.cpp
+1
-1
src/dataHandler/WThreadedTrackingFunction.cpp
src/dataHandler/WThreadedTrackingFunction.cpp
+4
-4
src/dataHandler/datastructures/WFiberCluster.cpp
src/dataHandler/datastructures/WFiberCluster.cpp
+2
-2
src/dataHandler/test/WGridRegular3D_test.h
src/dataHandler/test/WGridRegular3D_test.h
+3
-3
src/dataHandler/test/WGridTransformOrtho_test.h
src/dataHandler/test/WGridTransformOrtho_test.h
+6
-6
src/dataHandler/test/WThreadedTrackingFunction_test.h
src/dataHandler/test/WThreadedTrackingFunction_test.h
+1
-1
src/graphicsEngine/test/WTriangleMesh_test.h
src/graphicsEngine/test/WTriangleMesh_test.h
+4
-4
src/modules/bermanTracking/WMBermanTracking.cpp
src/modules/bermanTracking/WMBermanTracking.cpp
+2
-2
src/modules/calculateTensors/WMCalculateTensors.cpp
src/modules/calculateTensors/WMCalculateTensors.cpp
+6
-6
src/modules/coordinateSystem/WTalairachConverter.cpp
src/modules/coordinateSystem/WTalairachConverter.cpp
+14
-14
src/modules/deterministicFTMori/WMDeterministicFTMori.cpp
src/modules/deterministicFTMori/WMDeterministicFTMori.cpp
+1
-1
No files found.
src/common/math/WGeometryFunctions.cpp
View file @
96e2dfdf
...
...
@@ -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
->
normalize
d
();
*
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
.
normalize
d
();
v
=
normalize
(
v
);
vertices
->
push_back
(
v
);
edgeVertices
[
e
]
=
vertices
->
size
()
-
1
;
}
...
...
src/common/math/WLine.cpp
View file @
96e2dfdf
...
...
@@ -63,13 +63,13 @@ void WLine::reverseOrder()
double
pathLength
(
const
WLine
&
line
)
{
double
len
gth
=
0
;
double
len
=
0
;
// incase of size() <= 1 the for loop will not run!
for
(
size_t
i
=
1
;
i
<
line
.
size
();
++
i
)
{
len
gth
+=
(
line
[
i
-
1
]
-
line
[
i
]
).
norm
(
);
len
+=
length
(
line
[
i
-
1
]
-
line
[
i
]
);
}
return
len
gth
;
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
;
}
...
...
src/common/math/WMath.cpp
View file @
96e2dfdf
...
...
@@ -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
...
...
src/common/math/WPlane.h
View file @
96e2dfdf
...
...
@@ -135,7 +135,7 @@ public:
*/
void
setNormal
(
const
WVector3d_2
&
normal
)
{
m_normal
=
normal
.
normal
ized
(
);
m_normal
=
normal
ize
(
normal
);
WVector3d_2
gen
(
1
,
0
,
0
);
if
(
cross
(
normal
,
gen
)
==
WVector3d_2
(
0
,
0
,
0
)
)
{
...
...
src/common/math/linearAlgebra/WMatrixFixed.h
View file @
96e2dfdf
...
...
@@ -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:
...
...
src/common/math/test/WLine_test.h
View file @
96e2dfdf
...
...
@@ -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
)
);
}
...
...
src/common/math/test/WSymmetricSphericalHarmonic_test.h
View file @
96e2dfdf
...
...
@@ -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
...
...
src/common/math/test/WTensorFunctions_test.h
View file @
96e2dfdf
...
...
@@ -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
)
{
...
...
src/dataHandler/WDataSetTimeSeries.h
View file @
96e2dfdf
...
...
@@ -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
()
)
{
...
...
src/dataHandler/WGridTransformOrtho.cpp
View file @
96e2dfdf
...
...
@@ -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
];
...
...
src/dataHandler/WThreadedTrackingFunction.cpp
View file @
96e2dfdf
...
...
@@ -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
;
}
...
...
src/dataHandler/datastructures/WFiberCluster.cpp
View file @
96e2dfdf
...
...
@@ -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
++
;
...
...
src/dataHandler/test/WGridRegular3D_test.h
View file @
96e2dfdf
...
...
@@ -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
);
}
/**
...
...
src/dataHandler/test/WGridTransformOrtho_test.h
View file @
96e2dfdf
...
...
@@ -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
);
}
}
};
...
...
src/dataHandler/test/WThreadedTrackingFunction_test.h
View file @
96e2dfdf
...
...
@@ -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
);
}
}
...
...
src/graphicsEngine/test/WTriangleMesh_test.h
View file @
96e2dfdf
...
...
@@ -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 );
...
...
src/modules/bermanTracking/WMBermanTracking.cpp
View file @
96e2dfdf
...
...
@@ -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
,
""
);
...
...
src/modules/calculateTensors/WMCalculateTensors.cpp
View file @
96e2dfdf
...
...
@@ -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
);
...
...
src/modules/coordinateSystem/WTalairachConverter.cpp
View file @
96e2dfdf
...
...
@@ -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(
);