Warnings on vc14 were eliminated
[occt.git] / src / IntTools / IntTools_CurveRangeSample.cxx
CommitLineData
b311480e 1// Created on: 2005-10-05
2// Created by: Mikhail KLOKOV
973c2be1 3// Copyright (c) 2005-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
42cf5bc1 16
17#include <IntTools_CurveRangeSample.hxx>
18#include <IntTools_Range.hxx>
7fd59977 19
20IntTools_CurveRangeSample::IntTools_CurveRangeSample()
21{
22 myIndex = 0;
23}
24
25IntTools_CurveRangeSample::IntTools_CurveRangeSample(const Standard_Integer theIndex)
26{
27 myIndex = theIndex;
28}
29
30IntTools_Range IntTools_CurveRangeSample::GetRange(const Standard_Real theFirst,
31 const Standard_Real theLast,
32 const Standard_Integer theNbSample) const
33{
34 Standard_Real diffC = theLast - theFirst;
35 IntTools_Range aResult;
36
37 if(GetDepth() <= 0) {
38 aResult.SetFirst(theFirst);
39 aResult.SetLast(theLast);
40 }
41 else {
42 Standard_Real tmp = pow(Standard_Real(theNbSample), Standard_Real(GetDepth()));
43 Standard_Real localdiffC = diffC / Standard_Real(tmp);
44 Standard_Real aFirstC = theFirst + Standard_Real(myIndex) * localdiffC;
45 Standard_Real aLastC = aFirstC + localdiffC;
46 aResult.SetFirst(aFirstC);
47 aResult.SetLast(aLastC);
48 }
49 return aResult;
50}