OpenWalnut
1.3.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
src
core
common
math
test
WPlane_test.h
1
//---------------------------------------------------------------------------
2
//
3
// Project: OpenWalnut ( http://www.openwalnut.org )
4
//
5
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6
// For more information see http://www.openwalnut.org/copying
7
//
8
// This file is part of OpenWalnut.
9
//
10
// OpenWalnut is free software: you can redistribute it and/or modify
11
// it under the terms of the GNU Lesser General Public License as published by
12
// the Free Software Foundation, either version 3 of the License, or
13
// (at your option) any later version.
14
//
15
// OpenWalnut is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
// GNU Lesser General Public License for more details.
19
//
20
// You should have received a copy of the GNU Lesser General Public License
21
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22
//
23
//---------------------------------------------------------------------------
24
25
#ifndef WPLANE_TEST_H
26
#define WPLANE_TEST_H
27
28
#include <set>
29
30
#include <cxxtest/TestSuite.h>
31
32
#include "../../../common/math/test/WPositionTraits.h"
33
#include "../WPlane.h"
34
35
/**
36
* Unit tests the WPlane class
37
*/
38
class
WPlaneTest
:
public
CxxTest::TestSuite
39
{
40
public
:
41
// /**
42
// * Simple sampling test
43
// */
44
// void testSamplePointsFromCenter( void )
45
// {
46
// WPlane p( WVector3d( 0, 0, 1 ), WPosition( 1.5, 1.5, 1. ) );
47
// WGridRegular3D grid( 2, 2, 2, 1., 1., 1. );
48
// boost::shared_ptr< std::set< WPosition > > expected( new std::set< WPosition > );
49
// expected->insert( WPosition( 1, 1, 1 ) );
50
// expected->insert( WPosition( 1.5, 1, 1 ) );
51
// expected->insert( WPosition( 2, 1, 1 ) );
52
// expected->insert( WPosition( 1, 1.5, 1 ) );
53
// expected->insert( WPosition( 1.5, 1.5, 1 ) );
54
// expected->insert( WPosition( 2, 1.5, 1 ) );
55
// expected->insert( WPosition( 1, 2, 1 ) );
56
// expected->insert( WPosition( 1.5, 2, 1 ) );
57
// expected->insert( WPosition( 2, 2, 1 ) );
58
// using string_utils::operator<<;
59
// TS_ASSERT_EQUALS( *expected, *p.samplePoints( grid, 0.5 ) );
60
// }
61
62
/**
63
* A predefined number of sampling points with step width from the center position.
64
*/
65
void
testFixedSampling
(
void
)
66
{
67
WPlane
p(
WVector3d
( 0, 0, 1 ),
WPosition
( 1.5, 1.5, 1. ) );
68
boost::shared_ptr< std::set< WPosition > > expected(
new
std::set< WPosition > );
69
expected->insert(
WPosition
( 1, 1, 1 ) );
70
expected->insert(
WPosition
( 1, 1.5, 1 ) );
71
expected->insert(
WPosition
( 1, 2, 1 ) );
72
expected->insert(
WPosition
( 1.5, 1, 1 ) );
73
expected->insert(
WPosition
( 2, 1, 1 ) );
74
expected->insert(
WPosition
( 1.5, 1.5, 1 ) );
75
expected->insert(
WPosition
( 2, 1.5, 1 ) );
76
expected->insert(
WPosition
( 1, 1.5, 1 ) );
77
expected->insert(
WPosition
( 1.5, 2, 1 ) );
78
expected->insert(
WPosition
( 2, 2, 1 ) );
79
TS_ASSERT_EQUALS( *expected, *p.
samplePoints
( 0.5, 2, 2 ) );
80
}
81
};
82
83
#endif // WPLANE_TEST_H
Generated by
1.8.4