| http://www.sim.no/ http://www.coin3d.org/

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

SbDPViewVolume.h
1 #ifndef COIN_SBDPVIEWVOLUME_H
2 #define COIN_SBDPVIEWVOLUME_H
3
4 /**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25 \**************************************************************************/
26
27 #include <stdio.h>
28
29 #include <Inventor/SbBasic.h>
30 #include <Inventor/SbVec3d.h>
31
32 class SbBox3f;
33 class SbDPLine;
34 class SbDPMatrix;
35 class SbPlane;
36 class SbDPRotation;
37 class SbVec2d;
38 class SbViewVolume;
39
40 class COIN_DLL_API SbDPViewVolume {
41 public:
42 enum ProjectionType { ORTHOGRAPHIC = 0, PERSPECTIVE = 1 };
43
44 public:
45 SbDPViewVolume(void);
46 ~SbDPViewVolume(void);
47 void getMatrices(SbDPMatrix& affine, SbDPMatrix& proj) const;
48 SbDPMatrix getMatrix(void) const;
49 SbDPMatrix getCameraSpaceMatrix(void) const;
50 void projectPointToLine(const SbVec2d& pt, SbDPLine& line) const;
51 void projectPointToLine(const SbVec2d& pt,
52 SbVec3d& line0, SbVec3d& line1) const;
53 void projectToScreen(const SbVec3d& src, SbVec3d& dst) const;
54 SbPlane getPlane(const double distFromEye) const;
55 SbVec3d getSightPoint(const double distFromEye) const;
56 SbVec3d getPlanePoint(const double distFromEye,
57 const SbVec2d& normPoint) const;
58 SbDPRotation getAlignRotation(SbBool rightAngleOnly = FALSE) const;
59 double getWorldToScreenScale(const SbVec3d& worldCenter,
60 double normRadius) const;
61 SbVec2d projectBox(const SbBox3f& box) const;
62 SbDPViewVolume narrow(double left, double bottom,
63 double right, double top) const;
64 SbDPViewVolume narrow(const SbBox3f& box) const;
65 void ortho(double left, double right,
66 double bottom, double top,
67 double nearval, double farval);
68 void perspective(double fovy, double aspect,
69 double nearval, double farval);
70 void frustum(double left, double right,
71 double bottom, double top,
72 double nearval, double farval);
73 void rotateCamera(const SbDPRotation& q);
74 void translateCamera(const SbVec3d& v);
75 SbVec3d zVector(void) const;
76 SbDPViewVolume zNarrow(double nearval, double farval) const;
77 void scale(double factor);
78 void scaleWidth(double ratio);
79 void scaleHeight(double ratio);
80 ProjectionType getProjectionType(void) const;
81 const SbVec3d& getProjectionPoint(void) const;
82 const SbVec3d& getProjectionDirection(void) const;
83 double getNearDist(void) const;
84 double getWidth(void) const;
85 double getHeight(void) const;
86 double getDepth(void) const;
87
88 void print(FILE * fp) const;
89 void getViewVolumePlanes(SbPlane planes[6]) const;
90 void transform(const SbDPMatrix &matrix);
91 SbVec3d getViewUp(void) const;
92
93 void copyValues(SbViewVolume & vv);
94
95 private:
96
97 ProjectionType type;
98 SbVec3d projPoint;
99 SbVec3d projDir;
100 double nearDist;
101 double nearToFar;
102 SbVec3d llf;
103 SbVec3d lrf;
104 SbVec3d ulf;
105
106 void getPlaneRectangle(const double depth, SbVec3d & lowerleft,
107 SbVec3d & lowerright, SbVec3d & upperleft,
108 SbVec3d & upperright) const;
109 };
110
111 #endif // !COIN_SBDPVIEWVOLUME_H

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