1 // Created by: Laurent BUCHARD
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
17 #include <Adaptor3d_HCurve.hxx>
18 #include <Adaptor3d_HSurface.hxx>
19 #include <BRepAdaptor_Surface.hxx>
20 #include <Geom_BezierSurface.hxx>
21 #include <Geom_BSplineSurface.hxx>
24 #include <HLRBRep_SurfaceTool.hxx>
25 #include <Standard_NoSuchObject.hxx>
26 #include <Standard_OutOfRange.hxx>
28 Standard_Integer HLRBRep_SurfaceTool::NbSamplesU(const Standard_Address S) {
30 GeomAbs_SurfaceType typS = ((BRepAdaptor_Surface *)S)->GetType();
37 case GeomAbs_BezierSurface:
39 nbs = 3 + ((BRepAdaptor_Surface *)S)->NbUPoles();
42 case GeomAbs_BSplineSurface:
44 nbs = ((BRepAdaptor_Surface *)S)->NbUKnots();
45 nbs*= ((BRepAdaptor_Surface *)S)->UDegree();
55 case GeomAbs_Cylinder:
58 case GeomAbs_SurfaceOfRevolution:
59 case GeomAbs_SurfaceOfExtrusion:
74 Standard_Integer HLRBRep_SurfaceTool::NbSamplesV(const Standard_Address S) {
76 GeomAbs_SurfaceType typS = ((BRepAdaptor_Surface *)S)->GetType();
83 case GeomAbs_BezierSurface:
85 nbs = 3 + ((BRepAdaptor_Surface *)S)->NbVPoles();
88 case GeomAbs_BSplineSurface:
90 nbs = ((BRepAdaptor_Surface *)S)->NbVKnots();
91 nbs*= ((BRepAdaptor_Surface *)S)->VDegree();
96 case GeomAbs_Cylinder:
100 case GeomAbs_SurfaceOfRevolution:
101 case GeomAbs_SurfaceOfExtrusion:
116 Standard_Integer HLRBRep_SurfaceTool::NbSamplesU(const Standard_Address S,
117 const Standard_Real u1,
118 const Standard_Real u2) {
119 Standard_Integer nbs = NbSamplesU(S);
120 Standard_Integer n = nbs;
122 Standard_Real uf = FirstUParameter(S);
123 Standard_Real ul = LastUParameter(S);
124 n*= (Standard_Integer)((u2-u1)/(uf-ul));
131 Standard_Integer HLRBRep_SurfaceTool::NbSamplesV(const Standard_Address S,
132 const Standard_Real v1,
133 const Standard_Real v2) {
134 Standard_Integer nbs = NbSamplesV(S);
135 Standard_Integer n = nbs;
137 Standard_Real vf = FirstVParameter(S);
138 Standard_Real vl = LastVParameter(S);
139 n*= (Standard_Integer)((v2-v1)/(vf-vl));