0027961: Visualization - remove unused and no more working OpenGl_AVIWriter
[occt.git] / src / gce / gce_MakeLin2d.cxx
1 // Created on: 1992-09-02
2 // Created by: Remi GILET
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-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
18 #include <gce_MakeLin2d.hxx>
19 #include <gp.hxx>
20 #include <gp_Ax2d.hxx>
21 #include <gp_Dir2d.hxx>
22 #include <gp_Lin2d.hxx>
23 #include <gp_Pnt2d.hxx>
24 #include <StdFail_NotDone.hxx>
25
26 //=========================================================================
27 //   Creation d une ligne 2d de gp a partir d un Ax2d de gp.              +
28 //=========================================================================
29 gce_MakeLin2d::gce_MakeLin2d(const gp_Ax2d& A)
30 {
31   TheLin2d = gp_Lin2d(A);
32   TheError = gce_Done;
33 }
34
35 //=========================================================================
36 //   Creation d une ligne 2d de gp a partir de son origine P (Pnt2d de gp)+
37 //   et d une direction V (Dir2d de gp).                                  +
38 //=========================================================================
39
40 gce_MakeLin2d::gce_MakeLin2d(const gp_Pnt2d& P,
41                              const gp_Dir2d& V)
42 {
43   TheLin2d = gp_Lin2d(P,V);
44   TheError = gce_Done;
45 }
46
47 //=========================================================================
48 //   Creation d une ligne 2d de gp a partir des parametres de son         +
49 //    equation.                                                           +
50 //=========================================================================
51
52 gce_MakeLin2d::gce_MakeLin2d(const Standard_Real A,
53                              const Standard_Real B,
54                              const Standard_Real C)
55 {
56   if (A*A + B*B <= gp::Resolution()) {
57     TheError = gce_NullAxis;
58   }
59   else {
60     TheLin2d = gp_Lin2d(A,B,C);
61     TheError = gce_Done;
62   }
63 }
64
65 //=========================================================================
66 //   Creation d une ligne 2d de gp passant par les deux points <P1> et    +
67 //   <P2>.                                                                +
68 //=========================================================================
69
70 gce_MakeLin2d::gce_MakeLin2d(const gp_Pnt2d& P1,
71                              const gp_Pnt2d& P2)
72 {
73   if (P1.Distance(P2) >= gp::Resolution()) {
74     TheLin2d = gp_Lin2d(P1,gp_Dir2d(P2.XY()-P1.XY()));
75     TheError = gce_Done;
76   }
77   else { 
78     TheError = gce_ConfusedPoints;
79   }
80 }
81
82 //=========================================================================
83 //   Creation d une ligne 2d de gp <TheLine> parallele a une autre ligne  +
84 //   <Line1> passant par le point <Point1>.                               +
85 //=========================================================================
86
87 gce_MakeLin2d::gce_MakeLin2d(const gp_Lin2d& Line,
88                              const gp_Pnt2d& Point)
89 {
90   TheLin2d = gp_Lin2d(Point,Line.Direction());
91   TheError = gce_Done;
92 }
93
94 //=========================================================================
95 //   Creation d une ligne 2d de gp <TheLine> parallele a une autre ligne  +
96 //   <Line1> a une distance <Dist1>.                                      +
97 //=========================================================================
98
99 gce_MakeLin2d::gce_MakeLin2d(const gp_Lin2d&     Line,
100                              const Standard_Real Dist)
101 {
102   gp_Pnt2d Point(Line.Location().XY()+
103                  Dist*gp_XY(-Line.Direction().Y(),Line.Direction().X()));
104   TheLin2d = gp_Lin2d(Point,Line.Direction());
105   TheError = gce_Done;
106 }
107
108 gp_Lin2d gce_MakeLin2d::Value() const
109
110   StdFail_NotDone_Raise_if(TheError != gce_Done,"");
111   return TheLin2d;
112 }
113
114 gp_Lin2d gce_MakeLin2d::Operator() const 
115 {
116   return Value();
117 }
118
119 gce_MakeLin2d::operator gp_Lin2d () const
120 {
121   return Value();
122 }
123