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

SbViewVolume.h

00001 #ifndef COIN_SBVIEWVOLUME_H
00002 #define COIN_SBVIEWVOLUME_H
00003 
00004 /**************************************************************************\
00005  *
00006  *  This file is part of the Coin 3D visualization library.
00007  *  Copyright (C) 1998-2003 by Systems in Motion.  All rights reserved.
00008  *
00009  *  This library is free software; you can redistribute it and/or
00010  *  modify it under the terms of the GNU General Public License
00011  *  ("GPL") version 2 as published by the Free Software Foundation.
00012  *  See the file LICENSE.GPL at the root directory of this source
00013  *  distribution for additional information about the GNU GPL.
00014  *
00015  *  For using Coin with software that can not be combined with the GNU
00016  *  GPL, and for taking advantage of the additional benefits of our
00017  *  support services, please contact Systems in Motion about acquiring
00018  *  a Coin Professional Edition License.
00019  *
00020  *  See <URL:http://www.coin3d.org> for  more information.
00021  *
00022  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
00023  *  <URL:http://www.sim.no>.
00024  *
00025 \**************************************************************************/
00026 
00027 #include <stdio.h>
00028 
00029 #include <Inventor/SbBasic.h>
00030 #include <Inventor/SbVec3f.h>
00031 #include <Inventor/SbDPViewVolume.h>
00032 
00033 class SbBox3f;
00034 class SbLine;
00035 class SbMatrix;
00036 class SbPlane;
00037 class SbRotation;
00038 class SbVec2f;
00039 class SbVec3f;
00040 
00041 class COIN_DLL_API SbViewVolume {
00042 public:
00043   enum ProjectionType { ORTHOGRAPHIC = 0, PERSPECTIVE = 1 };
00044 
00045 public:
00046   SbViewVolume(void);
00047   ~SbViewVolume(void);
00048   void getMatrices(SbMatrix& affine, SbMatrix& proj) const;
00049   SbMatrix getMatrix(void) const;
00050   SbMatrix getCameraSpaceMatrix(void) const;
00051   void projectPointToLine(const SbVec2f& pt, SbLine& line) const;
00052   void projectPointToLine(const SbVec2f& pt,
00053                           SbVec3f& line0, SbVec3f& line1) const;
00054   void projectToScreen(const SbVec3f& src, SbVec3f& dst) const;
00055   SbPlane getPlane(const float distFromEye) const;
00056   SbVec3f getSightPoint(const float distFromEye) const;
00057   SbVec3f getPlanePoint(const float distFromEye,
00058                         const SbVec2f& normPoint) const;
00059   SbRotation getAlignRotation(SbBool rightAngleOnly = FALSE) const;
00060   float getWorldToScreenScale(const SbVec3f& worldCenter,
00061                               float normRadius) const;
00062   SbVec2f projectBox(const SbBox3f& box) const;
00063   SbViewVolume narrow(float left, float bottom,
00064                       float right, float top) const;
00065   SbViewVolume narrow(const SbBox3f& box) const;
00066   void ortho(float left, float right,
00067              float bottom, float top,
00068              float nearval, float farval);
00069   void perspective(float fovy, float aspect,
00070                    float nearval, float farval);
00071   void frustum(float left, float right,
00072                float bottom, float top,
00073                float nearval, float farval);
00074   void rotateCamera(const SbRotation& q);
00075   void translateCamera(const SbVec3f& v);
00076   SbVec3f zVector(void) const;
00077   SbViewVolume zNarrow(float nearval, float farval) const;
00078   void scale(float factor);
00079   void scaleWidth(float ratio);
00080   void scaleHeight(float ratio);
00081   ProjectionType getProjectionType(void) const;
00082   const SbVec3f& getProjectionPoint(void) const;
00083   const SbVec3f& getProjectionDirection(void) const;
00084   float getNearDist(void) const;
00085   float getWidth(void) const;
00086   float getHeight(void) const;
00087   float getDepth(void) const;
00088 
00089   void print(FILE * fp) const;
00090   void getViewVolumePlanes(SbPlane planes[6]) const;
00091   void transform(const SbMatrix &matrix);
00092   SbVec3f getViewUp(void) const;
00093 
00094 public:
00095   // Warning! It's extremely bad design to keep these data members
00096   // public, but we have no choice since this is how it's done in
00097   // the original SGI Open Inventor. We've seen example code that
00098   // use these variables directly so we'll have to be compatible
00099   // here. Please don't use these variables directly unless you're
00100   // very sure about what you're doing.
00101   ProjectionType type;
00102   SbVec3f projPoint;
00103   SbVec3f projDir;
00104   float nearDist;
00105   float nearToFar;
00106   SbVec3f llf;
00107   SbVec3f lrf;
00108   SbVec3f ulf;
00109 
00110 private:
00111   
00112   SbDPViewVolume dpvv;
00113 };
00114 
00115 #endif // !COIN_SBVIEWVOLUME_H

Generated on Sat May 24 22:39:06 2003 for Coin by doxygen1.2.18