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 
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 
102 public:
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;
113  float nearToFar;
117 
118 private:
119 
120  SbDPViewVolume dpvv;
121 };
122 
123 #endif // !COIN_SBVIEWVOLUME_H
SbViewVolume::getSightPoint
SbVec3f getSightPoint(const float distFromEye) const
Definition: SbViewVolume.cpp:305
SbRotation::getValue
const float * getValue(void) const
Definition: SbRotation.cpp:179
SbViewVolume::getPlanePoint
SbVec3f getPlanePoint(const float distFromEye, const SbVec2f &normPoint) const
Definition: SbViewVolume.cpp:319
SbRotation
The SbRotation class represents a rotation in 3D space.
Definition: SbRotation.h:33
SbViewVolume::translateCamera
void translateCamera(const SbVec3f &v)
Definition: SbViewVolume.cpp:502
SbViewVolume::~SbViewVolume
~SbViewVolume(void)
Definition: SbViewVolume.cpp:175
SbViewVolume::projPoint
SbVec3f projPoint
Definition: SbViewVolume.h:110
SbViewVolume::zVector
SbVec3f zVector(void) const
Definition: SbViewVolume.cpp:517
SbViewVolume::SbViewVolume
SbViewVolume(void)
Definition: SbViewVolume.cpp:168
SbVec2f
The SbVec2f class is a 2 dimensional vector with floating point coordinates.
Definition: SbVec2f.h:36
SbMatrix
The SbMatrix class is a 4x4 dimensional representation of a matrix.
Definition: SbMatrix.h:37
SbViewVolume::projectPointToLine
void projectPointToLine(const SbVec2f &pt, SbLine &line) const
Definition: SbViewVolume.cpp:232
SbViewVolume::frustum
void frustum(float left, float right, float bottom, float top, float nearval, float farval)
Definition: SbViewVolume.cpp:468
SbViewVolume::projectBox
SbVec2f projectBox(const SbBox3f &box) const
Definition: SbViewVolume.cpp:364
SbViewVolume::getWidth
float getWidth(void) const
Definition: SbViewVolume.cpp:631
SbViewVolume::getMatrices
void getMatrices(SbMatrix &affine, SbMatrix &proj) const
Definition: SbViewVolume.cpp:185
SbViewVolume::outsideTest
SbBool outsideTest(const SbPlane &p, const SbVec3f &bmin, const SbVec3f &bmax) const
Definition: SbViewVolume.cpp:813
SbViewVolume::getWorldToScreenScale
float getWorldToScreenScale(const SbVec3f &worldCenter, float normRadius) const
Definition: SbViewVolume.cpp:352
SbVec3d
The SbVec3d class is a 3 dimensional vector with double precision floating point coordinates.
Definition: SbVec3d.h:35
SbBox3f::getMin
const SbVec3f & getMin(void) const
Definition: SbBox3f.cpp:122
SbBox3f
The SbBox3f class is an abstraction for an axis aligned 3 dimensional box.
Definition: SbBox3f.h:37
SbViewVolume::getProjectionDirection
const SbVec3f & getProjectionDirection(void) const
Definition: SbViewVolume.cpp:609
SbViewVolume::nearToFar
float nearToFar
Definition: SbViewVolume.h:113
SbViewVolume::getNearDist
float getNearDist(void) const
Definition: SbViewVolume.cpp:620
SbViewVolume::type
ProjectionType type
Definition: SbViewVolume.h:109
SbViewVolume::getProjectionPoint
const SbVec3f & getProjectionPoint(void) const
Definition: SbViewVolume.cpp:597
SbViewVolume::ProjectionType
ProjectionType
Definition: SbViewVolume.h:43
SbBox3f::getMax
const SbVec3f & getMax(void) const
Definition: SbBox3f.cpp:134
SbViewVolume::scaleHeight
void scaleHeight(float ratio)
Definition: SbViewVolume.cpp:575
SbViewVolume::perspective
void perspective(float fovy, float aspect, float nearval, float farval)
Definition: SbViewVolume.cpp:448
SbDPMatrix
The SbDPMatrix class is a 4x4 dimensional representation of a double-precision matrix.
Definition: SbDPMatrix.h:38
SbViewVolume::llf
SbVec3f llf
Definition: SbViewVolume.h:114
SbViewVolume::getPlane
SbPlane getPlane(const float distFromEye) const
Definition: SbViewVolume.cpp:293
SbViewVolume::getProjectionType
ProjectionType getProjectionType(void) const
Definition: SbViewVolume.cpp:588
SbViewVolume::lrf
SbVec3f lrf
Definition: SbViewVolume.h:115
SbViewVolume::rotateCamera
void rotateCamera(const SbRotation &q)
Definition: SbViewVolume.cpp:482
SbViewVolume::nearDist
float nearDist
Definition: SbViewVolume.h:112
SbViewVolume::getCameraSpaceMatrix
SbMatrix getCameraSpaceMatrix(void) const
Definition: SbViewVolume.cpp:218
SbViewVolume::scaleWidth
void scaleWidth(float ratio)
Definition: SbViewVolume.cpp:562
SbVec3f
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition: SbVec3f.h:37
SbViewVolume::ortho
void ortho(float left, float right, float bottom, float top, float nearval, float farval)
Definition: SbViewVolume.cpp:430
SbVec2d
The SbVec2d class is a 2 dimensional vector with double precision floating point coordinates.
Definition: SbVec2d.h:36
SbViewVolume::zNarrow
SbViewVolume zNarrow(float nearval, float farval) const
Definition: SbViewVolume.cpp:533
SbViewVolume::narrow
SbViewVolume narrow(float left, float bottom, float right, float top) const
Definition: SbViewVolume.cpp:386
SbViewVolume::getDepth
float getDepth(void) const
Definition: SbViewVolume.cpp:654
SbPlane::isInHalfSpace
SbBool isInHalfSpace(const SbVec3f &point) const
Definition: SbPlane.cpp:229
SbViewVolume::getMatrix
SbMatrix getMatrix(void) const
Definition: SbViewVolume.cpp:199
SbViewVolume::projectToScreen
void projectToScreen(const SbVec3f &src, SbVec3f &dst) const
Definition: SbViewVolume.cpp:277
SbViewVolume::transform
void transform(const SbMatrix &matrix)
Definition: SbViewVolume.cpp:708
SbMatrix::getValue
const SbMat & getValue(void) const
Definition: SbMatrix.cpp:255
SbLine
The SbLine class represents a line in 3D space.
Definition: SbLine.h:32
SbViewVolume
The SbViewVolume class is a viewing volume in 3D space.
Definition: SbViewVolume.h:41
SbVec3f::print
void print(FILE *fp) const
Definition: SbVec3f.cpp:761
SbLine::setValue
void setValue(const SbVec3f &origin, const SbVec3f &point)
Definition: SbLine.cpp:88
SbViewVolume::getViewUp
SbVec3f getViewUp(void) const
Definition: SbViewVolume.cpp:723
SbViewVolume::getAlignRotation
SbRotation getAlignRotation(SbBool rightAngleOnly=0) const
Definition: SbViewVolume.cpp:334
SbViewVolume::projDir
SbVec3f projDir
Definition: SbViewVolume.h:111
SbLine::getClosestPoints
SbBool getClosestPoints(const SbLine &line2, SbVec3f &ptOnThis, SbVec3f &ptOnLine2) const
Definition: SbLine.cpp:119
SbViewVolume::getHeight
float getHeight(void) const
Definition: SbViewVolume.cpp:642
SbBox3f::extendBy
void extendBy(const SbVec3f &point)
Definition: SbBox3f.cpp:178
SbViewVolume::ulf
SbVec3f ulf
Definition: SbViewVolume.h:116
SbPlane
The SbPlane class represents a plane in 3D space.
Definition: SbPlane.h:34
SbViewVolume::intersect
SbBool intersect(const SbVec3f &p) const
Definition: SbViewVolume.cpp:735
SbViewVolume::getViewVolumePlanes
void getViewVolumePlanes(SbPlane planes[6]) const
Definition: SbViewVolume.cpp:699
SbViewVolume::print
void print(FILE *fp) const
Definition: SbViewVolume.cpp:664
SbViewVolume::scale
void scale(float factor)
Definition: SbViewVolume.cpp:549

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

Generated on Wed Jul 24 2019 for Coin by Doxygen. 1.8.17