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
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
9 // under the terms of the GNU Lesser General Public 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 <BRep_CurveOnSurface.ixx>
18 #include <Precision.hxx>
21 //=======================================================================
22 //function : BRep_CurveOnSurface
24 //=======================================================================
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()),
36 //=======================================================================
39 //=======================================================================
41 void BRep_CurveOnSurface::D0(const Standard_Real U, gp_Pnt& P) const
44 gp_Pnt2d P2d = myPCurve->Value(U);
45 P = mySurface->Value(P2d.X(),P2d.Y());
46 P.Transform(myLocation.Transformation());
49 //=======================================================================
50 //function : IsCurveOnSurface
52 //=======================================================================
54 Standard_Boolean BRep_CurveOnSurface::IsCurveOnSurface()const
59 //=======================================================================
60 //function : IsCurveOnSurface
62 //=======================================================================
64 Standard_Boolean BRep_CurveOnSurface::IsCurveOnSurface
65 (const Handle(Geom_Surface)& S, const TopLoc_Location& L)const
67 return (S == mySurface) && (L == myLocation);
72 //=======================================================================
75 //=======================================================================
77 const Handle(Geom_Surface)& BRep_CurveOnSurface::Surface()const
83 //=======================================================================
86 //=======================================================================
88 const Handle(Geom2d_Curve)& BRep_CurveOnSurface::PCurve()const
93 //=======================================================================
96 //=======================================================================
98 void BRep_CurveOnSurface::PCurve(const Handle(Geom2d_Curve)& C)
104 //=======================================================================
107 //=======================================================================
109 Handle(BRep_CurveRepresentation) BRep_CurveOnSurface::Copy() const
111 Handle(BRep_CurveOnSurface) C = new BRep_CurveOnSurface(myPCurve,
115 C->SetRange(First(),Last());
116 C->SetUVPoints(myUV1,myUV2);
122 //=======================================================================
125 //=======================================================================
127 void BRep_CurveOnSurface::Update()
129 Standard_Real f = First();
130 Standard_Real l = Last();
131 Standard_Boolean isneg = Precision::IsNegativeInfinite(f);
132 Standard_Boolean ispos = Precision::IsPositiveInfinite(l);
134 myPCurve->D0(f,myUV1);
137 myPCurve->D0(l,myUV2);