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 IMPLEMENT_STANDARD_RTTIEXT(GeomEvaluator_SurfaceOfExtrusion,GeomEvaluator_Surface)
21 GeomEvaluator_SurfaceOfExtrusion::GeomEvaluator_SurfaceOfExtrusion(
22 const Handle(Geom_Curve)& theBase, const gp_Dir& theExtrusionDir)
23 : GeomEvaluator_Surface(),
25 myDirection(theExtrusionDir)
29 GeomEvaluator_SurfaceOfExtrusion::GeomEvaluator_SurfaceOfExtrusion(
30 const Handle(Adaptor3d_HCurve)& theBase, const gp_Dir& theExtrusionDir)
31 : GeomEvaluator_Surface(),
32 myBaseAdaptor(theBase),
33 myDirection(theExtrusionDir)
37 void GeomEvaluator_SurfaceOfExtrusion::D0(
38 const Standard_Real theU, const Standard_Real theV,
39 gp_Pnt& theValue) const
41 if (!myBaseAdaptor.IsNull())
42 myBaseAdaptor->D0(theU, theValue);
44 myBaseCurve->D0(theU, theValue);
46 Shift(theV, theValue);
49 void GeomEvaluator_SurfaceOfExtrusion::D1(
50 const Standard_Real theU, const Standard_Real theV,
51 gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V) const
53 if (!myBaseAdaptor.IsNull())
54 myBaseAdaptor->D1(theU, theValue, theD1U);
56 myBaseCurve->D1(theU, theValue, theD1U);
59 Shift(theV, theValue);
62 void GeomEvaluator_SurfaceOfExtrusion::D2(
63 const Standard_Real theU, const Standard_Real theV,
64 gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
65 gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV) const
67 if (!myBaseAdaptor.IsNull())
68 myBaseAdaptor->D2(theU, theValue, theD1U, theD2U);
70 myBaseCurve->D2(theU, theValue, theD1U, theD2U);
73 theD2V.SetCoord(0.0, 0.0, 0.0);
74 theD2UV.SetCoord(0.0, 0.0, 0.0);
76 Shift(theV, theValue);
79 void GeomEvaluator_SurfaceOfExtrusion::D3(
80 const Standard_Real theU, const Standard_Real theV,
81 gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
82 gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
83 gp_Vec& theD3U, gp_Vec& theD3V, gp_Vec& theD3UUV, gp_Vec& theD3UVV) const
85 if (!myBaseAdaptor.IsNull())
86 myBaseAdaptor->D3(theU, theValue, theD1U, theD2U, theD3U);
88 myBaseCurve->D3(theU, theValue, theD1U, theD2U, theD3U);
91 theD2V.SetCoord(0.0, 0.0, 0.0);
92 theD2UV.SetCoord(0.0, 0.0, 0.0);
93 theD3V.SetCoord(0.0, 0.0, 0.0);
94 theD3UUV.SetCoord(0.0, 0.0, 0.0);
95 theD3UVV.SetCoord(0.0, 0.0, 0.0);
97 Shift(theV, theValue);
100 gp_Vec GeomEvaluator_SurfaceOfExtrusion::DN(
101 const Standard_Real theU, const Standard_Real ,
102 const Standard_Integer theDerU, const Standard_Integer theDerV) const
104 Standard_RangeError_Raise_if(theDerU < 0, "GeomEvaluator_SurfaceOfExtrusion::DN(): theDerU < 0");
105 Standard_RangeError_Raise_if(theDerV < 0, "GeomEvaluator_SurfaceOfExtrusion::DN(): theDerV < 0");
106 Standard_RangeError_Raise_if(theDerU + theDerV < 1,
107 "GeomEvaluator_SurfaceOfExtrusion::DN(): theDerU + theDerV < 1");
109 gp_Vec aResult(0.0, 0.0, 0.0);
112 if (!myBaseAdaptor.IsNull())
113 aResult = myBaseAdaptor->DN(theU, theDerU);
115 aResult = myBaseCurve->DN(theU, theDerU);
117 else if (theDerU == 0 && theDerV == 1)
118 aResult = gp_Vec(myDirection);