kolja 6 years ago
parent
commit
638cbbedd1
2 changed files with 4 additions and 2 deletions
  1. 1 1
      Model2D.cpp
  2. 3 1
      Vec2.h

+ 1 - 1
Model2D.cpp

@@ -549,7 +549,7 @@ bool Model2DData::split( Vertex pos, Vertex dir, char *polygonName, Polygon2D &p
                             offset2 = ( point.x - pos.x ) / dir.x;
                         else
                             offset2 = ( point.y - pos.y ) / dir.y;
-                        if( needOne && min( abs( bo1 ), abs( bo1 - 1 ) ) + min( abs( bo2 ), bo2 - 1 ) > min( abs( offset1 ), abs( offset1 - 1 ) ) + min( abs( offset2 ), abs( offset2 - 1 ) ) )
+                        if( needOne && MIN( abs( bo1 ), abs( bo1 - 1 ) ) + MIN( abs( bo2 ), bo2 - 1 ) > MIN( abs( offset1 ), abs( offset1 - 1 ) ) + MIN( abs( offset2 ), abs( offset2 - 1 ) ) )
                         {
                             bo1 = offset1;
                             bo2 = offset2;

+ 3 - 1
Vec2.h

@@ -14,6 +14,8 @@ namespace Framework
         T y; // y Komponente des Vektors
         // Konstruktor
         inline Vec2()
+            : x( 0 ),
+              y( 0 )
         {}
         // Konstruktor
         //  x: X Komponente des Vektors
@@ -120,7 +122,7 @@ namespace Framework
         // Errechnet die Länge des Vektors
         inline T getLength() const
         {
-            return sqrt( getLengthSq() );
+            return (T)sqrt( getLengthSq() );
         }
         // Errechnet das Skalarprodukt zwischen zwei Vektoren
         //  r: Der andere Vektor