blob: 563984f4047556526ed653c6ef63456ee831e5c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
//-- File : IntCurveSurface_SurfaceTool.gxx
//-- Created : Wed Jui 7 18:00:00 1993
//-- Author : Laurent BUCHARD
//-- <lbr@nonox>
//-- Copyright: Matra Datavision 1993
#include TheSurface_hxx
Standard_Integer IntCurveSurface_SurfaceTool::NbSamplesU(const TheSurface& S) {
Standard_Integer nbs;
GeomAbs_SurfaceType typS = S.GetType();
switch(typS) {
case GeomAbs_Plane:
{
nbs = 2;
}
break;
case GeomAbs_BezierSurface:
{
nbs = 3 + S.NbUPoles();
}
break;
case GeomAbs_BSplineSurface:
{
nbs = S.NbUKnots();
nbs*= S.UDegree();
if(nbs < 2) nbs=2;
}
break;
case GeomAbs_Torus:
{
nbs = 20;
}
break;
case GeomAbs_Cylinder:
case GeomAbs_Cone:
case GeomAbs_Sphere:
case GeomAbs_SurfaceOfRevolution:
case GeomAbs_SurfaceOfExtrusion:
{
nbs = 10;
}
break;
default:
{
nbs = 10;
}
break;
}
return(nbs);
}
Standard_Integer IntCurveSurface_SurfaceTool::NbSamplesV(const TheSurface& S) {
Standard_Integer nbs;
GeomAbs_SurfaceType typS = S.GetType();
switch(typS) {
case GeomAbs_Plane:
{
nbs = 2;
}
break;
case GeomAbs_BezierSurface:
{
nbs = 3 + S.NbVPoles();
}
break;
case GeomAbs_BSplineSurface:
{
nbs = S.NbVKnots();
nbs*= S.VDegree();
if(nbs < 2) nbs=2;
}
break;
case GeomAbs_Cylinder:
case GeomAbs_Cone:
case GeomAbs_Sphere:
case GeomAbs_Torus:
case GeomAbs_SurfaceOfRevolution:
case GeomAbs_SurfaceOfExtrusion:
{
nbs = 15;
}
break;
default:
{
nbs = 10;
}
break;
}
return(nbs);
}
Standard_Integer IntCurveSurface_SurfaceTool::NbSamplesU(const TheSurface& S,
const Standard_Real u1,
const Standard_Real u2) {
Standard_Integer nbs = NbSamplesU(S);
Standard_Integer n = nbs;
if(nbs>10) {
Standard_Real uf = FirstUParameter(S);
Standard_Real ul = LastUParameter(S);
n*= (Standard_Integer)((u2-u1)/(uf-ul));
if(n>nbs) n = nbs;
if(n<5) n = 5;
}
return(n);
}
Standard_Integer IntCurveSurface_SurfaceTool::NbSamplesV(const TheSurface& S,
const Standard_Real v1,
const Standard_Real v2) {
Standard_Integer nbs = NbSamplesV(S);
Standard_Integer n = nbs;
if(nbs>10) {
Standard_Real vf = FirstVParameter(S);
Standard_Real vl = LastVParameter(S);
n*= (Standard_Integer)((v2-v1)/(vf-vl));
if(n>nbs) n = nbs;
if(n<5) n = 5;
}
return(n);
}
|