summaryrefslogtreecommitdiffstats
path: root/kpovmodeler/pmviewstructure.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit47d455dd55be855e4cc691c32f687f723d9247ee (patch)
tree52e236aaa2576bdb3840ebede26619692fed6d7d /kpovmodeler/pmviewstructure.cpp
downloadtdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.tar.gz
tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kpovmodeler/pmviewstructure.cpp')
-rw-r--r--kpovmodeler/pmviewstructure.cpp127
1 files changed, 127 insertions, 0 deletions
diff --git a/kpovmodeler/pmviewstructure.cpp b/kpovmodeler/pmviewstructure.cpp
new file mode 100644
index 00000000..966df90b
--- /dev/null
+++ b/kpovmodeler/pmviewstructure.cpp
@@ -0,0 +1,127 @@
+/*
+**************************************************************************
+ description
+ --------------------
+ copyright : (C) 2000-2001 by Andreas Zehender
+**************************************************************************
+
+**************************************************************************
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+**************************************************************************/
+
+
+#include "pmviewstructure.h"
+
+/*
+void PMViewStructure::render( )
+{
+ glVertexPointer( 3, GL_DOUBLE, sizeof( PMVector ), points.data( ) );
+ glDrawElements( GL_LINES, lines.size( ) * 2,
+ GL_UNSIGNED_INT, lines.data( ) );
+}
+*/
+
+PMViewStructure::PMViewStructure( )
+{
+ m_parameterKey = -1;
+}
+
+PMViewStructure::PMViewStructure( unsigned int n, unsigned int l, unsigned int f )
+{
+ m_points.resize( n );
+ m_lines.resize( l );
+ m_faces.resize( f );
+ m_parameterKey = -1;
+}
+
+PMViewStructure::PMViewStructure( const PMViewStructure& vs )
+{
+ m_points = vs.m_points;
+ m_lines = vs.m_lines;
+ m_faces = vs.m_faces;
+ m_parameterKey = vs.m_parameterKey;
+}
+
+PMViewStructure::PMViewStructure( const PMViewStructure* vs )
+{
+ m_points = vs->m_points;
+ m_lines = vs->m_lines;
+ m_faces = vs->m_faces;
+ m_parameterKey = vs->m_parameterKey;
+}
+
+PMViewStructure& PMViewStructure::operator = ( const PMViewStructure& vs )
+{
+ m_lines = vs.m_lines;
+ m_points = vs.m_points;
+ m_faces = vs.m_faces;
+
+ return *this;
+}
+
+bool PMViewStructure::operator == ( const PMViewStructure& vs ) const
+{
+ return ( ( m_lines.data( ) == vs.m_lines.data( ) )
+ && ( m_points.data( ) == vs.m_points.data( ) )
+ && ( m_faces == vs.m_faces ) );
+}
+
+bool PMViewStructure::operator != ( const PMViewStructure& vs ) const
+{
+ return ( ( m_lines.data( ) != vs.m_lines.data( ) )
+ || ( m_points.data( ) != vs.m_points.data( ) )
+ || !( m_faces == vs.m_faces ) );
+}
+
+
+PMBoundingBox::PMBoundingBox( const PMVector& min, const PMVector& max )
+{
+ m_bValid = true;
+ m_min = min;
+ m_max = max;
+}
+
+PMBoundingBox::PMBoundingBox( )
+{
+ m_bValid = false;
+ m_min = PMVector( 0.0, 0.0, 0.0 );
+ m_max = PMVector( 0.0, 0.0, 0.0 );
+}
+
+void PMBoundingBox::mergeWith( const PMBoundingBox& box )
+{
+ if( m_bValid )
+ {
+ if( box.m_bValid )
+ {
+ if( box.m_min.x( ) < m_min.x( ) )
+ m_min.setX( box.m_min.x( ) );
+ if( box.m_min.y( ) < m_min.y( ) )
+ m_min.setY( box.m_min.y( ) );
+ if( box.m_min.z( ) < m_min.z( ) )
+ m_min.setZ( box.m_min.z( ) );
+
+ if( box.m_max.x( ) > m_max.x( ) )
+ m_max.setX( box.m_max.x( ) );
+ if( box.m_max.y( ) > m_max.y( ) )
+ m_max.setY( box.m_max.y( ) );
+ if( box.m_max.z( ) > m_max.z( ) )
+ m_max.setZ( box.m_max.z( ) );
+ }
+ }
+ else
+ {
+ if( box.m_bValid )
+ {
+ m_bValid = true;
+ m_max = box.m_max;
+ m_min = box.m_min;
+ }
+ }
+}