OpenWalnut
1.4.0
|
Unit test the WFiberCluster class. More...
#include <WFiberCluster_test.h>
Public Member Functions | |
void | testMerge (void) |
When merging two clusters the indices are merged and the second cluster becomes empty. | |
void | testCenterLine (void) |
Generates a dataset for some unit tests. | |
void | testUnifyDirectionOnTwoNearlyParallelFibers (void) |
If there are two fibers which are nearly parallel changing ones direction will have huge effect. | |
void | testUnifyDirectionOnTwoConsecutiveFibers (void) |
Check determination of the direction of a pair of fibers which are in the following shape (all points having the same Y and Z coordinate). | |
void | testUnifyDirectionOnTwoCSTShapedFibers (void) |
Check determination of the direction of a pair of fibers which are in the following shape. | |
void | testUnifyDirectionOnTwoCircularShapedFibersInSameCircle (void) |
Check determination of the direction of a pair of fibers which are in the following shape. | |
void | testUnifyDirectionOnTwoCircularShapedFibersInDifferentCircle (void) |
Check determination of the direction of a pair of fibers which are in the following shape. | |
void | testUnifyDirectionOnTwoInverseCSTShapedFibers (void) |
Check determination of the direction of a pair of fibers which are in the following shape. | |
Private Member Functions | |
void | assert_equals_delta (const WLine &first, const WLine &second, double delta=wlimits::DBL_EPS) const |
Compares to point sequences (aka lines) with a given delta. | |
void | setUp (void) |
Generates a dataset for some unit tests. | |
void | generateFiberCluster (const boost::shared_ptr< WDataSetFiberVector > ds) |
Generates out of the given dataset a WFiberCluster containing all fibers. | |
void | tearDown (void) |
Tidyups the dataset used in some unit tests. | |
Private Attributes | |
boost::shared_ptr< WFiberCluster > | m_cluster |
pre generated cluster for some unit tests |
Unit test the WFiberCluster class.
Definition at line 40 of file WFiberCluster_test.h.
void WFiberClusterTest::assert_equals_delta | ( | const WLine & | first, |
const WLine & | second, | ||
double | delta = wlimits::DBL_EPS |
||
) | const [inline, private] |
Compares to point sequences (aka lines) with a given delta.
first | First line to compare with |
second | Second line to compare with |
delta | The delta within two points are considered as equally |
Definition at line 361 of file WFiberCluster_test.h.
Referenced by testCenterLine().
void WFiberClusterTest::generateFiberCluster | ( | const boost::shared_ptr< WDataSetFiberVector > | ds | ) | [inline, private] |
Generates out of the given dataset a WFiberCluster containing all fibers.
ds | The fiber dataset |
Definition at line 427 of file WFiberCluster_test.h.
References m_cluster.
Referenced by setUp().
void WFiberClusterTest::setUp | ( | void | ) | [inline, private] |
Generates a dataset for some unit tests.
Fiber B has 3 points: [0;2],[2;2],[4;2] Fiber A has 7 points: [0;0],[1;1],[2;1],[3;1],[4;1],[5;1],[6;1] | 2 -b----------b------------b | | | | | 1 -| a-----a-----a-----a-----a-----a | / | / | / | / |/ a-----+-----+-----+-----+-----+-----+--- 0 1 2 3 4 5 6
Definition at line 401 of file WFiberCluster_test.h.
References generateFiberCluster(), and WMixinVector< ValueT >::push_back().
void WFiberClusterTest::tearDown | ( | void | ) | [inline, private] |
Tidyups the dataset used in some unit tests.
Definition at line 443 of file WFiberCluster_test.h.
References m_cluster.
void WFiberClusterTest::testCenterLine | ( | void | ) | [inline] |
Generates a dataset for some unit tests.
Fiber B had initially 3 points: [0;2],[2;2],[4;2] after resampling there are 5 points: [0;2],[1;2],[2;2],[3;2],[4;2] Fiber A had initially 7 points: [0;0],[1;1],[2;1],[3;1],[4;1],[5;1],[6;1] after resampling there are 5 points: [0;0],[1.5;1],[3;1],[4.5;1],[6;1] | 2 -B----B-----B------B-----B | | | ,.m------m---------m-------m (center line) | / | / 1 -m aA----a--A--a---A-a----Aa-----A | / | / | / | / |/ A-----+-----+-----+-----+-----+-----+--- 0 1 2 3 4 5 6
Definition at line 89 of file WFiberCluster_test.h.
References assert_equals_delta(), wlimits::FLT_EPS, m_cluster, and WMixinVector< ValueT >::push_back().
void WFiberClusterTest::testMerge | ( | void | ) | [inline] |
When merging two clusters the indices are merged and the second cluster becomes empty.
Definition at line 47 of file WFiberCluster_test.h.
References WFiberCluster::empty(), WFiberCluster::m_memberIndices, and WFiberCluster::merge().
void WFiberClusterTest::testUnifyDirectionOnTwoCircularShapedFibersInDifferentCircle | ( | void | ) | [inline] |
Check determination of the direction of a pair of fibers which are in the following shape.
,,---._ ,' \ / \ | | \ ,' \ ,' `-AS AE BS BE ,' `. / \ | | | | | | \ / `-._ _,-' `''
Definition at line 272 of file WFiberCluster_test.h.
References m_cluster, and WMixinVector< ValueT >::push_back().
void WFiberClusterTest::testUnifyDirectionOnTwoCircularShapedFibersInSameCircle | ( | void | ) | [inline] |
Check determination of the direction of a pair of fibers which are in the following shape.
_.-----AS ,' / ,-'BS | ,' | / AE | / BE | | | | | | | | | \ \ ,| | \ `. ,Y' _,' `\_ `'''''' _.' '`--------''
Definition at line 219 of file WFiberCluster_test.h.
References m_cluster, and WMixinVector< ValueT >::push_back().
void WFiberClusterTest::testUnifyDirectionOnTwoConsecutiveFibers | ( | void | ) | [inline] |
Check determination of the direction of a pair of fibers which are in the following shape (all points having the same Y and Z coordinate).
AS--------------------------->AE BS------------------------->BE
Definition at line 124 of file WFiberCluster_test.h.
References m_cluster, and WMixinVector< ValueT >::push_back().
void WFiberClusterTest::testUnifyDirectionOnTwoCSTShapedFibers | ( | void | ) | [inline] |
Check determination of the direction of a pair of fibers which are in the following shape.
AS. _BS `. ,-' `. / \ / \ | `. .' | | | | | | | | | | | | AE BE
Definition at line 173 of file WFiberCluster_test.h.
References m_cluster, and WMixinVector< ValueT >::push_back().
void WFiberClusterTest::testUnifyDirectionOnTwoInverseCSTShapedFibers | ( | void | ) | [inline] |
Check determination of the direction of a pair of fibers which are in the following shape.
,,-'-AE BS''`-._ ,' `. / \ / `. / `. / | | | | | | | | | | | | | AS BE
Definition at line 325 of file WFiberCluster_test.h.
References m_cluster, and WMixinVector< ValueT >::push_back().
void WFiberClusterTest::testUnifyDirectionOnTwoNearlyParallelFibers | ( | void | ) | [inline] |
If there are two fibers which are nearly parallel changing ones direction will have huge effect.
Definition at line 106 of file WFiberCluster_test.h.
References m_cluster.
boost::shared_ptr< WFiberCluster > WFiberClusterTest::m_cluster [private] |
pre generated cluster for some unit tests
Definition at line 448 of file WFiberCluster_test.h.
Referenced by generateFiberCluster(), tearDown(), testCenterLine(), testUnifyDirectionOnTwoCircularShapedFibersInDifferentCircle(), testUnifyDirectionOnTwoCircularShapedFibersInSameCircle(), testUnifyDirectionOnTwoConsecutiveFibers(), testUnifyDirectionOnTwoCSTShapedFibers(), testUnifyDirectionOnTwoInverseCSTShapedFibers(), and testUnifyDirectionOnTwoNearlyParallelFibers().