1 // Created by: Laurent BUCHARD
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
21 #include <Adaptor3d_HSurfaceTool.ixx>
23 Standard_Integer Adaptor3d_HSurfaceTool::NbSamplesU(const Handle(Adaptor3d_HSurface)& S)
27 case GeomAbs_Plane: return 2;
28 case GeomAbs_BezierSurface: return (3 + S->NbUPoles());
29 case GeomAbs_BSplineSurface:
31 const Standard_Integer nbs = S->NbUKnots() * S->UDegree();
32 return (nbs < 2 ? 2 : nbs);
34 case GeomAbs_Torus: return 20;
39 Standard_Integer Adaptor3d_HSurfaceTool::NbSamplesV(const Handle(Adaptor3d_HSurface)& S)
43 case GeomAbs_Plane: return 2;
44 case GeomAbs_BezierSurface: return (3 + S->NbVPoles());
45 case GeomAbs_BSplineSurface:
47 const Standard_Integer nbs = S->NbVKnots() * S->VDegree();
48 return (nbs < 2 ? 2 : nbs);
50 case GeomAbs_Cylinder:
54 case GeomAbs_SurfaceOfRevolution:
55 case GeomAbs_SurfaceOfExtrusion: return 15;
60 Standard_Integer Adaptor3d_HSurfaceTool::NbSamplesU(const Handle(Adaptor3d_HSurface)& S,
61 const Standard_Real u1,
62 const Standard_Real u2)
64 const Standard_Integer nbs = NbSamplesU(S);
65 Standard_Integer n = nbs;
68 const Standard_Real uf = FirstUParameter(S);
69 const Standard_Real ul = LastUParameter(S);
70 n *= (Standard_Integer)((u2-u1)/(ul-uf));
71 if (n>nbs || n>50) n = nbs;
77 Standard_Integer Adaptor3d_HSurfaceTool::NbSamplesV(const Handle(Adaptor3d_HSurface)& S,
78 const Standard_Real v1,
79 const Standard_Real v2)
81 const Standard_Integer nbs = NbSamplesV(S);
82 Standard_Integer n = nbs;
85 const Standard_Real vf = FirstVParameter(S);
86 const Standard_Real vl = LastVParameter(S);
87 n *= (Standard_Integer)((v2-v1)/(vl-vf));
88 if (n>nbs || n>50) n = nbs;