Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Examples  

qsprojection3d.h

00001 /***************************************************************************
00002                                 qsprojection3d.h
00003                              -------------------                                         
00004     begin                : 01-January-2000
00005     copyright            : (C) 2000 by Kamil Dobkowski                         
00006     email                : kamildobk@poczta.onet.pl                                     
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   * 
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef QSPROJECTION3D_H
00019 #define QSPROJECTION3D_H
00020 
00021 #ifdef HAVE_CONFIG_H
00022 #include <config.h>
00023 #endif
00024 
00025 
00026 #include"qsprojection.h"
00027 
00032 class QSProjection3D : public QSProjection {
00033 
00034     public:
00035 
00036         typedef double Matrix[4][4];
00041         Matrix M;
00045         Matrix P;
00050         Matrix T;
00054         QSPt3f lvector;
00059         QSPt3f dvector;
00064         QSPt3f eye;
00069        QSPt3f bmin;
00073        QSPt3f bmax;
00077         QSProjection3D();
00081        virtual ~QSProjection3D();
00082        static void matrix_to_stdout( const Matrix& m );
00086       static void matrixI( Matrix m );
00090       static void multiply( Matrix A, const Matrix B );
00094       static void inv( Matrix result, const Matrix m );
00098       static void copy( Matrix dst, const Matrix src );
00102       static void applyT( Matrix m, double dx, double dy, double dz );
00106       static void applyS( Matrix m, double sx, double sy, double sz );
00110       static void applyR( Matrix m, double alfay, double alfax, double alfaz = 0.0 );
00114       static void ortho( Matrix m, double l, double r, double b, double t, double n, double f );
00118       static void frustum( Matrix m, double l, double r, double b, double t, double n, double f );
00122       static void applyViewport( Matrix m, double x, double y, double w, double h, double n = 0.0, double f = 1.0 );
00126       static QSPt3f worldTransformation( const Matrix T, const QSPt3f &p );
00127 
00128 
00129       void setProjection( double  l, double  r, double  b, double  t, double  n, double  f, bool  perspective );
00130       void getProjection( double *l, double *r, double *b, double *t, double *n, double *f, bool *perspective ) const;
00131       void setViewport( double  x, double  y, double  w, double  h, double  n = 0.0, double  f = 0.0 );
00132       void getViewport( double *x, double *y, double *w, double *h, double *n, double *f  ) const;
00139       void fit( Matrix& S );
00143       virtual QSPt2f middle() const;
00149       virtual QSPt3f furthest() const;
00153       QSPt3f nearest() const;
00157       QSPt3f left() const;
00161       QSPt3f right() const;
00165     virtual QSPt2f world2DToCanvas( const QSPt2f& p ) const;
00169     virtual QSPt3f world2DToCanvas3( const QSPt2f& p ) const;
00173     virtual QSPt2f world3DToCanvas( const QSPt3f& p ) const;
00177     virtual QSPt3f world3DToCanvas3( const QSPt3f& p ) const;
00181     virtual QSPt3f canvas3ToWorld3D( const QSPt3f &p ) const;
00182 
00183      private:
00184 
00185         bool m_perspective;
00186 
00187         double m_proj[6];
00188         double m_view[6];
00189 
00190        static void ludcmp( Matrix a, int indx[4], double *d );
00191        static void lubksb( Matrix a, int indx[4], double b[] );
00192 
00193 
00194      };
00195 
00196 #endif
00197 
00198 
00199 
00200 
00201 
00202 
00203 
00204 
00205 
00206 

Generated on Mon Mar 18 19:16:33 2002 for KMatplot library by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002