7fd59977 |
1 | // File: IntCurveSurface_CurveTool.gxx |
2 | // Created: Mon Jul 17 17:39:39 1995 |
3 | // Author: Modelistation |
4 | // <model@mastox> |
5 | |
6 | #include CurveGen_hxx |
7 | #include <GeomAbs_CurveType.hxx> |
8 | #include <GeomAbs_Shape.hxx> |
9 | #include <Handle_Geom_BezierCurve.hxx> |
10 | #include <Handle_Geom_BSplineCurve.hxx> |
11 | |
12 | #include <TColStd_Array1OfReal.hxx> |
13 | |
14 | |
15 | //============================================================ |
16 | Standard_Integer IntCurveSurface_CurveTool::NbSamples (const CurveGen& C, |
17 | const Standard_Real U0, |
18 | const Standard_Real U1) { |
19 | GeomAbs_CurveType typC = C.GetType(); |
20 | static Standard_Real nbsOther = 10.0; |
21 | Standard_Real nbs = nbsOther; |
22 | |
23 | if(typC == GeomAbs_Line) |
24 | nbs = 2; |
25 | else if(typC == GeomAbs_BezierCurve) |
26 | nbs = 3 + C.NbPoles(); |
27 | else if(typC == GeomAbs_BSplineCurve) { |
28 | nbs = C.NbKnots(); |
29 | nbs*= C.Degree(); |
30 | nbs*= C.LastParameter()- C.FirstParameter(); |
31 | nbs/= U1-U0; |
32 | if(nbs < 2.0) nbs=2; |
33 | } |
34 | if(nbs>50) |
35 | nbs = 50; |
36 | return((Standard_Integer)nbs); |
37 | } |