0026747: Some constructors of gp_Parab2d class contain redundant parameters
[occt.git] / src / gce / gce_MakeLin2d.cxx
CommitLineData
b311480e 1// Created on: 1992-09-02
2// Created by: Remi GILET
3// Copyright (c) 1992-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
42cf5bc1 17
18#include <gce_MakeLin2d.hxx>
7fd59977 19#include <gp.hxx>
42cf5bc1 20#include <gp_Ax2d.hxx>
21#include <gp_Dir2d.hxx>
22#include <gp_Lin2d.hxx>
23#include <gp_Pnt2d.hxx>
7fd59977 24#include <StdFail_NotDone.hxx>
25
26//=========================================================================
27// Creation d une ligne 2d de gp a partir d un Ax2d de gp. +
28//=========================================================================
7fd59977 29gce_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
40gce_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
52gce_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
70gce_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
87gce_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
99gce_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
108gp_Lin2d gce_MakeLin2d::Value() const
109{
82fc327c 110 StdFail_NotDone_Raise_if(TheError != gce_Done,"");
7fd59977 111 return TheLin2d;
112}
113
114gp_Lin2d gce_MakeLin2d::Operator() const
115{
116 return Value();
117}
118
119gce_MakeLin2d::operator gp_Lin2d () const
120{
121 return Value();
122}
123