summaryrefslogtreecommitdiff
path: root/inc/IntCurveSurface_CurveTool.gxx
blob: 72695b212560fa36bd0327ce6f28f5a72a0e9345 (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
// File:	IntCurveSurface_CurveTool.gxx
// Created:	Mon Jul 17 17:39:39 1995
// Author:	Modelistation
//		<model@mastox>

#include CurveGen_hxx
#include <GeomAbs_CurveType.hxx>
#include <GeomAbs_Shape.hxx>
#include <Handle_Geom_BezierCurve.hxx>
#include <Handle_Geom_BSplineCurve.hxx>

#include <TColStd_Array1OfReal.hxx>


//============================================================
Standard_Integer IntCurveSurface_CurveTool::NbSamples (const CurveGen& C,
						       const Standard_Real U0,
						       const Standard_Real U1) {
  GeomAbs_CurveType typC = C.GetType();
  static Standard_Real nbsOther = 10.0;
  Standard_Real nbs = nbsOther;
  
  if(typC == GeomAbs_Line) 
    nbs = 2;
  else if(typC == GeomAbs_BezierCurve) 
    nbs = 3 + C.NbPoles();
  else if(typC == GeomAbs_BSplineCurve) { 
    nbs = C.NbKnots();
    nbs*= C.Degree();
    nbs*= C.LastParameter()- C.FirstParameter();
    nbs/= U1-U0;
    if(nbs < 2.0) nbs=2;
  }
  if(nbs>50)
    nbs = 50;
  return((Standard_Integer)nbs);
}