Coin Logo http://www.sim.no/
http://www.coin3d.org/

SbDPViewVolume.h
00001 #ifndef COIN_SBDPVIEWVOLUME_H
00002 #define COIN_SBDPVIEWVOLUME_H
00003 
00004 /**************************************************************************\
00005  *
00006  *  This file is part of the Coin 3D visualization library.
00007  *  Copyright (C) by Kongsberg Oil & Gas Technologies.
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 Kongsberg Oil & Gas Technologies
00018  *  about acquiring a Coin Professional Edition License.
00019  *
00020  *  See http://www.coin3d.org/ for more information.
00021  *
00022  *  Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
00023  *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
00024  *
00025 \**************************************************************************/
00026 
00027 #include <stdio.h>
00028 
00029 #include <Inventor/SbBasic.h>
00030 #include <Inventor/SbVec3d.h>
00031 
00032 class SbBox3f;
00033 class SbDPLine;
00034 class SbDPMatrix;
00035 class SbPlane;
00036 class SbDPRotation;
00037 class SbVec2d;
00038 class SbViewVolume;
00039 
00040 class COIN_DLL_API SbDPViewVolume {
00041 public:
00042   enum ProjectionType { ORTHOGRAPHIC = 0, PERSPECTIVE = 1 };
00043 
00044 public:
00045   SbDPViewVolume(void);
00046   ~SbDPViewVolume(void);
00047   void getMatrices(SbDPMatrix& affine, SbDPMatrix& proj) const;
00048   SbDPMatrix getMatrix(void) const;
00049   SbDPMatrix getCameraSpaceMatrix(void) const;
00050   void projectPointToLine(const SbVec2d& pt, SbDPLine& line) const;
00051   void projectPointToLine(const SbVec2d& pt,
00052                           SbVec3d& line0, SbVec3d& line1) const;
00053   void projectToScreen(const SbVec3d& src, SbVec3d& dst) const;
00054   SbPlane getPlane(const double distFromEye) const;
00055   SbVec3d getSightPoint(const double distFromEye) const;
00056   SbVec3d getPlanePoint(const double distFromEye,
00057                         const SbVec2d& normPoint) const;
00058   SbDPRotation getAlignRotation(SbBool rightAngleOnly = FALSE) const;
00059   double getWorldToScreenScale(const SbVec3d& worldCenter,
00060                               double normRadius) const;
00061   SbVec2d projectBox(const SbBox3f& box) const;
00062   SbDPViewVolume narrow(double left, double bottom,
00063                       double right, double top) const;
00064   SbDPViewVolume narrow(const SbBox3f& box) const;
00065   void ortho(double left, double right,
00066              double bottom, double top,
00067              double nearval, double farval);
00068   void perspective(double fovy, double aspect,
00069                    double nearval, double farval);
00070   void frustum(double left, double right,
00071                double bottom, double top,
00072                double nearval, double farval);
00073   void rotateCamera(const SbDPRotation& q);
00074   void translateCamera(const SbVec3d& v);
00075   SbVec3d zVector(void) const;
00076   SbDPViewVolume zNarrow(double nearval, double farval) const;
00077   void scale(double factor);
00078   void scaleWidth(double ratio);
00079   void scaleHeight(double ratio);
00080   ProjectionType getProjectionType(void) const;
00081   const SbVec3d& getProjectionPoint(void) const;
00082   const SbVec3d& getProjectionDirection(void) const;
00083   double getNearDist(void) const;
00084   double getWidth(void) const;
00085   double getHeight(void) const;
00086   double getDepth(void) const;
00087 
00088   void print(FILE * fp) const;
00089   void getViewVolumePlanes(SbPlane planes[6]) const;
00090   void transform(const SbDPMatrix &matrix);
00091   SbVec3d getViewUp(void) const;
00092 
00093   void copyValues(SbViewVolume & vv);
00094 
00095 private:
00096 
00097   ProjectionType type;
00098   SbVec3d projPoint;
00099   SbVec3d projDir;
00100   double nearDist;
00101   double nearToFar;
00102   SbVec3d llf;
00103   SbVec3d lrf;
00104   SbVec3d ulf;
00105 
00106   void getPlaneRectangle(const double depth, SbVec3d & lowerleft,
00107                          SbVec3d & lowerright, SbVec3d & upperleft,
00108                          SbVec3d & upperright) const;
00109 };
00110 
00111 #endif // !COIN_SBDPVIEWVOLUME_H

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated for Coin by Doxygen 1.7.5.1.