1 // Created on: 1992-03-12
2 // Created by: Christophe MARION
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _HLRAlgo_Projector_HeaderFile
18 #define _HLRAlgo_Projector_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Integer.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <Standard_Real.hxx>
27 #include <gp_Trsf.hxx>
28 #include <gp_Vec2d.hxx>
29 class Standard_NoSuchObject;
39 //! Implements a projector object.
40 //! To transform and project Points and Planes.
41 //! This object is designed to be used in the
42 //! removal of hidden lines and is returned by the
43 //! Prs3d_Projector::Projector function.
44 //! You define the projection of the selected shape
45 //! by calling one of the following functions:
46 //! - HLRBRep_Algo::Projector, or
47 //! - HLRBRep_PolyAlgo::Projector
48 //! The choice depends on the algorithm, which you are using.
49 //! The parameters of the view are defined at the
50 //! time of construction of a Prs3d_Projector object.
51 class HLRAlgo_Projector
58 Standard_EXPORT HLRAlgo_Projector();
60 //! Creates an axonometric projector. <CS> is the
61 //! viewing coordinate system.
62 Standard_EXPORT HLRAlgo_Projector(const gp_Ax2& CS);
64 //! Creates a perspective projector. <CS> is the
65 //! viewing coordinate system.
66 Standard_EXPORT HLRAlgo_Projector(const gp_Ax2& CS, const Standard_Real Focus);
68 //! build a Projector with automatic minmax directions.
69 Standard_EXPORT HLRAlgo_Projector(const gp_Trsf& T, const Standard_Boolean Persp, const Standard_Real Focus);
71 //! build a Projector with given minmax directions.
72 Standard_EXPORT HLRAlgo_Projector(const gp_Trsf& T, const Standard_Boolean Persp, const Standard_Real Focus, const gp_Vec2d& v1, const gp_Vec2d& v2, const gp_Vec2d& v3);
74 Standard_EXPORT void Set (const gp_Trsf& T, const Standard_Boolean Persp, const Standard_Real Focus);
76 void Directions (gp_Vec2d& D1, gp_Vec2d& D2, gp_Vec2d& D3) const;
78 //! to compute with the given scale and translation.
79 Standard_EXPORT void Scaled (const Standard_Boolean On = Standard_False);
81 //! Returns True if there is a perspective transformation.
82 Standard_Boolean Perspective() const;
84 //! Returns the active transformation.
85 Standard_EXPORT const gp_Trsf& Transformation() const;
87 //! Returns the active inverted transformation.
88 const gp_Trsf& InvertedTransformation() const;
90 //! Returns the original transformation.
91 const gp_Trsf& FullTransformation() const;
93 //! Returns the focal length.
94 Standard_Real Focus() const;
96 void Transform (gp_Vec& D) const;
98 void Transform (gp_Pnt& Pnt) const;
100 //! Transform and apply perspective if needed.
101 Standard_EXPORT void Project (const gp_Pnt& P, gp_Pnt2d& Pout) const;
103 //! Transform and apply perspective if needed.
104 Standard_EXPORT void Project (const gp_Pnt& P, Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const;
106 //! Transform and apply perspective if needed.
107 Standard_EXPORT void Project (const gp_Pnt& P, const gp_Vec& D1, gp_Pnt2d& Pout, gp_Vec2d& D1out) const;
109 //! return a line going through the eye towards the
111 Standard_EXPORT gp_Lin Shoot (const Standard_Real X, const Standard_Real Y) const;
125 Standard_EXPORT void SetDirection();
128 Standard_Integer myType;
129 Standard_Boolean myPersp;
130 Standard_Real myFocus;
131 gp_Trsf myScaledTrsf;
142 #include <HLRAlgo_Projector.lxx>
148 #endif // _HLRAlgo_Projector_HeaderFile