1 /**
2  *   SFCGAL
3  *
4  *   Copyright (C) 2012-2013 Oslandia <infos@oslandia.com>
5  *   Copyright (C) 2012-2013 IGN (http://www.ign.fr)
6  *
7  *   This library is free software; you can redistribute it and/or
8  *   modify it under the terms of the GNU Library General Public
9  *   License as published by the Free Software Foundation; either
10  *   version 2 of the License, or (at your option) any later version.
11  *
12  *   This library is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  *   Library General Public License for more details.
16 
17  *   You should have received a copy of the GNU Library General Public
18  *   License along with this library; if not, see <http://www.gnu.org/licenses/>.
19  */
20 #include <boost/test/unit_test.hpp>
21 
22 #include <CGAL/Cartesian.h>
23 #include <CGAL/Point_2.h>
24 #include <CGAL/Point_3.h>
25 #include <CGAL/Plane_3.h>
26 
27 #include <cmath>
28 
29 typedef CGAL::Cartesian< double > Kernel ;
30 typedef Kernel::Vector_2          Vector_2 ;
31 typedef Kernel::Vector_3          Vector_3 ;
32 typedef Kernel::Point_2           Point_2 ;
33 typedef Kernel::Point_3           Point_3 ;
34 typedef CGAL::Plane_3< Kernel >   Plane_3 ;
35 
36 // always after CGAL
37 using namespace boost::unit_test ;
38 
39 BOOST_AUTO_TEST_SUITE( CGAL_Plane3Test )
40 
BOOST_AUTO_TEST_CASE(testTo2D_UnitNormalForPlane)41 BOOST_AUTO_TEST_CASE( testTo2D_UnitNormalForPlane )
42 {
43     Plane_3 plane( 1.0,0.0,0.0,0.0 );
44     BOOST_CHECK_EQUAL( plane.to_2d( Point_3( 1.0,0.0,0.0 ) ), Point_2( 0.0,0.0 ) );
45     BOOST_CHECK_EQUAL( plane.to_2d( Point_3( 1.0,0.0,1.0 ) ), Point_2( 0.0,1.0 ) );
46     BOOST_CHECK_EQUAL( plane.to_2d( Point_3( 1.0,1.0,1.0 ) ), Point_2( 1.0,1.0 ) );
47     BOOST_CHECK_EQUAL( plane.to_2d( Point_3( 1.0,1.0,0.0 ) ), Point_2( 1.0,0.0 ) );
48 }
49 
50 
51 BOOST_AUTO_TEST_SUITE_END()
52 
53