1 // Created on: 2015-09-21
2 // Copyright (c) 2015 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #include <GeomEvaluator_SurfaceOfExtrusion.hxx>
17 #include <GeomAdaptor_HCurve.hxx>
19 GeomEvaluator_SurfaceOfExtrusion::GeomEvaluator_SurfaceOfExtrusion(
20 const Handle(Geom_Curve)& theBase, const gp_Dir& theExtrusionDir)
21 : GeomEvaluator_Surface(),
23 myDirection(theExtrusionDir)
27 GeomEvaluator_SurfaceOfExtrusion::GeomEvaluator_SurfaceOfExtrusion(
28 const Handle(Adaptor3d_HCurve)& theBase, const gp_Dir& theExtrusionDir)
29 : GeomEvaluator_Surface(),
30 myBaseAdaptor(theBase),
31 myDirection(theExtrusionDir)
35 void GeomEvaluator_SurfaceOfExtrusion::D0(
36 const Standard_Real theU, const Standard_Real theV,
37 gp_Pnt& theValue) const
39 if (!myBaseAdaptor.IsNull())
40 myBaseAdaptor->D0(theU, theValue);
42 myBaseCurve->D0(theU, theValue);
44 Shift(theV, theValue);
47 void GeomEvaluator_SurfaceOfExtrusion::D1(
48 const Standard_Real theU, const Standard_Real theV,
49 gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V) const
51 if (!myBaseAdaptor.IsNull())
52 myBaseAdaptor->D1(theU, theValue, theD1U);
54 myBaseCurve->D1(theU, theValue, theD1U);
57 Shift(theV, theValue);
60 void GeomEvaluator_SurfaceOfExtrusion::D2(
61 const Standard_Real theU, const Standard_Real theV,
62 gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
63 gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV) const
65 if (!myBaseAdaptor.IsNull())
66 myBaseAdaptor->D2(theU, theValue, theD1U, theD2U);
68 myBaseCurve->D2(theU, theValue, theD1U, theD2U);
71 theD2V.SetCoord(0.0, 0.0, 0.0);
72 theD2UV.SetCoord(0.0, 0.0, 0.0);
74 Shift(theV, theValue);
77 void GeomEvaluator_SurfaceOfExtrusion::D3(
78 const Standard_Real theU, const Standard_Real theV,
79 gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
80 gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
81 gp_Vec& theD3U, gp_Vec& theD3V, gp_Vec& theD3UUV, gp_Vec& theD3UVV) const
83 if (!myBaseAdaptor.IsNull())
84 myBaseAdaptor->D3(theU, theValue, theD1U, theD2U, theD3U);
86 myBaseCurve->D3(theU, theValue, theD1U, theD2U, theD3U);
89 theD2V.SetCoord(0.0, 0.0, 0.0);
90 theD2UV.SetCoord(0.0, 0.0, 0.0);
91 theD3V.SetCoord(0.0, 0.0, 0.0);
92 theD3UUV.SetCoord(0.0, 0.0, 0.0);
93 theD3UVV.SetCoord(0.0, 0.0, 0.0);
95 Shift(theV, theValue);
98 gp_Vec GeomEvaluator_SurfaceOfExtrusion::DN(
99 const Standard_Real theU, const Standard_Real ,
100 const Standard_Integer theDerU, const Standard_Integer theDerV) const
102 Standard_RangeError_Raise_if(theDerU < 0, "GeomEvaluator_SurfaceOfExtrusion::DN(): theDerU < 0");
103 Standard_RangeError_Raise_if(theDerV < 0, "GeomEvaluator_SurfaceOfExtrusion::DN(): theDerV < 0");
104 Standard_RangeError_Raise_if(theDerU + theDerV < 1,
105 "GeomEvaluator_SurfaceOfExtrusion::DN(): theDerU + theDerV < 1");
107 gp_Vec aResult(0.0, 0.0, 0.0);
110 if (!myBaseAdaptor.IsNull())
111 aResult = myBaseAdaptor->DN(theU, theDerU);
113 aResult = myBaseCurve->DN(theU, theDerU);
115 else if (theDerU == 0 && theDerV == 1)
116 aResult = gp_Vec(myDirection);