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.
17 #include <gce_MakeLin2d.ixx>
19 #include <StdFail_NotDone.hxx>
21 //=========================================================================
22 // Creation d une ligne 2d de gp a partir d un Ax2d de gp. +
23 //=========================================================================
25 gce_MakeLin2d::gce_MakeLin2d(const gp_Ax2d& A)
27 TheLin2d = gp_Lin2d(A);
31 //=========================================================================
32 // Creation d une ligne 2d de gp a partir de son origine P (Pnt2d de gp)+
33 // et d une direction V (Dir2d de gp). +
34 //=========================================================================
36 gce_MakeLin2d::gce_MakeLin2d(const gp_Pnt2d& P,
39 TheLin2d = gp_Lin2d(P,V);
43 //=========================================================================
44 // Creation d une ligne 2d de gp a partir des parametres de son +
46 //=========================================================================
48 gce_MakeLin2d::gce_MakeLin2d(const Standard_Real A,
49 const Standard_Real B,
50 const Standard_Real C)
52 if (A*A + B*B <= gp::Resolution()) {
53 TheError = gce_NullAxis;
56 TheLin2d = gp_Lin2d(A,B,C);
61 //=========================================================================
62 // Creation d une ligne 2d de gp passant par les deux points <P1> et +
64 //=========================================================================
66 gce_MakeLin2d::gce_MakeLin2d(const gp_Pnt2d& P1,
69 if (P1.Distance(P2) >= gp::Resolution()) {
70 TheLin2d = gp_Lin2d(P1,gp_Dir2d(P2.XY()-P1.XY()));
74 TheError = gce_ConfusedPoints;
78 //=========================================================================
79 // Creation d une ligne 2d de gp <TheLine> parallele a une autre ligne +
80 // <Line1> passant par le point <Point1>. +
81 //=========================================================================
83 gce_MakeLin2d::gce_MakeLin2d(const gp_Lin2d& Line,
84 const gp_Pnt2d& Point)
86 TheLin2d = gp_Lin2d(Point,Line.Direction());
90 //=========================================================================
91 // Creation d une ligne 2d de gp <TheLine> parallele a une autre ligne +
92 // <Line1> a une distance <Dist1>. +
93 //=========================================================================
95 gce_MakeLin2d::gce_MakeLin2d(const gp_Lin2d& Line,
96 const Standard_Real Dist)
98 gp_Pnt2d Point(Line.Location().XY()+
99 Dist*gp_XY(-Line.Direction().Y(),Line.Direction().X()));
100 TheLin2d = gp_Lin2d(Point,Line.Direction());
104 gp_Lin2d gce_MakeLin2d::Value() const
106 StdFail_NotDone_Raise_if(TheError != gce_Done,"");
110 gp_Lin2d gce_MakeLin2d::Operator() const
115 gce_MakeLin2d::operator gp_Lin2d () const