7fd59977 |
1 | // File: GeomLib_LogSample.cxx |
2 | // Created: Wed Sep 23 16:56:07 1998 |
3 | // Author: Philippe MANGIN |
4 | // <pmn@sgi29> |
5 | |
6 | |
7 | #include <GeomLib_LogSample.ixx> |
8 | |
9 | #include <Standard_OutOfRange.hxx> |
10 | |
11 | |
12 | GeomLib_LogSample::GeomLib_LogSample(const Standard_Real A, |
13 | const Standard_Real B, |
14 | const Standard_Integer N) |
15 | :math_FunctionSample(A, B, N) |
16 | { |
17 | myF = A - 1; |
18 | myexp = Log(B-A)/N; |
19 | } |
20 | |
21 | Standard_Real GeomLib_LogSample::GetParameter(const Standard_Integer Index) const |
22 | { |
23 | Standard_Integer n = NbPoints(); |
24 | |
25 | |
26 | if ((Index >= n) || (Index <= 1)) { |
27 | Standard_Real a, b; |
28 | Bounds(a, b); |
29 | if (Index == 1) return a; |
30 | else if (Index == n) return b; |
31 | else Standard_OutOfRange::Raise("GeomLib_LogSample::GetParameter"); |
32 | } |
33 | |
34 | Standard_Real v = myF + Exp(myexp*Index); |
35 | return v; |
36 | } |