diff --git a/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.txx b/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.txx
index 84b0283b9e53cc7e6ccf9b0600672252d266f520..ab1934f837d872c1ff4239353a4ba8cafdca6781 100644
--- a/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.txx
+++ b/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.txx
@@ -38,7 +38,7 @@ LineSpatialObjectListToRightAnglePointSetFilter<TImage,TLinesList ,TPointSet>
   this->SetNumberOfRequiredOutputs(1);
 
   m_ThresholdDistance = 20.;
-  m_ThresholdAngle = M_PI/36.;  //36 cause we want 5 degrees threshold
+  m_ThresholdAngle = M_PI/30.;  //36 cause we want 6 degrees threshold
 }
 
 /**
@@ -116,8 +116,15 @@ LineSpatialObjectListToRightAnglePointSetFilter<TImage,TLinesList ,TPointSet>
 		  RightAngleCoordinate = this->ComputeAngleRightCoordinate(*itLinesListTest, *itLinesListCur);
 		  
 		  /** Compute the distance between the two segments and the right angle formed by this segments*/
-		  if(this->ComputeDistanceFromPointToSegment(RightAngleCoordinate,*itLinesListTest) <m_ThresholdDistance &&
-		     this->ComputeDistanceFromPointToSegment(RightAngleCoordinate,*itLinesListCur) <m_ThresholdDistance)
+		  double dist1 = this->ComputeDistanceFromPointToSegment(RightAngleCoordinate,*itLinesListTest);
+		  double dist2 = this->ComputeDistanceFromPointToSegment(RightAngleCoordinate,*itLinesListCur) ;
+		  
+		  /** Use Pythagore to compute the distance between the two segments*/
+		  double SegmentDistance = vcl_sqrt(dist1*dist1 + dist2*dist2);
+		  
+// 		  if(this->ComputeDistanceFromPointToSegment(RightAngleCoordinate,*itLinesListTest) <m_ThresholdDistance &&
+// 		     this->ComputeDistanceFromPointToSegment(RightAngleCoordinate,*itLinesListCur) <m_ThresholdDistance)
+		  if(SegmentDistance < m_ThresholdDistance)
 		    {
 		      /** If Right Angle & not so far from segments:  Add it to the pointSet*/
 		      this->AddRightAngleToPointSet(RightAngleCoordinate , *itLinesListTest , *itLinesListCur );
diff --git a/Examples/FeatureExtraction/CMakeLists.txt b/Examples/FeatureExtraction/CMakeLists.txt
index 6306a0359dd5d64d6ad1c21acca9ae4c69b99d35..aa321a3592d0bbb3799e75c03c4b5f7544aebbd3 100644
--- a/Examples/FeatureExtraction/CMakeLists.txt
+++ b/Examples/FeatureExtraction/CMakeLists.txt
@@ -348,8 +348,8 @@ ADD_TEST(RightAngleDetectionExample  ${EXE_TESTS2}
 	${TEMP}/RighAngleOutput.tif
 	${TEMP}/PrettyRightAngleInput.png	
 	${TEMP}/PrettyRightAngleOutput.png
-	0.09
-	20.
+	0.1
+	35.
 )
 
 ADD_EXECUTABLE(otbFeatureExtractionExamplesTests1 otbFeatureExtractionExamplesTests1.cxx)