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