Coin Logo 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) 1998-2007 by Systems in Motion. All rights reserved.
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 Systems in Motion about acquiring
18 * a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, 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
33class SbBox3f;
34class SbLine;
35class SbMatrix;
36class SbPlane;
37class SbRotation;
38class SbVec2f;
39class SbVec3f;
40
42public:
43 enum ProjectionType { ORTHOGRAPHIC = 0, PERSPECTIVE = 1 };
44
45public:
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
102public:
103 // Warning! It's extremely bad design to keep these data members
104 // public, but we have no choice since this is how it's done in
105 // the original SGI Open Inventor. We've seen example code that
106 // use these variables directly so we'll have to be compatible
107 // here. Please don't use these variables directly unless you're
108 // very sure about what you're doing.
112 float nearDist;
117
118private:
119
120 SbDPViewVolume dpvv;
121};
122
123#endif // !COIN_SBVIEWVOLUME_H
The SbBox3f class is an abstraction for an axis aligned 3 dimensional box.
Definition SbBox3f.h:37
The SbLine class represents a line in 3D space.
Definition SbLine.h:32
The SbList class is a template container class for lists.
Definition SbList.h:47
The SbMatrix class is a 4x4 dimensional representation of a matrix.
Definition SbMatrix.h:37
The SbPlane class represents a plane in 3D space.
Definition SbPlane.h:34
The SbRotation class represents a rotation in 3D space.
Definition SbRotation.h:33
The SbVec2f class is a 2 dimensional vector with floating point coordinates.
Definition SbVec2f.h:36
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition SbVec3f.h:37
The SbViewVolume class is a viewing volume in 3D space.
Definition SbViewVolume.h:41
float nearDist
Definition SbViewVolume.h:112
SbVec3f lrf
Definition SbViewVolume.h:115
SbVec3f projDir
Definition SbViewVolume.h:111
float nearToFar
Definition SbViewVolume.h:113
ProjectionType
Definition SbViewVolume.h:43
ProjectionType type
Definition SbViewVolume.h:109
SbVec3f projPoint
Definition SbViewVolume.h:110
SbVec3f ulf
Definition SbViewVolume.h:116
SbVec3f llf
Definition SbViewVolume.h:114

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Mon Jan 22 2024 for Coin by Doxygen. 1.10.0