Integration of OCCT 6.5.0 from SVN
[occt.git] / src / GC / GC_MakeSegment.cxx
1 // File:        GC_MakeSegment.cxx
2 // Created:     Fri Oct  2 16:37:54 1992
3 // Author:      Remi GILET
4 //              <reg@topsn3>
5
6 #include <GC_MakeSegment.ixx>
7 #include <GC_MakeLine.hxx>
8 #include <Geom_Line.hxx>
9 #include <StdFail_NotDone.hxx>
10 #include <ElCLib.hxx>
11
12 GC_MakeSegment::GC_MakeSegment(const gp_Pnt& P1 ,
13                                  const gp_Pnt& P2 ) 
14 {
15   Standard_Real dist = P1.Distance(P2);
16   Handle(Geom_Line) L = GC_MakeLine(P1,P2);
17   TheSegment = new Geom_TrimmedCurve(L,0.,dist,Standard_True);
18   TheError = gce_Done;
19 }
20
21 GC_MakeSegment::GC_MakeSegment(const gp_Lin& Line    ,
22                                  const gp_Pnt& Point   ,
23                                  const Standard_Real U ) 
24 {
25   Standard_Real Ufirst = ElCLib::Parameter(Line,Point);
26   Handle(Geom_Line) L = new Geom_Line(Line);
27   TheSegment=new Geom_TrimmedCurve(L,Ufirst,U,Standard_True);
28   TheError = gce_Done;
29 }
30
31 GC_MakeSegment::GC_MakeSegment(const gp_Lin& Line  ,
32                                  const gp_Pnt& P1    ,
33                                  const gp_Pnt& P2    ) 
34 {
35   Standard_Real Ufirst = ElCLib::Parameter(Line,P1);
36   Standard_Real Ulast = ElCLib::Parameter(Line,P2);
37   Handle(Geom_Line) L = new Geom_Line(Line);
38   TheSegment = new Geom_TrimmedCurve(L,Ufirst,Ulast,Standard_True);
39   TheError = gce_Done;
40 }
41
42 GC_MakeSegment::GC_MakeSegment(const gp_Lin& Line  ,
43                                  const Standard_Real    U1    ,
44                                  const Standard_Real    U2    ) 
45 {
46   Handle(Geom_Line) L = new Geom_Line(Line);
47   TheSegment = new Geom_TrimmedCurve(L,U1,U2,Standard_True);
48   TheError = gce_Done;
49 }
50
51 const Handle(Geom_TrimmedCurve)& GC_MakeSegment::Value() const
52
53   StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
54   return TheSegment;
55 }
56
57 const Handle(Geom_TrimmedCurve)& GC_MakeSegment::Operator() const 
58 {
59   return Value();
60 }
61
62 GC_MakeSegment::operator Handle(Geom_TrimmedCurve) () const
63 {
64   return Value();
65 }
66