OpenLexocad  27.1
ViewProj.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (c) 2005 Imetric 3D GmbH *
3  * *
4  * This file is part of the FreeCAD CAx development system. *
5  * *
6  * This library is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Library General Public *
8  * License as published by the Free Software Foundation; either *
9  * version 2 of the License, or (at your option) any later version. *
10  * *
11  * This library is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU Library General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Library General Public *
17  * License along with this library; see the file COPYING.LIB. If not, *
18  * write to the Free Software Foundation, Inc., 59 Temple Place, *
19  * Suite 330, Boston, MA 02111-1307, USA *
20  * *
21  ***************************************************************************/
22 
23 
24 #ifndef BASE_VIEWPROJ_H
25 #define BASE_VIEWPROJ_H
26 
27 #include <Base/Vector3D.h>
28 #include <Base/Matrix.h>
29 
30 
31 namespace Base {
32 
36 class LX_BASE_EXPORT ViewProjMethod
37 {
38 public:
39  virtual ~ViewProjMethod(){}
40  virtual bool isValid() const { return true; }
42  virtual Vector3f operator()(const Vector3f &rclPt) const = 0;
44  virtual Vector3d operator()(const Vector3d &rclPt) const = 0;
46  virtual Vector3f inverse (const Vector3f &rclPt) const = 0;
48  virtual Vector3d inverse (const Vector3d &rclPt) const = 0;
50  virtual Matrix4D getProjectionMatrix (void) const = 0;
52  Matrix4D getComposedProjectionMatrix (void) const;
54  void setTransform(const Base::Matrix4D&);
55  const Base::Matrix4D& getTransform() const {
56  return transform;
57  }
58 
59 protected:
61  void transformInput(const Base::Vector3f&, Base::Vector3f&) const;
62  void transformInput(const Base::Vector3d&, Base::Vector3d&) const;
63 
64 private:
65  bool hasTransform;
67 };
68 
73 class LX_BASE_EXPORT ViewProjMatrix : public ViewProjMethod
74 {
75 public:
76  ViewProjMatrix (const Matrix4D &rclMtx);
77  virtual ~ViewProjMatrix();
78 
79  Vector3f operator()(const Vector3f &rclPt) const;
80  Vector3d operator()(const Vector3d &rclPt) const;
81  Vector3f inverse (const Vector3f &rclPt) const;
82  Vector3d inverse (const Vector3d &rclPt) const;
83 
84  Matrix4D getProjectionMatrix (void) const;
85 
86 protected:
89 };
90 
97 class LX_BASE_EXPORT ViewOrthoProjMatrix : public ViewProjMethod
98 {
99 public:
100  ViewOrthoProjMatrix (const Matrix4D &rclMtx);
101  virtual ~ViewOrthoProjMatrix();
102 
103  Vector3f operator()(const Vector3f &rclPt) const;
104  Vector3d operator()(const Vector3d &rclPt) const;
105  Vector3f inverse (const Vector3f &rclPt) const;
106  Vector3d inverse (const Vector3d &rclPt) const;
107 
108  Matrix4D getProjectionMatrix (void) const;
109 
110 protected:
112 };
113 
114 } // namespace Base
115 
116 #endif // BASE_VIEWPROJ_H
Definition: ViewProj.h:36
const Base::Matrix4D & getTransform() const
Definition: ViewProj.h:55
Matrix4D _clMtxInv
Definition: ViewProj.h:88
bool isOrthographic
Definition: ViewProj.h:87
Definition: ViewProj.h:97
virtual bool isValid() const
Definition: ViewProj.h:40
void transform(Container container, OutputIt out, BinaryFunction function)
Definition: Algorithms.h:29
Definition: ViewProj.h:73
virtual ~ViewProjMethod()
Definition: ViewProj.h:39
Definition: Matrix.h:38
Matrix4D _clMtxInv
Definition: ViewProj.h:111
Definition: AbstractXMLReader.h:5
Definition: Vector3D.h:78