0022627: Change OCCT memory management defaults
[occt.git] / src / IntTools / IntTools_CurveRangeSample.cxx
CommitLineData
7fd59977 1// File: IntTools_CurveRangeSample.cxx
2// Created: Wed Oct 5 17:04:22 2005
3// Author: Mikhail KLOKOV
4// <mkk@kurox>
5
6
7#include <IntTools_CurveRangeSample.ixx>
8
9IntTools_CurveRangeSample::IntTools_CurveRangeSample()
10{
11 myIndex = 0;
12}
13
14IntTools_CurveRangeSample::IntTools_CurveRangeSample(const Standard_Integer theIndex)
15{
16 myIndex = theIndex;
17}
18
19IntTools_Range IntTools_CurveRangeSample::GetRange(const Standard_Real theFirst,
20 const Standard_Real theLast,
21 const Standard_Integer theNbSample) const
22{
23 Standard_Real diffC = theLast - theFirst;
24 IntTools_Range aResult;
25
26 if(GetDepth() <= 0) {
27 aResult.SetFirst(theFirst);
28 aResult.SetLast(theLast);
29 }
30 else {
31 Standard_Real tmp = pow(Standard_Real(theNbSample), Standard_Real(GetDepth()));
32 Standard_Real localdiffC = diffC / Standard_Real(tmp);
33 Standard_Real aFirstC = theFirst + Standard_Real(myIndex) * localdiffC;
34 Standard_Real aLastC = aFirstC + localdiffC;
35 aResult.SetFirst(aFirstC);
36 aResult.SetLast(aLastC);
37 }
38 return aResult;
39}