]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - contrib/bobtoolz/DWinding.cpp
Prevent implicit Widget construction
[xonotic/netradiant.git] / contrib / bobtoolz / DWinding.cpp
index 35983feac6f8e8d85e8b157497b12f332ede1109..c3d811802fd4c83629c2c20e98cb103237c571da 100644 (file)
 //
 //////////////////////////////////////////////////////////////////////
 
-#include "StdAfx.h"
 #include "DWinding.h"
+
+#include <list>
+
+#include "DPoint.h"
 #include "DPlane.h"
-#include "misc.h"
 
 //////////////////////////////////////////////////////////////////////
 // Construction/Destruction
@@ -149,8 +151,8 @@ DWinding* DWinding::CopyWinding(){
 
 
 int DWinding::WindingOnPlaneSide( vec3_t normal, vec_t dist ){
-       bool front = FALSE;
-       bool back = FALSE;
+       bool front = false;
+       bool back = false;
 
        for ( int i = 0; i < numpoints; i++ )
        {
@@ -159,14 +161,14 @@ int DWinding::WindingOnPlaneSide( vec3_t normal, vec_t dist ){
                        if ( front ) {
                                return SIDE_CROSS;
                        }
-                       back = TRUE;
+                       back = true;
                        continue;
                }
                if ( d > ON_EPSILON ) {
                        if ( back ) {
                                return SIDE_CROSS;
                        }
-                       front = TRUE;
+                       front = true;
                        continue;
                }
        }
@@ -186,12 +188,12 @@ void DWinding::CheckWinding(){
        vec3_t dir, edgenormal;
 
        if ( numpoints < 3 ) {
-               Sys_Printf( "CheckWinding: %i points", numpoints );
+               globalOutputStream() << "CheckWinding: " << numpoints << " points\n";
        }
 
        vec_t area = WindingArea();
        if ( area < 1 ) {
-               Sys_Printf( "CheckWinding: %f area", area );
+               globalOutputStream() << "CheckWinding: " << area << " area\n";
        }
 
        DPlane* wPlane = WindingPlane();
@@ -203,7 +205,7 @@ void DWinding::CheckWinding(){
                int j;
                for ( j = 0; j < 3; j++ )
                        if ( p1[j] > BOGUS_RANGE || p1[j] < -BOGUS_RANGE ) {
-                               Sys_Printf( "CheckFace: BUGUS_RANGE: %f", p1[j] );
+                               globalOutputStream() << "CheckFace: BOGUS_RANGE: " << p1[j] << "\n";
                        }
 
                j = i + 1 == numpoints ? 0 : i + 1;
@@ -211,7 +213,7 @@ void DWinding::CheckWinding(){
                // check the point is on the face plane
                vec_t d = DotProduct( p1, wPlane->normal ) - wPlane->_d;
                if ( d < -ON_EPSILON || d > ON_EPSILON ) {
-                       Sys_Printf( "CheckWinding: point off plane" );
+                       globalOutputStream() << "CheckWinding: point off plane\n";
                }
 
                // check the edge isnt degenerate
@@ -219,7 +221,7 @@ void DWinding::CheckWinding(){
                VectorSubtract( p2, p1, dir );
 
                if ( VectorLength( dir ) < ON_EPSILON ) {
-                       Sys_Printf( "CheckWinding: degenerate edge" );
+                       globalOutputStream() << "CheckWinding: degenerate edge\n";
                }
 
                CrossProduct( wPlane->normal, dir, edgenormal );
@@ -235,7 +237,7 @@ void DWinding::CheckWinding(){
 
                        d = DotProduct( p[j], edgenormal );
                        if ( d > ( edgedist + ON_EPSILON ) ) {
-                               Sys_Printf( "CheckWinding: non-convex" );
+                               globalOutputStream() << "CheckWinding: non-convex\n";
                        }
                }
        }
@@ -287,11 +289,11 @@ bool DWinding::ChopWindingInPlace( DPlane* chopPlane, vec_t epsilon ){
 
        if ( !counts[0] ) {
                delete this;
-               return FALSE;
+               return false;
        }
 
        if ( !counts[1] ) {
-               return TRUE;
+               return true;
        }
 
        int maxpts = numpoints + 4;   // cant use counts[0]+2 because
@@ -342,17 +344,17 @@ bool DWinding::ChopWindingInPlace( DPlane* chopPlane, vec_t epsilon ){
        }
 
        if ( f->numpoints > maxpts ) {
-               Sys_Printf( "ClipWinding: points exceeded estimate" );
+               globalOutputStream() << "ClipWinding: points exceeded estimate\n";
        }
        if ( f->numpoints > MAX_POINTS_ON_WINDING ) {
-               Sys_Printf( "ClipWinding: MAX_POINTS_ON_WINDING" );
+               globalOutputStream() << "ClipWinding: MAX_POINTS_ON_WINDING\n";
        }
 
        delete[] p;
        p = f->p;
        f->p = NULL;
        delete f;
-       return TRUE;
+       return true;
 }
 
 void DWinding::ClipWindingEpsilon( DPlane* chopPlane, vec_t epsilon, DWinding **front, DWinding **back ){
@@ -461,10 +463,10 @@ void DWinding::ClipWindingEpsilon( DPlane* chopPlane, vec_t epsilon, DWinding **
        }
 
        if ( f->numpoints > maxpts || b->numpoints > maxpts ) {
-               Sys_Printf( "ClipWinding: points exceeded estimate" );
+               globalOutputStream() << "ClipWinding: points exceeded estimate\n";
        }
        if ( f->numpoints > MAX_POINTS_ON_WINDING || b->numpoints > MAX_POINTS_ON_WINDING ) {
-               Sys_Printf( "ClipWinding: MAX_POINTS_ON_WINDING" );
+               globalOutputStream() << "ClipWinding: MAX_POINTS_ON_WINDING\n";
        }
 }
 
@@ -480,7 +482,7 @@ bool DWinding::ChopWinding( DPlane* chopPlane ){
 
        if ( !f ) {
                delete this;
-               return FALSE;
+               return false;
        }
 
        delete[] p;
@@ -489,5 +491,5 @@ bool DWinding::ChopWinding( DPlane* chopPlane ){
        numpoints = f->numpoints;
        delete f;
 
-       return TRUE;
+       return true;
 }