OpenWalnut  1.5.0dev
Public Member Functions | Private Member Functions | Private Attributes | List of all members
WFiberClusterTest Class Reference

Unit test the WFiberCluster class. More...

#include <WFiberCluster_test.h>

+ Inheritance diagram for WFiberClusterTest:
+ Collaboration diagram for WFiberClusterTest:

Public Member Functions

void testMerge (void)
 When merging two clusters the indices are merged and the second cluster becomes empty. More...
 
void testCenterLine (void)
 Generates a dataset for some unit tests. More...
 
void testUnifyDirectionOnTwoNearlyParallelFibers (void)
 If there are two fibers which are nearly parallel changing ones direction will have huge effect. More...
 
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). More...
 
void testUnifyDirectionOnTwoCSTShapedFibers (void)
 Check determination of the direction of a pair of fibers which are in the following shape. More...
 
void testUnifyDirectionOnTwoCircularShapedFibersInSameCircle (void)
 Check determination of the direction of a pair of fibers which are in the following shape. More...
 
void testUnifyDirectionOnTwoCircularShapedFibersInDifferentCircle (void)
 Check determination of the direction of a pair of fibers which are in the following shape. More...
 
void testUnifyDirectionOnTwoInverseCSTShapedFibers (void)
 Check determination of the direction of a pair of fibers which are in the following shape. More...
 

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. More...
 
void setUp (void)
 Generates a dataset for some unit tests. More...
 
void generateFiberCluster (const std::shared_ptr< WDataSetFiberVector > ds)
 Generates out of the given dataset a WFiberCluster containing all fibers. More...
 
void tearDown (void)
 Tidyups the dataset used in some unit tests. More...
 

Private Attributes

std::shared_ptr< WFiberClusterm_cluster
 pre generated cluster for some unit tests More...
 

Detailed Description

Unit test the WFiberCluster class.

Definition at line 41 of file WFiberCluster_test.h.

Member Function Documentation

◆ assert_equals_delta()

void WFiberClusterTest::assert_equals_delta ( const WLine first,
const WLine second,
double  delta = wlimits::DBL_EPS 
) const
inlineprivate

Compares to point sequences (aka lines) with a given delta.

Parameters
firstFirst line to compare with
secondSecond line to compare with
deltaThe delta within two points are considered as equally

Definition at line 362 of file WFiberCluster_test.h.

Referenced by testCenterLine().

+ Here is the caller graph for this function:

◆ generateFiberCluster()

void WFiberClusterTest::generateFiberCluster ( const std::shared_ptr< WDataSetFiberVector ds)
inlineprivate

Generates out of the given dataset a WFiberCluster containing all fibers.

Parameters
dsThe fiber dataset

Definition at line 428 of file WFiberCluster_test.h.

References m_cluster.

Referenced by setUp().

+ Here is the caller graph for this function:

◆ setUp()

void WFiberClusterTest::setUp ( void  )
inlineprivate

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 402 of file WFiberCluster_test.h.

References generateFiberCluster(), and WMixinVector< ValueT >::push_back().

+ Here is the call graph for this function:

◆ tearDown()

void WFiberClusterTest::tearDown ( void  )
inlineprivate

Tidyups the dataset used in some unit tests.

Definition at line 444 of file WFiberCluster_test.h.

References m_cluster.

◆ testCenterLine()

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 90 of file WFiberCluster_test.h.

References assert_equals_delta(), wlimits::FLT_EPS, m_cluster, and WMixinVector< ValueT >::push_back().

+ Here is the call graph for this function:

◆ testMerge()

void WFiberClusterTest::testMerge ( void  )
inline

When merging two clusters the indices are merged and the second cluster becomes empty.

Definition at line 48 of file WFiberCluster_test.h.

References WFiberCluster::empty(), WFiberCluster::m_memberIndices, and WFiberCluster::merge().

+ Here is the call graph for this function:

◆ testUnifyDirectionOnTwoCircularShapedFibersInDifferentCircle()

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 273 of file WFiberCluster_test.h.

References m_cluster, and WMixinVector< ValueT >::push_back().

+ Here is the call graph for this function:

◆ testUnifyDirectionOnTwoCircularShapedFibersInSameCircle()

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 220 of file WFiberCluster_test.h.

References m_cluster, and WMixinVector< ValueT >::push_back().

+ Here is the call graph for this function:

◆ testUnifyDirectionOnTwoConsecutiveFibers()

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 125 of file WFiberCluster_test.h.

References m_cluster, and WMixinVector< ValueT >::push_back().

+ Here is the call graph for this function:

◆ testUnifyDirectionOnTwoCSTShapedFibers()

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 174 of file WFiberCluster_test.h.

References m_cluster, and WMixinVector< ValueT >::push_back().

+ Here is the call graph for this function:

◆ testUnifyDirectionOnTwoInverseCSTShapedFibers()

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 326 of file WFiberCluster_test.h.

References m_cluster, and WMixinVector< ValueT >::push_back().

+ Here is the call graph for this function:

◆ testUnifyDirectionOnTwoNearlyParallelFibers()

void WFiberClusterTest::testUnifyDirectionOnTwoNearlyParallelFibers ( void  )
inline

If there are two fibers which are nearly parallel changing ones direction will have huge effect.

Definition at line 107 of file WFiberCluster_test.h.

References m_cluster.

Member Data Documentation

◆ m_cluster

std::shared_ptr< WFiberCluster > WFiberClusterTest::m_cluster
private

The documentation for this class was generated from the following file: