1 // Created on: 1992-07-09
2 // Created by: Christophe MARION
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
22 #include <Standard_NoSuchObject.hxx>
26 #include <V3d_View.hxx>
29 //=======================================================================
30 //function : Perspective
32 //=======================================================================
34 inline Standard_Boolean Select3D_Projector::Perspective() const
37 //=======================================================================
38 //function : Transformation
40 //=======================================================================
42 inline const gp_GTrsf& Select3D_Projector::Transformation() const
45 //=======================================================================
46 //function : InvertedTransformation
48 //=======================================================================
50 inline const gp_GTrsf& Select3D_Projector::InvertedTransformation() const
53 //=======================================================================
54 //function : FullTransformation
56 //=======================================================================
58 inline const gp_Trsf& Select3D_Projector::FullTransformation() const
59 { return myScaledTrsf; }
61 //=======================================================================
64 //=======================================================================
66 inline Standard_Real Select3D_Projector::Focus() const
68 Standard_NoSuchObject_Raise_if(!myPersp,
69 "Select3D_Projector::Not a Perpective");
73 //=======================================================================
74 //function : Transform
76 //=======================================================================
78 inline void Select3D_Projector::Transform (gp_Vec& D) const
80 gp_XYZ coord = D.XYZ();
81 if (myGTrsf.Form() == gp_Identity || myGTrsf.Form() == gp_Translation) { }
82 else if (myGTrsf.Form() == gp_PntMirror) { coord.Reverse(); }
83 else { coord.Multiply (myGTrsf.VectorialPart()); }
87 //=======================================================================
88 //function : Transform
90 //=======================================================================
92 inline void Select3D_Projector::Transform (gp_Pnt& Pnt) const
94 gp_XYZ xyz = Pnt.XYZ();
95 myGTrsf.Transforms(xyz);
100 inline const Handle(V3d_View)& Select3D_Projector::View() const
103 inline void Select3D_Projector::Transform (gp_Lin& Lin, const gp_GTrsf& T) const
105 gp_Ax1 ax1 = Lin.Position();
106 gp_XYZ xyz = ax1.Location().XYZ();
108 ax1.SetLocation(gp_Pnt(xyz));
109 gp_Dir dir = ax1.Direction();
110 gp_XYZ coord = dir.XYZ();
111 if (T.Form() == gp_Identity || T.Form() == gp_Translation) { }
112 else if (T.Form() == gp_PntMirror) { coord.Reverse(); }
114 coord.Multiply (T.VectorialPart());
115 Standard_Real D = coord.Modulus();
119 ax1.SetDirection(dir);
120 Lin.SetPosition(ax1);
123 inline void Select3D_Projector::Transform (gp_Pnt& Pnt, const gp_GTrsf& T) const
125 gp_XYZ xyz = Pnt.XYZ();