summaryrefslogtreecommitdiff
path: root/inc/BRepBlend_HCurve2dToolGen.gxx
blob: e469a0d111f1a851dfc582247f99cff8758f37e2 (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
// File:	BRepBlend_HCurve2dToolGen.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_Geom2d_BezierCurve.hxx>
#include <Handle_Geom2d_BSplineCurve.hxx>

#include <TColStd_Array1OfReal.hxx>


//============================================================
Standard_Integer BRepBlend_HCurve2dToolGen::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->Bezier()->NbPoles();
  else if(typC == GeomAbs_BSplineCurve) { 
    Handle(Geom2d_BSplineCurve) BSC = C->BSpline();
    nbs = BSC->NbKnots();
    nbs*= BSC->Degree();
    nbs*= BSC->LastParameter()- BSC->FirstParameter();
    nbs/= U1-U0;
    if(nbs < 2.0) nbs=2;
  }
  if(nbs>50)
    nbs = 50;
  return((Standard_Integer)nbs);
}