Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Frustum.h
Go to the documentation of this file.
1 /* Copyright (c) 2014-2016 "Omnidome" by cr8tr
2  * Dome Mapping Projection Software (http://omnido.me).
3  * Omnidome was created by Michael Winkelmann aka Wilston Oreo (@WilstonOreo)
4  *
5  * This file is part of Omnidome.
6  *
7  * Omnidome is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Affero General Public License for more details.
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef OMNI_PROJ_FRUSTUM_H_
21 #define OMNI_PROJ_FRUSTUM_H_
22 
23 #include <QVector3D>
24 #include <QRectF>
25 
26 namespace omni {
27  namespace proj {
28  class Projector;
29 
30  /// Frustum helper struct constructed from a projector
31  class Frustum {
32  public:
33  /// Frustum must be constructed from a projector
34  Frustum(Projector const&);
35 
36  /// Eye position of frustum
37  QVector3D eye() const;
38 
39  /// Vector of top left corner
40  QVector3D topLeft() const;
41 
42  /// Vector of top left corner, transformed by matrix
43  QVector3D topLeft(QMatrix4x4 const&) const;
44 
45  /// Vector of top right corner
46  QVector3D topRight() const;
47 
48  /// Vector of top right corner, transformed by matrix
49  QVector3D topRight(QMatrix4x4 const&) const;
50 
51  /// Vector of bottom left corner
52  QVector3D bottomLeft() const;
53 
54  /// Vector of bottom left corner, transformed by matrix
55  QVector3D bottomLeft(QMatrix4x4 const&) const;
56 
57  /// Vector of bottom right corner
58  QVector3D bottomRight() const;
59 
60  /// Vector of bottom right corner, transformed by matrix
61  QVector3D bottomRight(QMatrix4x4 const&) const;
62 
63  /// Return frustum rectangle
64  QRectF rect() const;
65 
66  /// Return frustum rectangle, multiplied by near and far values
67  QRectF rect(float _near,
68  float _far) const;
69 
70  private:
71  Projector const& proj_;
72  };
73  }
74 }
75 
76 #endif /* OMNI_PROJ_FRUSTUM_H_ */
A projector with a transformation matrix and setup.
Definition: Projector.h:32
QVector3D bottomLeft() const
Vector of bottom left corner.
Definition: Frustum.cpp:39
QVector3D bottomRight() const
Vector of bottom right corner.
Definition: Frustum.cpp:43
QVector3D topRight() const
Vector of top right corner.
Definition: Frustum.cpp:35
Frustum(Projector const &)
Frustum must be constructed from a projector.
Definition: Frustum.cpp:25
QRectF rect() const
Return frustum rectangle.
Definition: Frustum.cpp:63
Projector const & proj_
Definition: Frustum.h:71
Frustum helper struct constructed from a projector.
Definition: Frustum.h:31
QVector3D topLeft() const
Vector of top left corner.
Definition: Frustum.cpp:31
QVector3D eye() const
Eye position of frustum.
Definition: Frustum.cpp:27