bda83605 |
1 | // File: HLRAppli_ReflectLines.cxx |
2 | // Created: 05.12.12 12:55:50 |
3 | // Created by: Julia GERASIMOVA |
973c2be1 |
4 | // Copyright (c) 2001-2014 OPEN CASCADE SAS |
bda83605 |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
bda83605 |
7 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
bda83605 |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
bda83605 |
16 | |
17 | #include <HLRAppli_ReflectLines.hxx> |
18 | #include <HLRBRep_Algo.hxx> |
19 | #include <HLRBRep_HLRToShape.hxx> |
20 | #include <BRep_Builder.hxx> |
21 | #include <gp_Ax3.hxx> |
22 | |
23 | //======================================================================= |
24 | //function : HLRAppli_ReflectLines |
25 | //purpose : Constructor |
26 | //======================================================================= |
27 | |
28 | HLRAppli_ReflectLines::HLRAppli_ReflectLines(const TopoDS_Shape& aShape) |
29 | { |
30 | myShape = aShape; |
31 | } |
32 | |
33 | //======================================================================= |
34 | //function : SetAxes |
35 | //purpose : |
36 | //======================================================================= |
37 | |
38 | void HLRAppli_ReflectLines::SetAxes(const Standard_Real Nx, |
39 | const Standard_Real Ny, |
40 | const Standard_Real Nz, |
41 | const Standard_Real XAt, |
42 | const Standard_Real YAt, |
43 | const Standard_Real ZAt, |
44 | const Standard_Real XUp, |
45 | const Standard_Real YUp, |
46 | const Standard_Real ZUp) |
47 | { |
48 | Standard_Boolean IsPerspective = Standard_False; |
49 | Standard_Real aFocus = 1; |
50 | //Prs3d_Projector aPrs3dProjector(IsPerspective, aFocus, Nx, Ny, Nz, XAt, YAt, ZAt, XUp, YUp, ZUp); |
51 | |
52 | gp_Pnt At (XAt,YAt,ZAt); |
53 | gp_Dir Zpers (Nx,Ny,Nz); |
54 | gp_Dir Ypers (XUp,YUp,ZUp); |
55 | gp_Dir Xpers = Ypers.Crossed(Zpers); |
56 | gp_Ax3 Axe (At, Zpers, Xpers); |
57 | gp_Trsf T; |
58 | T.SetTransformation(Axe); |
59 | |
60 | //myProjector = aPrs3dProjector.Projector(); |
61 | myProjector = HLRAlgo_Projector(T,IsPerspective,aFocus); |
62 | } |
63 | |
64 | //======================================================================= |
65 | //function : Perform |
66 | //purpose : |
67 | //======================================================================= |
68 | |
69 | void HLRAppli_ReflectLines::Perform() |
70 | { |
71 | Handle(HLRBRep_Algo) aHLRAlgo = new HLRBRep_Algo(); |
72 | aHLRAlgo->Add( myShape, 0 ); |
73 | aHLRAlgo->Projector( myProjector ); |
74 | aHLRAlgo->Update(); |
75 | aHLRAlgo->Hide(); |
76 | HLRBRep_HLRToShape aHLRToShape( aHLRAlgo ); |
77 | |
78 | myCompound = aHLRToShape.OutLineVCompound3d(); |
79 | } |
80 | |
81 | //======================================================================= |
82 | //function : GetResult |
83 | //purpose : |
84 | //======================================================================= |
85 | |
86 | TopoDS_Shape HLRAppli_ReflectLines::GetResult() const |
87 | { |
88 | return myCompound; |
89 | } |