FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
FastCubicIpol.hpp
1
2//
3// $Id: FastCubicIpol.hpp,v 1.1 2006/07/07 14:10:53 werner Exp $
4//
5// $Log: FastCubicIpol.hpp,v $
6// Revision 1.1 2006/07/07 14:10:53 werner
7// Intermediate state: multidimensional interpolation with on-demand
8// fractional loading appears to work, but still problem with vectorfield
9// interpolation.
10//
11// Revision 1.7 2004/08/12 16:08:45 werner
12// Various improvements for implementing the tangential space
13//
14// Revision 1.6 2004/07/09 20:15:26 werner
15// Added local alignment capability when interpolating vector fields and
16// option to compute the interpolated derivative.
17//
18// Revision 1.5 2004/07/04 17:24:03 werner
19// Recursive multidimensional Interpolation interface implemented.
20//
21// Revision 1.4 2004/06/18 23:29:46 werner
22// Intermediate version that supports the recursive interpolation scheme.
23// Need to beautify the interface, fix some indexing bug, and make it to
24// work with the ViewPtr.
25//
26// Revision 1.3 2004/06/15 23:31:00 werner
27// Support for interpolation of quaternions within the interpolation interfaces.
28//
29// Revision 1.2 2004/06/15 22:45:31 werner
30// Enhanced the fixed array member functions.
31// Using better name for interpolation template parameters.
32//
33// Revision 1.1 2004/06/14 22:42:00 werner
34// Moved interpolation files from light++ to VecAl and Multindex from Fiber to VecAl.
35//
36//
38#ifndef __IPOL_FASTCUBICIPOL_PP
39#define __IPOL_FASTCUBICIPOL_HPP "Created 11.06.2004 22:28:21 by bzfbenge"
40
41#include "IpolDelimiter.hpp"
42
43namespace Fiber
44{
45
56template <class T>
58{
59public:
60
61 template <class Storage1D, class Limiter>
62static T interpolate(const Storage1D&Data, double t, index_t size, const Limiter&L)
63 {
64 // TODO: Check for Samplings.size() < 2 !
65 assert(size > 2);
66
67 if (t<0 ) return Data[0];
68 if (t>=size ) return Data[size-1];
69
70 index_t i = index_t(t);
71 t = t - floor(t);
72
73 // 3 x^2 - 2 x^3
74 t = t*t*(3-2*t);
75
76 return Data[i] * (1-t) + Data[i+1] * (t);
77 }
78
79 template <class Storage1D>
80static T derivative(const Storage1D&Data, double t, index_t size)
81 {
82 index_t i = index_t(t);
83 t = t - floor(t);
84
85 // 3 x^2 - 2 x^3
86 // 6 x - 6 x^2
87 double x = 6*t*(1-t);
88
89 return (Data[i+1] - Data[i] )*x;
90 }
91};
92
93} /* namespace VecAl */
94
95#endif /* __IPOL_FASTCUBICIPOL_HPP */
constexpr __enable_if_is_duration< _ToDur > floor(const duration< _Rep, _Period > &__d)
valarray< size_t > size() const
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
Fast cubic interpolation which requires the same number of sampling points as the linear interpolatio...
Definition FastCubicIpol.hpp:58
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
IndexTypeConfig< sizeof(void *)>::index_t index_t
Define the index type as according to the size of a pointer, i.e.
Definition Index.hpp:22