Integration of OCCT 6.5.0 from SVN
[occt.git] / src / BRepBlend / BRepBlend_HCurve2dToolGen.gxx
CommitLineData
7fd59977 1// File: BRepBlend_HCurve2dToolGen.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_Geom2d_BezierCurve.hxx>
10#include <Handle_Geom2d_BSplineCurve.hxx>
11
12#include <TColStd_Array1OfReal.hxx>
13
14
15//============================================================
16Standard_Integer BRepBlend_HCurve2dToolGen::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->Bezier()->NbPoles();
27 else if(typC == GeomAbs_BSplineCurve) {
28 Handle(Geom2d_BSplineCurve) BSC = C->BSpline();
29 nbs = BSC->NbKnots();
30 nbs*= BSC->Degree();
31 nbs*= BSC->LastParameter()- BSC->FirstParameter();
32 nbs/= U1-U0;
33 if(nbs < 2.0) nbs=2;
34 }
35 if(nbs>50)
36 nbs = 50;
37 return((Standard_Integer)nbs);
38}