0022627: Change OCCT memory management defaults
[occt.git] / src / Geom2dInt / Geom2dInt_CurveTool.gxx
CommitLineData
7fd59977 1
2// File: Geom2dInt_CurveTool.gxx
3// Created: Thu Oct 22 12:09:58 1992
4// Author: Laurent BUCHARD
5// <lbr@sdsun2>
6//-Copyright: Matra Datavision 1992
7
8
9#include <GeomAbs_CurveType.hxx>
10#include <Handle_Geom2d_BezierCurve.hxx>
11#include <Handle_Geom2d_BSplineCurve.hxx>
12#include <Geom2d_BezierCurve.hxx>
13#include <Geom2d_BSplineCurve.hxx>
14
15//============================================================
16Standard_Integer Geom2dInt_CurveTool::NbSamples (const IntCurveCurve& 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 Standard_Real t=C.LastParameter()-C.FirstParameter();
29 Standard_Real t1=U1-U0;
30 if(t1<0.0) t1=-t1;
31 nbs = C.NbKnots();
32 nbs*= C.Degree();
33 nbs*= (t1/t);
34 if(nbs < 4.0) nbs=4;
35 }
36 //// modified by jgv, 20.02.02 for bug OCC165 ////
37 else if (typC == GeomAbs_OtherCurve)
38 nbs = 20;
39 //////////////////////////////////////////////////
40
41 if(nbs>300)
42 nbs = 300;
43 return((Standard_Integer)nbs);
44}
45//============================================================
46Standard_Integer Geom2dInt_CurveTool::NbSamples (const IntCurveCurve& C) {
47 GeomAbs_CurveType typC = C.GetType();
48 static Standard_Real nbsOther = 10.0;
49 Standard_Real nbs = nbsOther;
50
51 if(typC == GeomAbs_Line)
52 nbs = 2;
53 else if(typC == GeomAbs_BezierCurve)
54 nbs = 3 + C.NbPoles();
55 else if(typC == GeomAbs_BSplineCurve) {
56 nbs = C.NbKnots();
57 nbs*= C.Degree();
58 if(nbs < 2.0) nbs=2;
59 }
60 //// modified by jgv, 20.02.02 for bug OCC165 ////
61 else if (typC == GeomAbs_OtherCurve)
62 nbs = 20;
63 //////////////////////////////////////////////////
64
65 if(nbs>300)
66 nbs = 300;
67 return((Standard_Integer)nbs);
68}
69
70
71
72