From 0190a6708de52fbb9d201fddc3c4260858f32d19 Mon Sep 17 00:00:00 2001 From: enk Date: Fri, 18 Feb 2005 07:15:27 +0000 Subject: [PATCH] Added support controls for polygones --- src/Controls/SMESH_Controls.cxx | 36 +++++++++++++++------------------ 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/src/Controls/SMESH_Controls.cxx b/src/Controls/SMESH_Controls.cxx index 4aa92f1d2..bfb3f8215 100644 --- a/src/Controls/SMESH_Controls.cxx +++ b/src/Controls/SMESH_Controls.cxx @@ -213,26 +213,17 @@ double MinimumAngle::GetValue( const TSequenceOfXYZ& P ) { double aMin; - if ( P.size() == 3 ) - { - double A0 = getAngle( P( 3 ), P( 1 ), P( 2 ) ); - double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) ); - double A2 = getAngle( P( 2 ), P( 3 ), P( 1 ) ); - - aMin = Min( A0, Min( A1, A2 ) ); - } - else if ( P.size() == 4 ) - { - double A0 = getAngle( P( 4 ), P( 1 ), P( 2 ) ); - double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) ); - double A2 = getAngle( P( 2 ), P( 3 ), P( 4 ) ); - double A3 = getAngle( P( 3 ), P( 4 ), P( 1 ) ); - - aMin = Min( Min( A0, A1 ), Min( A2, A3 ) ); - } - else + if (P.size() <3) return 0.; + + aMin = getAngle(P( P.size() ), P( 1 ), P( 2 )); + aMin = Min(aMin,getAngle(P( P.size()-1 ), P( P.size() ), P( 1 ))); + for (int i=2; i 3) + aArea = getArea( P( 1 ), P( 2 ), P( 3 ) ); else return 0; + + for (int i=4; i<=P.size(); i++) + aArea += getArea(P(1),P(i-1),P(i)); + return aArea; } double Area::GetBadRate( double Value, int /*nbNodes*/ ) const -- 2.39.2