Skip to content
Permalink
Browse files

add QgsBox3DDistanceTo test

  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Jan 13, 2021
1 parent 2c9c6f9 commit bfa835d3ac439cfc88c0714f07c258ac79300a6a
Showing with 16 additions and 0 deletions.
  1. +16 −0 tests/src/3d/testqgs3dutils.cpp
@@ -17,6 +17,8 @@

#include "qgs3dutils.h"

#include "qgsbox3d.h"

#include <QSize>

/**
@@ -35,6 +37,7 @@ class TestQgs3DUtils : public QObject

void testTransforms();
void testRayFromScreenPoint();
void testQgsBox3DDistanceTo();
private:
};

@@ -138,7 +141,20 @@ void TestQgs3DUtils::testRayFromScreenPoint()
QVERIFY( ray1 == ray2 );
}
}
}

void TestQgs3DUtils::testQgsBox3DDistanceTo()
{
{
QgsBox3d box( -1, -1, -1, 1, 1, 1 );
QVERIFY( box.distanceTo( QVector3D( 0, 0, 0 ) ) == 0.0 );
QVERIFY( box.distanceTo( QVector3D( 2, 2, 2 ) ) == qSqrt( 3.0 ) );
}
{
QgsBox3d box( 1, 2, 1, 4, 3, 3 );
QVERIFY( box.distanceTo( QVector3D( 1, 2, 1 ) ) == 0.0 );
QVERIFY( box.distanceTo( QVector3D( 0, 0, 0 ) ) == qSqrt( 6.0 ) );
}
}

QGSTEST_MAIN( TestQgs3DUtils )

0 comments on commit bfa835d

Please sign in to comment.
You can’t perform that action at this time.