0024624: Lost word in license statement in source files
[occt.git] / src / BRep / BRep_CurveOnSurface.cxx
1 // Created on: 1993-07-06
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1993-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 #include <BRep_CurveOnSurface.ixx>
18 #include <Precision.hxx>
19
20
21 //=======================================================================
22 //function : BRep_CurveOnSurface
23 //purpose  : 
24 //=======================================================================
25
26 BRep_CurveOnSurface::BRep_CurveOnSurface(const Handle(Geom2d_Curve)& PC, 
27                                          const Handle(Geom_Surface)& S, 
28                                          const TopLoc_Location& L) :
29        BRep_GCurve(L,PC->FirstParameter(),PC->LastParameter()),
30        myPCurve(PC),
31        mySurface(S)
32 {
33 }
34
35
36 //=======================================================================
37 //function : D0
38 //purpose  : 
39 //=======================================================================
40
41 void BRep_CurveOnSurface::D0(const Standard_Real U, gp_Pnt& P) const
42 {
43   // shoud be D0 NYI
44   gp_Pnt2d P2d = myPCurve->Value(U);
45   P = mySurface->Value(P2d.X(),P2d.Y());
46   P.Transform(myLocation.Transformation());
47 }
48
49 //=======================================================================
50 //function : IsCurveOnSurface
51 //purpose  : 
52 //=======================================================================
53
54 Standard_Boolean  BRep_CurveOnSurface::IsCurveOnSurface()const 
55 {
56   return Standard_True;
57 }
58
59 //=======================================================================
60 //function : IsCurveOnSurface
61 //purpose  : 
62 //=======================================================================
63
64 Standard_Boolean  BRep_CurveOnSurface::IsCurveOnSurface
65   (const Handle(Geom_Surface)& S, const TopLoc_Location& L)const 
66 {
67   return (S == mySurface) && (L == myLocation);
68 }
69
70
71
72 //=======================================================================
73 //function : Surface
74 //purpose  : 
75 //=======================================================================
76
77 const Handle(Geom_Surface)&  BRep_CurveOnSurface::Surface()const 
78 {
79   return mySurface;
80 }
81
82
83 //=======================================================================
84 //function : PCurve
85 //purpose  : 
86 //=======================================================================
87
88 const Handle(Geom2d_Curve)&  BRep_CurveOnSurface::PCurve()const 
89 {
90   return myPCurve;
91 }
92
93 //=======================================================================
94 //function : PCurve
95 //purpose  : 
96 //=======================================================================
97
98 void  BRep_CurveOnSurface::PCurve(const Handle(Geom2d_Curve)& C)
99 {
100   myPCurve = C;
101 }
102
103
104 //=======================================================================
105 //function : Copy
106 //purpose  : 
107 //=======================================================================
108
109 Handle(BRep_CurveRepresentation) BRep_CurveOnSurface::Copy() const
110 {
111   Handle(BRep_CurveOnSurface) C = new BRep_CurveOnSurface(myPCurve,
112                                                           mySurface,
113                                                           Location());
114  
115   C->SetRange(First(),Last());
116   C->SetUVPoints(myUV1,myUV2);
117
118   return C;
119 }
120
121
122 //=======================================================================
123 //function : Update
124 //purpose  : 
125 //=======================================================================
126
127 void  BRep_CurveOnSurface::Update()
128 {
129   Standard_Real f = First();
130   Standard_Real l = Last();
131   Standard_Boolean isneg = Precision::IsNegativeInfinite(f);
132   Standard_Boolean ispos = Precision::IsPositiveInfinite(l);
133   if (!isneg) {
134     myPCurve->D0(f,myUV1);
135   }
136   if (!ispos) {
137     myPCurve->D0(l,myUV2);
138   }
139 }
140
141