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

SbViewVolume.h
1 #ifndef COIN_SBVIEWVOLUME_H
2 #define COIN_SBVIEWVOLUME_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/SbVec3f.h>
31 #include <Inventor/SbDPViewVolume.h>
32
33 class SbBox3f;
34 class SbLine;
35 class SbMatrix;
36 class SbPlane;
37 class SbRotation;
38 class SbVec2f;
39 class SbVec3f;
40
41 class COIN_DLL_API SbViewVolume {
42 public:
43 enum ProjectionType { ORTHOGRAPHIC = 0, PERSPECTIVE = 1 };
44
45 public:
46 SbViewVolume(void);
47 ~SbViewVolume(void);
48 void getMatrices(SbMatrix& affine, SbMatrix& proj) const;
49 SbMatrix getMatrix(void) const;
50 SbMatrix getCameraSpaceMatrix(void) const;
51 void projectPointToLine(const SbVec2f& pt, SbLine& line) const;
52 void projectPointToLine(const SbVec2f& pt,
53 SbVec3f& line0, SbVec3f& line1) const;
54 void projectToScreen(const SbVec3f& src, SbVec3f& dst) const;
55 SbPlane getPlane(const float distFromEye) const;
56 SbVec3f getSightPoint(const float distFromEye) const;
57 SbVec3f getPlanePoint(const float distFromEye,
58 const SbVec2f& normPoint) const;
59 SbRotation getAlignRotation(SbBool rightAngleOnly = FALSE) const;
60 float getWorldToScreenScale(const SbVec3f& worldCenter,
61 float normRadius) const;
62 SbVec2f projectBox(const SbBox3f& box) const;
63 SbViewVolume narrow(float left, float bottom,
64 float right, float top) const;
65 SbViewVolume narrow(const SbBox3f& box) const;
66 void ortho(float left, float right,
67 float bottom, float top,
68 float nearval, float farval);
69 void perspective(float fovy, float aspect,
70 float nearval, float farval);
71 void frustum(float left, float right,
72 float bottom, float top,
73 float nearval, float farval);
74 void rotateCamera(const SbRotation& q);
75 void translateCamera(const SbVec3f& v);
76 SbVec3f zVector(void) const;
77 SbViewVolume zNarrow(float nearval, float farval) const;
78 void scale(float factor);
79 void scaleWidth(float ratio);
80 void scaleHeight(float ratio);
81 ProjectionType getProjectionType(void) const;
82 const SbVec3f& getProjectionPoint(void) const;
83 const SbVec3f& getProjectionDirection(void) const;
84 float getNearDist(void) const;
85 float getWidth(void) const;
86 float getHeight(void) const;
87 float getDepth(void) const;
88
89 void print(FILE * fp) const;
90 void getViewVolumePlanes(SbPlane planes[6]) const;
91 void transform(const SbMatrix &matrix);
92 SbVec3f getViewUp(void) const;
93
94 SbBool intersect(const SbVec3f & p) const;
95 SbBool intersect(const SbVec3f & p0, const SbVec3f & p1,
96 SbVec3f & closestpoint) const;
97 SbBool intersect(const SbBox3f & box) const;
98
99 SbBool outsideTest(const SbPlane & p,
100 const SbVec3f & bmin, const SbVec3f & bmax) const;
101 const SbDPViewVolume & getDPViewVolume(void) const;
102
103 public:
104 // Warning! It's extremely bad design to keep these data members
105 // public, but we have no choice since this is how it's done in
106 // the original SGI Open Inventor. We've seen example code that
107 // use these variables directly so we'll have to be compatible
108 // here. Please don't use these variables directly unless you're
109 // very sure about what you're doing.
110 ProjectionType type;
111 SbVec3f projPoint;
112 SbVec3f projDir;
113 float nearDist;
114 float nearToFar;
115 SbVec3f llf;
116 SbVec3f lrf;
117 SbVec3f ulf;
118
119 private:
120
121 SbDPViewVolume dpvv;
122 };
123
124 #endif // !COIN_SBVIEWVOLUME_H
SbVec2f
The SbVec2f class is a 2 dimensional vector with floating point coordinates.This vector class is used...
Definition: SbVec2f.h:39
SbBox3f
The SbBox3f class is an abstraction for an axis aligned 3 dimensional box.This box abstraction class ...
Definition: SbBox3f.h:37
SbViewVolume::ulf
SbVec3f ulf
Definition: SbViewVolume.h:117
SbViewVolume::projPoint
SbVec3f projPoint
Definition: SbViewVolume.h:111
SbViewVolume::llf
SbVec3f llf
Definition: SbViewVolume.h:115
SbRotation
The SbRotation class represents a rotation in 3D space.SbRotation is used extensively throughout the ...
Definition: SbRotation.h:33
SbViewVolume::projDir
SbVec3f projDir
Definition: SbViewVolume.h:112
SbVec3f
The SbVec3f class is a 3 dimensional vector with floating point coordinates.This vector class is used...
Definition: SbVec3f.h:40
SbViewVolume::ProjectionType
ProjectionType
Definition: SbViewVolume.h:43
SbLine
The SbLine class represents a line in 3D space.SbLine provides a way of specifying a directed line...
Definition: SbLine.h:32
SbMatrix
The SbMatrix class is a 4x4 dimensional representation of a matrix.SbMatrix is used by many other cla...
Definition: SbMatrix.h:37
SbDPViewVolume
The SbDPViewVolume class is a double precision viewing volume in 3D space.This class contains the nec...
Definition: SbDPViewVolume.h:40
SbViewVolume::type
ProjectionType type
Definition: SbViewVolume.h:110
SbViewVolume::nearDist
float nearDist
Definition: SbViewVolume.h:113
SbViewVolume
The SbViewVolume class is a viewing volume in 3D space.This class contains the necessary information ...
Definition: SbViewVolume.h:41
SbPlane
The SbPlane class represents a plane in 3D space.SbDPPlane is used by many other classes in Coin...
Definition: SbPlane.h:34
SbViewVolume::lrf
SbVec3f lrf
Definition: SbViewVolume.h:116
SbViewVolume::nearToFar
float nearToFar
Definition: SbViewVolume.h:114

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