00001 #include <cutting/Polyhedron_Interval.h>
00002 #include "tester.h"
00003 #include "poly_builder.h"
00004
00005
00006 class cutting_Polyhedron_Interval_test2 : public CppUnit::TestCase
00007 {
00008
00009 Point a,b,c,d;
00010 Polyhedron poly;
00011 Polyhedron::Facet_handle fh0;
00012
00013 public:
00014
00015 void setUp()
00016 {
00017 a = Point( 0,0,0 );
00018 b = Point( 100,0,0 );
00019 c = Point( 100,100,0 );
00020 d = Point( 0,100,0 );
00021
00022 add_quad( poly, a,b,c,d );
00023 fh0 = poly.facets_begin();
00024 }
00025
00026
00027 void tearDown()
00028 {
00029 poly.erase_all();
00030 }
00031
00032
00033
00034 void cut_x_low_strict()
00035 {
00036 FacetTriple ft = cutting( poly, *fh0, 0, 105,106 );
00037
00038 CPPUNIT_ASSERT( ft.low == &*fh0 );
00039 CPPUNIT_ASSERT( ft.middle == 0 );
00040 CPPUNIT_ASSERT( ft.high == 0 );
00041 }
00042
00043
00044
00045 void cut_x_low()
00046 {
00047 FacetTriple ft = cutting( poly, *fh0, 0, 100,110 );
00048
00049 CPPUNIT_ASSERT( ft.low == &*fh0 );
00050 CPPUNIT_ASSERT( ft.middle == 0 );
00051 CPPUNIT_ASSERT( ft.high == 0 );
00052 }
00053
00054
00055 void cut_x_middle()
00056 {
00057 FacetTriple ft = cutting( poly, *fh0, 0, 0,100 );
00058
00059 CPPUNIT_ASSERT( ft.low == 0 );
00060 CPPUNIT_ASSERT( ft.middle == &*fh0 );
00061 CPPUNIT_ASSERT( ft.high == 0 );
00062 }
00063
00064
00065 void cut_x_high()
00066 {
00067 FacetTriple ft = cutting( poly, *fh0, 0, -1,0 );
00068
00069 CPPUNIT_ASSERT( ft.low == 0 );
00070 CPPUNIT_ASSERT( ft.middle == 0 );
00071 CPPUNIT_ASSERT( ft.high == &*fh0 );
00072 }
00073
00074
00075
00076 CPPUNIT_TEST_SUITE( cutting_Polyhedron_Interval_test2 );
00077 CPPUNIT_TEST( cut_x_low_strict );
00078 CPPUNIT_TEST( cut_x_low );
00079 CPPUNIT_TEST( cut_x_middle );
00080 CPPUNIT_TEST( cut_x_high );
00081 CPPUNIT_TEST_SUITE_END();
00082 };
00083
00084
00085 CPPUNIT_TEST_SUITE_REGISTRATION( cutting_Polyhedron_Interval_test2 );
00086
00087