@ -29,25 +29,25 @@ namespace Magnum { namespace Math { namespace Geometry { namespace Test {
typedef Magnum : : Math : : Vector3 < float > Vector3 ;
typedef Magnum : : Math : : Vector3 < float > Vector3 ;
void IntersectionTest : : planeLine ( ) {
void IntersectionTest : : planeLine ( ) {
Vector3 planePosition ;
Vector3 planePosition ( - 1.0f , 1.0f , 0.5f ) ;
Vector3 planeNormal ( 0.0f , 0.0f , 1.0f ) ;
Vector3 planeNormal ( 0.0f , 0.0f , 1.0f ) ;
/* Inside line segment */
/* Inside line segment */
QCOMPARE ( ( Intersection : : planeLine ( planePosition , planeNormal ,
QCOMPARE ( ( Intersection : : planeLine ( planePosition , planeNormal ,
Vector3 ( 0 , 0 , - 1 ) , Vector3 ( 0 , 0 , 1 ) ) ) , 0.5f ) ;
Vector3 ( 0.0f , 0.0f , - 1.0f ) , Vector3 ( 0.0f , 0.0f , 1.0f ) ) ) , 0.7 5f ) ;
/* Outside line segment */
/* Outside line segment */
QCOMPARE ( ( Intersection : : planeLine ( planePosition , planeNormal ,
QCOMPARE ( ( Intersection : : planeLine ( planePosition , planeNormal ,
Vector3 ( 0 , 0 , 1 ) , Vector3 ( 0 , 0 , 2 ) ) ) , - 1. 0f) ;
Vector3 ( 0.0f , 0.0f , 1.0f ) , Vector3 ( 0.0f , 0.0f , 2.0f ) ) ) , - 0.5 f ) ;
/* Line lies on the plane */
/* Line lies on the plane */
float nan = Intersection : : planeLine ( planePosition , planeNormal ,
float nan = Intersection : : planeLine ( planePosition , planeNormal ,
Vector3 ( 1 , 0 , 0 ) , Vector3 ( 0 , 1 , 0 ) ) ;
Vector3 ( 1.0f , 0.5f , 0.5f ) , Vector3 ( 0.0f , 1.0f , 0.5f ) ) ;
QVERIFY ( nan ! = nan ) ;
QVERIFY ( nan ! = nan ) ;
/* Line is parallell to the plane */
/* Line is parallell to the plane */
QCOMPARE ( ( Intersection : : planeLine ( planePosition , planeNormal ,
QCOMPARE ( ( Intersection : : planeLine ( planePosition , planeNormal ,
Vector3 ( 1 , 0 , 1 ) , Vector3 ( 0 , 0 , 1 ) ) ) , numeric_limits < float > : : infinity ( ) ) ;
Vector3 ( 1.0f , 0.0f , 1.0f ) , Vector3 ( 0.0f , 0.0f , 1.0f ) ) ) , numeric_limits < float > : : infinity ( ) ) ;
}
}
} } } }
} } } }