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
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.
18 #include <gce_MakeLin2d.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>
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)
31 TheLin2d = gp_Lin2d(A);
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 //=========================================================================
40 gce_MakeLin2d::gce_MakeLin2d(const gp_Pnt2d& P,
43 TheLin2d = gp_Lin2d(P,V);
47 //=========================================================================
48 // Creation d une ligne 2d de gp a partir des parametres de son +
50 //=========================================================================
52 gce_MakeLin2d::gce_MakeLin2d(const Standard_Real A,
53 const Standard_Real B,
54 const Standard_Real C)
56 if (A*A + B*B <= gp::Resolution()) {
57 TheError = gce_NullAxis;
60 TheLin2d = gp_Lin2d(A,B,C);
65 //=========================================================================
66 // Creation d une ligne 2d de gp passant par les deux points <P1> et +
68 //=========================================================================
70 gce_MakeLin2d::gce_MakeLin2d(const gp_Pnt2d& P1,
73 if (P1.Distance(P2) >= gp::Resolution()) {
74 TheLin2d = gp_Lin2d(P1,gp_Dir2d(P2.XY()-P1.XY()));
78 TheError = gce_ConfusedPoints;
82 //=========================================================================
83 // Creation d une ligne 2d de gp <TheLine> parallele a une autre ligne +
84 // <Line1> passant par le point <Point1>. +
85 //=========================================================================
87 gce_MakeLin2d::gce_MakeLin2d(const gp_Lin2d& Line,
88 const gp_Pnt2d& Point)
90 TheLin2d = gp_Lin2d(Point,Line.Direction());
94 //=========================================================================
95 // Creation d une ligne 2d de gp <TheLine> parallele a une autre ligne +
96 // <Line1> a une distance <Dist1>. +
97 //=========================================================================
99 gce_MakeLin2d::gce_MakeLin2d(const gp_Lin2d& Line,
100 const Standard_Real Dist)
102 gp_Pnt2d Point(Line.Location().XY()+
103 Dist*gp_XY(-Line.Direction().Y(),Line.Direction().X()));
104 TheLin2d = gp_Lin2d(Point,Line.Direction());
108 gp_Lin2d gce_MakeLin2d::Value() const
110 StdFail_NotDone_Raise_if(TheError != gce_Done,"");
114 gp_Lin2d gce_MakeLin2d::Operator() const
119 gce_MakeLin2d::operator gp_Lin2d () const