Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
TMitchellNetravaliCubic2D.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <cmath>
6#include <algorithm>
7
8namespace ph::math
9{
10
13template<typename Value>
15{
16public:
17 TMitchellNetravaliCubic2D(Value b, Value c);
18
19 Value evaluate(Value x, Value y) const override;
20
21private:
22 Value m_b;
23 Value m_c;
24
25 Value mnCubic1D(Value x) const;
26};
27
28template<typename Value>
30 : m_b(b)
31 , m_c(c)
32{}
33
34template<typename Value>
35inline Value TMitchellNetravaliCubic2D<Value>::evaluate(const Value x, const Value y) const
36{
37 return mnCubic1D(x) * mnCubic1D(y);
38}
39
40template<typename Value>
41inline Value TMitchellNetravaliCubic2D<Value>::mnCubic1D(const Value x) const
42{
43 const Value absX = std::abs(x);
44 if(absX < 1)
45 {
46 return
47 (
48 (12 - 9 * m_b - 6 * m_c) * absX * absX * absX +
49 (-18 + 12 * m_b + 6 * m_c) * absX * absX +
50 (6 - 2 * m_b)
51 ) / 6;
52 }
53 else if(absX < 2)
54 {
55 return
56 (
57 (-m_b - 6 * m_c) * absX * absX * absX +
58 (6 * m_b + 30 * m_c) * absX * absX +
59 (-12 * m_b - 48 * m_c) * absX +
60 (8 * m_b + 24 * m_c)
61 ) / 6;
62 }
63 else
64 {
65 return 0;
66 }
67}
68
69}// end namespace ph::math
Definition TMathFunction2D.h:8
Mitchell–Netravali filter function Mitchell:1988:Reconstruction.
Definition TMitchellNetravaliCubic2D.h:15
Value evaluate(Value x, Value y) const override
Definition TMitchellNetravaliCubic2D.h:35
TMitchellNetravaliCubic2D(Value b, Value c)
Definition TMitchellNetravaliCubic2D.h:29
Math functions and utilities.
Definition TransformInfo.h:10