Skip to content
Snippets Groups Projects
Commit 9b8832ff authored by Oliver Sander's avatar Oliver Sander Committed by sander@FU-BERLIN.DE
Browse files

merge 2d and 3d tests into a single method. All differences are now handled by ValueFactory

[[Imported from SVN: r7308]]
parent 9682cc48
No related branches found
No related tags found
No related merge requests found
...@@ -296,45 +296,26 @@ void testDerivativesOfSquaredDistance(const TargetSpace& a, const TargetSpace& b ...@@ -296,45 +296,26 @@ void testDerivativesOfSquaredDistance(const TargetSpace& a, const TargetSpace& b
} }
void testUnitVector2d()
template <int N>
void testUnitVector()
{ {
std::vector<UnitVector<2> > testPoints; std::vector<UnitVector<N> > testPoints;
ValueFactory<UnitVector<2> >::get(testPoints); ValueFactory<UnitVector<N> >::get(testPoints);
int nTestPoints = testPoints.size(); int nTestPoints = testPoints.size();
// Set up elements of S^1 // Set up elements of S^{N-1}
for (int i=0; i<nTestPoints; i++) { for (int i=0; i<nTestPoints; i++) {
testOrthonormalFrame<UnitVector<2>, 2>(testPoints[i]); testOrthonormalFrame<UnitVector<N>, N>(testPoints[i]);
for (int j=0; j<nTestPoints; j++) { for (int j=0; j<nTestPoints; j++) {
if (UnitVector<2>::distance(testPoints[i],testPoints[j]) > M_PI*0.98) if (UnitVector<N>::distance(testPoints[i],testPoints[j]) > M_PI*0.98)
continue; continue;
testDerivativesOfSquaredDistance<UnitVector<2>, 2>(testPoints[i], testPoints[j]); testDerivativesOfSquaredDistance<UnitVector<N>, N>(testPoints[i], testPoints[j]);
}
}
}
void testUnitVector3d()
{
std::vector<UnitVector<3> > testPoints;
ValueFactory<UnitVector<3> >::get(testPoints);
int nTestPoints = testPoints.size();
// Set up elements of S^2
for (int i=0; i<nTestPoints; i++) {
testOrthonormalFrame<UnitVector<3>, 3>(testPoints[i]);
for (int j=0; j<nTestPoints; j++) {
testDerivativesOfSquaredDistance<UnitVector<3>, 3>(testPoints[i], testPoints[j]);
} }
...@@ -342,6 +323,7 @@ void testUnitVector3d() ...@@ -342,6 +323,7 @@ void testUnitVector3d()
} }
void testRotation3d() void testRotation3d()
{ {
int nTestPoints = 10; int nTestPoints = 10;
...@@ -373,8 +355,8 @@ void testRotation3d() ...@@ -373,8 +355,8 @@ void testRotation3d()
int main() try int main() try
{ {
testUnitVector2d(); testUnitVector<2>();
testUnitVector3d(); testUnitVector<3>();
testRotation3d(); testRotation3d();
} catch (Exception e) { } catch (Exception e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment