+bool HYDROGUI_ImportImageOp::checkPoints( const QPointF& thePointA,
+ const QPointF& thePointB,
+ const QPointF& thePointC,
+ const bool theIsByTwoPoints,
+ const QString& theLineErrMsg,
+ const QString& thePoinErrMsg,
+ QString& theErrorMsg,
+ const bool theIsToCheckInvertibles ) const
+{
+ double xa = thePointA.x();
+ double ya = thePointA.y();
+ double xb = thePointB.x();
+ double yb = thePointB.y();
+ double xc = thePointC.x();
+ double yc = thePointC.y();
+
+ if ( !theIsByTwoPoints )
+ {
+ // check that three input points don't belong to a single line
+ if ( ValuesEquals( ( yb - ya ) * ( xc - xa ), ( yc - ya ) * ( xb - xa ) ) )
+ {
+ theErrorMsg = theLineErrMsg;
+ return false;
+ }
+ }
+ else
+ {
+ // check that two points are not identical
+ if ( ValuesEquals( xa, ya ) && ValuesEquals( xb, yb ) )
+ {
+ theErrorMsg = thePoinErrMsg;
+ return false;
+ }
+ }
+
+ if ( theIsToCheckInvertibles )
+ {
+ QTransform aTransform1( xa, ya, 1, xb, yb, 1, xc, yc, 1 );
+
+ bool anIsInvertible = false;
+ QTransform aTransform1Inverted = aTransform1.inverted( &anIsInvertible );
+ if( !anIsInvertible )
+ {
+ theErrorMsg = tr( "TRANSFORMATION_MATRIX_CANNOT_BE_COMPUTED" );
+ return false;
+ }
+ }
+
+ return true;
+}
+