summaryrefslogtreecommitdiff
path: root/src/GeomLib/GeomLib_LogSample.cxx
blob: 35da9bd141ed38b2c6563903867c2a883afbb8e8 (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
// File:	GeomLib_LogSample.cxx
// Created:	Wed Sep 23 16:56:07 1998
// Author:	Philippe MANGIN
//		<pmn@sgi29>


#include <GeomLib_LogSample.ixx>

#include <Standard_OutOfRange.hxx>


 GeomLib_LogSample::GeomLib_LogSample(const Standard_Real A,
				      const Standard_Real B,
				      const Standard_Integer N)
                   :math_FunctionSample(A, B, N)
{
  myF = A - 1;
  myexp = Log(B-A)/N;
}

Standard_Real GeomLib_LogSample::GetParameter(const Standard_Integer Index) const
{
  Standard_Integer n = NbPoints();
 

  if ((Index >= n) || (Index <= 1)) {
    Standard_Real a, b;
    Bounds(a, b);
    if (Index == 1) return a;
    else if (Index == n) return b;
    else Standard_OutOfRange::Raise("GeomLib_LogSample::GetParameter");
  }

  Standard_Real v = myF + Exp(myexp*Index);
  return v;
}