The Fib multimedia system
Fib is a system for storing multimedia data (like images or films).
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
nD2.h
Go to the documentation of this file.
1 /**
2  * @file nD2
3  * file name: nD2.h
4  * @author Betti Oesterholz
5  * @date 30.06.2010
6  * @mail webmaster@BioKom.info
7  *
8  * System: C++
9  *
10  * This header specifies functions for a two dimensional data.
11  * Copyright (C) @c GPL3 2010 Betti Oesterholz
12  *
13  * This program is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License (GPL) as
15  * published by the Free Software Foundation, either version 3 of the
16  * License, or any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU Lesser General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program. If not, see <http://www.gnu.org/licenses/>.
25  *
26  *
27  * This header specifies functions for a two dimensional data.
28  *
29  */
30 /*
31 History:
32 30.06.2010 Oesterholz created
33 20.02.2011 Oesterholz function createSplineBorderAreasForPoints() added
34 06.03.2011 Oesterholz function createSplineItrFastBorderAreasForPoints() added
35 27.03.2011 Oesterholz createSplineItrFastBorderAreasForPoints()
36  parameter pOutSetMissingPoints added
37 06.07.2011 Oesterholz functions createNSplineBorderAreasForPoints() added
38 24.09.2012 Oesterholz FEATURE_C_SPLINE_USE_GLP_LIB_LINAR_PROBLEM_SOLVING:
39  evalueSpline(): the glp library (extern package) linear solver will be
40  used to find a spline for a vector of range data points
41 06.01.2013 Oesterholz FEATURE_C_SPLINE_USE_GLP_LIB_LINAR_PROBLEM_SOLVING:
42  evalueSplineIterativFast(): the glp library (extern package) linear
43  solver will be used to find a spline for a vector of range data points
44 */
45 
46 #ifndef ___N_D2_H__
47 #define ___N_D2_H__
48 
49 #include "version.h"
50 
51 
52 #include "../nD1/incl/cDataPoint.h"
53 
54 #include "../nD2/incl/cDataPoint.h"
55 #include "../nD2/incl/cDataPointRange.h"
56 
57 #include "cFibElement.h"
58 
59 #include <vector>
60 #include <set>
61 #include <algorithm>
62 
63 using namespace std;
64 
65 
66 namespace fib{
67 
68 namespace algorithms{
69 
70 namespace nD2{
71 
72 
73  /**
74  * This function evaluats a derivate of a vector with datapoints.
75  * To evalue the derivate the differnce in the y values of to
76  * neibourpoints is divided with ther distance.
77  *
78  * @param vecInput the vector with the range data points, for which the
79  * derivate is to be evalued
80  * @return the vector with derivate range datapoints
81  */
82  template <class tX, class tY, class tZ>
83  vector< nD2::cDataPoint<tX, tY, tZ> > derivate(
84  const vector< nD2::cDataPoint<tX, tY, tZ> > & vecInput );
85 
86 
87  /**
88  * This function evaluats a derivate of a vector with range datapoints.
89  * To evalue the derivate a point with the minimal range size is choosen
90  * as the devolopment point. For every other point the maximal and minimal
91  * distance betwean two bounderies of the point and the devolopment point
92  * is evalued and divided by the distance betwean the points.
93  *
94  * @param vecInput the vector with the range data points, for which the
95  * derivate is to be evalued
96  * @return a pair with it's elements:
97  * - the first element is the vector with derivate range datapoints
98  * - the second element is the devolopment point which was choosen
99  */
100  template <class tX, class tY, class tZ>
101  pair< vector< nD2::cDataPointRange<tX, tY, tZ> >, nD2::cDataPointRange<tX, tY, tZ> > derivateDist(
102  const vector< nD2::cDataPointRange<tX, tY, tZ> > & vecInput );
103 
104  /**
105  * @param paFirst the first pair to compare with
106  * @param paSecond the second pair to compare with
107  * @return true if the number of the first element of the first pair paFirst is
108  * lower than that of the second paSecond, if they bouth are equal, returns true
109  * if the pointer of the second element of the first pair is lower than
110  * that of the second
111  */
112  bool lowerFirstNumber( const pair< unsigned long, cFibElement * > & paFirst,
113  const pair< unsigned long, cFibElement * > & paSecond );
114 
115  /**
116  * This function integrats the given line into the given areas.
117  * The given line will be appended to all areas to which it is connected.
118  * (It is connected if one of it's 8 neibours is in the area.)
119  * If no area exist a nuw area with the line will be added.
120  * If an area exists wich is connected with the given line paNewLine,
121  * but already has points on the same x row, the area is duplicated
122  * without theas line and the new line is added to it.
123  *
124  * @param areas a list of areas, wher the line should be integrated into
125  * @param paNewLine the (new) line to integrate as a pare of it lowest and
126  * biggest datapoints
127  */
128  template <class tX>
129  void integrateLineInAreas( list< pair<
130  unsigned long, list< pair< fib::algorithms::nD1::cDataPoint<tX, tX>,
134 
135  /**
136  * This function combines the given set of points to Fib objects.
137  * Beware: You have to care that the created underobjects will be deleted
138  *
139  * @param setPoints the set with the datapoints to combine to
140  * Fib objects with the help of area and function elements;
141  * The given points should be positions in an matrix, positions in
142  * the matrix but not given, will be considerd not to be in the area
143  * to create.
144  * @param pUnderobject a pointer to the underobject, which the created
145  * Fib elements should contain and which should be evalued for the
146  * point positions
147  * @param pVariableX a pointer to the variable for the x position
148  * @param pVariableY a pointer to the variable for the y position
149  * @return a Fib object with the created Fib underobjects, wher the
150  * given variables for the given pUnderobject will go over all
151  * point positions in the given set setPoints or NULL if non
152  * such could be created;
153  * some positions can be evalued twice;
154  * the Fib underobjects, wich evalue the most points, are on the
155  * front of the listobject (have a lower underobject number);
156  * if NULL is returnd, you have to care that pUnderobject will be
157  * deleted, else pUnderobject will be included in one
158  * underobject of the created listobject and the other underobject will
159  * contain copies of pUnderobject
160  * Structur of the created Fib object:
161  * area( fun( fun( area( pUnderobject ))))
162  * or if this previos given structur is not possible
163  * list(
164  * area( fun( fun( area( pUnderobject ))))
165  * ...
166  * area( fun( fun( area( pUnderobject ))))
167  * )
168  * (some fun or areas can be missing, if they are not needed, eg. for lines)
169  */
170  template <class tX>
172  const set< nD1::cDataPoint<tX, tX> > & setPoints,
173  cFibElement * pUnderobject,
174  cFibVariable * pVariableDimX,
175  cFibVariable * pVariableDimY );
176 
177 
178  /**
179  * This function combines the given set of points to Fib objects,
180  * with the help of splies (polynoms with fixed number of parametes
181  * uiMaxSplineParameters) .
182  * Beware: You have to care that the created underobjects will be deleted
183  *
184  * uses @see nD1::cPolynom::evalueSpline()
185  * @param setPoints the set with the datapoints to combine to
186  * Fib objects with the help of area and function elements;
187  * The given points should be positions in an matrix, positions in
188  * the matrix but not given, will be considerd not to be in the area
189  * to create.
190  * @param pUnderobject a pointer to the underobject, which the created
191  * Fib elements should contain and which should be evalued for the
192  * point positions
193  * @param pVariableX a pointer to the variable for the x position
194  * @param pVariableY a pointer to the variable for the y position
195  * @param uiMaxSplineParameters the number of parameters for the spline;
196  * Don't choose this number to big, because the evaluation time will
197  * grow exponentialy with this number. Even splines with 8
198  * parameters will take some time.
199  * @param uiMinBitsToStoreMantissa the minimal number of bits to store
200  * the mantissa of the function value parameters, when the parameter
201  * is in the form: mantissa * 2^exponent ;
202  * the method will try to reduce the bits, to store a parameter of the
203  * returned vector, to the uiMinBitsToStoreMantissa value;
204  * if uiMinBitsToStoreMantissa is 0, no optimization for the mantissa
205  * bits will be done
206  * @param maxValue the maximum possible value in all parameters
207  * the evalued spline/function elements will allways have value
208  * parameters vecFactors[i] with
209  * -1 * maxValue <= vecFactors[i] <= maxValue for 0 <= i < vecFactors.size();
210  * if 0 (standard value) is given, the maximum possible value will
211  * be evalued from the given data
212  * @param ulMaxMemoryCost a number for the maximum memory cost this
213  * method is allowed to use; if 0 the maximum memory cost is unbounded
214  * @return a Fib object with the created Fib underobjects, wher the
215  * given variables for the given pUnderobject will go over all
216  * point positions in the given set setPoints or NULL if non
217  * such could be created;
218  * some positions can be evalued twice;
219  * the Fib underobjects, wich evalue the most points, are on the
220  * front of the listobject (have a lower underobject number);
221  * if NULL is returnd, you have to care that pUnderobject will be
222  * deleted, else pUnderobject will be included in one
223  * underobject of the created listobject and the other underobject will
224  * contain copies of pUnderobject
225  * Structur of the created Fib object:
226  * area( fun( fun( fun( area( pUnderobject )))))
227  * or if this previos given structur is not possible
228  * list(
229  * area( fun( fun( fun( area( pUnderobject )))))
230  * ...
231  * area( fun( fun( fun( area( pUnderobject )))))
232  * )
233  * (some fun or areas can be missing, if they are not needed, eg. for lines)
234  */
235  template <class tX>
237  const set< nD1::cDataPoint<tX, tX> > & setPoints,
238  cFibElement * pUnderobject,
239  cFibVariable * pVariableDimX,
240  cFibVariable * pVariableDimY,
241  const unsigned int uiMaxSplineParameters = 4,
242  const unsigned int uiMinBitsToStoreMantissa = 1,
243  const double maxValue = 0.0,
244  const unsigned long ulMaxMemoryCost = 100000 );
245 
246 
247 #ifdef FEATURE_C_SPLINE_USE_GLP_LIB_LINAR_PROBLEM_SOLVING
248 
249  /**
250  * This function combines the given set of points to Fib objects,
251  * with the help of splies (polynoms with fixed number of parametes
252  * uiMaxSplineParameters) .
253  * Beware: You have to care that the created underobjects will be deleted
254  *
255  * uses @see nD1::cPolynom::evalueSplineIterativFast()
256  * The method should give the same result as
257  * createSplineBorderAreasForPoints() but faster.
258  * It will iterativ increase the number of parameters for the splines
259  * (from 1 to uiMaxNumberOfParameters) and will try to not use all of
260  * the given range points to find the polynom.
261  *
262  * @param setPoints the set with the datapoints to combine to
263  * Fib objects with the help of area and function elements;
264  * The given points should be positions in an matrix, positions in
265  * the matrix but not given, will be considerd not to be in the area
266  * to create.
267  * @param pUnderobject a pointer to the underobject, which the created
268  * Fib elements should contain and which should be evalued for the
269  * point positions
270  * @param pVariableX a pointer to the variable for the x position
271  * @param pVariableY a pointer to the variable for the y position
272  * @param uiMaxSplineParameters the number of parameters for the spline;
273  * Don't choose this number to big, because the evaluation time will
274  * grow exponentialy with this number. Even splines with 8
275  * parameters will take some time.
276  * @param maxValue the maximum possible value in all parameters
277  * the evalued spline/function elements will allways have value
278  * parameters vecFactors[i] with
279  * -1 * maxValue <= vecFactors[i] <= maxValue for 0 <= i < vecFactors.size();
280  * if 0 (standard value) is given, the maximum possible value will
281  * be evalued from the given data
282  * @param maxError the maximal error for the border polynoms to find;
283  * the error on the interpolated polynoms for the borders will be
284  * equal or less than maxError
285  * @param maxErrorPerValue the maximal error for the border polynoms to
286  * find on one border point; the error on the interpolated polynom
287  * for every border point in vecData will be equal or less than
288  * maxErrorPerValue
289  * @return a Fib object with the created Fib underobjects, wher the
290  * given variables for the given pUnderobject will go over all
291  * point positions in the given set setPoints or NULL if non
292  * such could be created;
293  * some positions can be evalued twice;
294  * the Fib underobjects, wich evalue the most points, are on the
295  * front of the listobject (have a lower underobject number);
296  * if NULL is returnd, you have to care that pUnderobject will be
297  * deleted, else pUnderobject will be included in one
298  * underobject of the created listobject and the other underobject will
299  * contain copies of pUnderobject
300  * Structur of the created Fib object:
301  * area( fun( fun( fun( area( pUnderobject )))))
302  * or if this previos given structur is not possible
303  * list(
304  * area( fun( fun( fun( area( pUnderobject )))))
305  * ...
306  * area( fun( fun( fun( area( pUnderobject )))))
307  * )
308  * (some fun or areas can be missing, if they are not needed, eg. for lines)
309  */
310  template <class tX>
312  const set< nD1::cDataPoint<tX, tX> > & setPoints,
313  cFibElement * pUnderobject,
314  cFibVariable * pVariableDimX,
315  cFibVariable * pVariableDimY,
316  const unsigned int uiMaxSplineParameters = 4,
317  double maxValue = 0.0,
318  const double maxError = 0.0,
319  const double maxErrorPerValue = 100000 );
320 
321  /**
322  * This function combines the given set of points to Fib objects,
323  * with the help of splies (polynoms with fixed number of parametes
324  * uiMaxSplineParameters) .
325  * Beware: You have to care that the created underobjects will be deleted
326  *
327  * uses @see nD1::cPolynom::evalueSplineIterativFast()
328  * The method should give the same result as
329  * createSplineBorderAreasForPoints() but faster.
330  * It will iterativ increase the number of parameters for the splines
331  * (from 1 to uiMaxNumberOfParameters) and will try to not use all of
332  * the given range points to find the polynom.
333  *
334  * @param setMinimumArea the set with the datapoints to combine to
335  * Fib objects with the help of area and function elements;
336  * the created area should contain all of these points;
337  * The given points should be positions in an matrix, positions in
338  * the matrix but not given, will be considerd not to be in the area
339  * to create.
340  * @param setMaximumArea the set with the datapoints to combine to
341  * Fib objects with the help of area and function elements;
342  * the created area can contain these points;
343  * this set should contain all points from setMinimumArea;
344  * The given points should be positions in an matrix, positions in
345  * the matrix but not given, will be considerd not to be in the area
346  * to create.
347  * @param pUnderobject a pointer to the underobject, which the created
348  * Fib elements should contain and which should be evalued for the
349  * point positions
350  * @param pVariableX a pointer to the variable for the x position
351  * @param pVariableY a pointer to the variable for the y position
352  * @param uiMaxSplineParameters the number of parameters for the spline;
353  * Don't choose this number to big, because the evaluation time will
354  * grow exponentialy with this number. Even splines with 8
355  * parameters will take some time.
356  * @param pOutSetMissingPoints if not NULL, the points not in the
357  * created area will be inserted/added into this set, when this
358  * function returns
359  * @param maxValue the maximum possible value in all parameters
360  * the evalued spline/function elements will allways have value
361  * parameters vecFactors[i] with
362  * -1 * maxValue <= vecFactors[i] <= maxValue for 0 <= i < vecFactors.size();
363  * if 0 (standard value) is given, the maximum possible value will
364  * be evalued from the given data
365  * @param maxError the maximal error for the border polynoms to find;
366  * the error on the interpolated polynoms for the borders will be
367  * equal or less than maxError
368  * @param maxErrorPerValue the maximal error for the border polynoms to
369  * find on one border point; the error on the interpolated polynom
370  * for every border point in vecData will be equal or less than
371  * maxErrorPerValue
372  * @return a Fib object with the created Fib underobjects, wher the
373  * given variables for the given pUnderobject will go over all
374  * point positions in the given set setPoints or NULL if non
375  * such could be created;
376  * some positions can be evalued twice;
377  * the Fib underobjects, wich evalue the most points, are on the
378  * front of the listobject (have a lower underobject number);
379  * if NULL is returnd, you have to care that pUnderobject will be
380  * deleted, else pUnderobject will be included in one
381  * underobject of the created listobject and the other underobject will
382  * contain copies of pUnderobject
383  * Structur of the created Fib object:
384  * area( fun( fun( fun( area( pUnderobject )))))
385  * or if this previos given structur is not possible
386  * list(
387  * area( fun( fun( fun( area( pUnderobject )))))
388  * ...
389  * area( fun( fun( fun( area( pUnderobject )))))
390  * )
391  * (some fun or areas can be missing, if they are not needed, eg. for lines)
392  */
393  template <class tX>
395  const set< nD1::cDataPoint<tX, tX> > & setMinimumArea,
396  const set< nD1::cDataPoint<tX, tX> > & setMaximumArea,
397  cFibElement * pUnderobject,
398  cFibVariable * pVariableDimX,
399  cFibVariable * pVariableDimY,
400  const unsigned int uiMaxSplineParameters = 4,
401  set< nD1::cDataPoint<tX, tX> > * pOutSetMissingPoints = NULL,
402  double maxValue = 0.0,
403  const double maxError = 0,
404  const double maxErrorPerValue = 100000 );
405 
406 
407  /**
408  * This function combines the given set of points to Fib objects,
409  * with the help of splies (polynoms with fixed number of parametes
410  * uiMaxSplineParameters) .
411  * For this the method @see nD1::cSpline::evalueSpline() will be used.
412  * Beware: You have to care that the created underobjects will be deleted
413  *
414  * uses @see nD1::cSpline::evalueSpline()
415  * The method should give the same result as
416  * createSplineItrFastBorderAreasForPoints() but faster and with less
417  * Fib elements.
418  * It will iterativ increase the number of parameters for the splines
419  * (from 1 to uiMaxNumberOfParameters).
420  *
421  * @param setPoints the set with the datapoints to combine to
422  * Fib objects with the help of area and function elements;
423  * The given points should be positions in an matrix, positions in
424  * the matrix but not given, will be considerd not to be in the area
425  * to create.
426  * @param pUnderobject a pointer to the underobject, which the created
427  * Fib elements should contain and which should be evalued for the
428  * point positions
429  * @param pVariableX a pointer to the variable for the x position
430  * @param pVariableY a pointer to the variable for the y position
431  * @param uiMaxSplineParameters the number of parameters for the spline;
432  * Don't choose this number to big, because the evaluation time will
433  * grow exponentialy with this number. Even splines with 8
434  * parameters will take some time.
435  * @param maxValue the maximum possible value in all parameters
436  * the evalued spline/function elements will allways have value
437  * parameters vecFactors[i] with
438  * -1 * maxValue <= vecFactors[i] <= maxValue for 0 <= i < vecFactors.size();
439  * if 0 (standard value) is given, the maximum possible value will
440  * be evalued from the given data
441  * @param maxError the maximal error for the border polynoms to find;
442  * the error on the interpolated polynoms for the borders will be
443  * equal or less than maxError
444  * @param maxErrorPerValue the maximal error for the border polynoms to
445  * find on one border point; the error on the interpolated polynom
446  * for every border point in vecData will be equal or less than
447  * maxErrorPerValue
448  * @return a Fib object with the created Fib underobjects, wher the
449  * given variables for the given pUnderobject will go over all
450  * point positions in the given set setPoints or NULL if non
451  * such could be created;
452  * some positions can be evalued twice;
453  * the Fib underobjects, wich evalue the most points, are on the
454  * front of the listobject (have a lower underobject number);
455  * if NULL is returnd, you have to care that pUnderobject will be
456  * deleted, else pUnderobject will be included in one
457  * underobject of the created listobject and the other underobject will
458  * contain copies of pUnderobject
459  * Structur of the created Fib object:
460  * area( fun( fun( fun( area( pUnderobject )))))
461  * or if this previos given structur is not possible
462  * list(
463  * area( fun( fun( fun( area( pUnderobject )))))
464  * ...
465  * area( fun( fun( fun( area( pUnderobject )))))
466  * )
467  * (some fun or areas can be missing, if they are not needed, eg. for lines)
468  */
469  template <class tX>
471  const set< nD1::cDataPoint<tX, tX> > & setPoints,
472  cFibElement * pUnderobject,
473  cFibVariable * pVariableDimX,
474  cFibVariable * pVariableDimY,
475  const unsigned int uiMaxSplineParameters = 4,
476  double maxValue = 0.0,
477  const double maxError = 0,
478  const double maxErrorPerValue = 0 );
479 
480 
481  /**
482  * This function combines the given set of points to Fib objects,
483  * with the help of splies (polynoms with fixed number of parametes
484  * uiMaxSplineParameters) .
485  * For this the method @see nD1::cSpline::evalueSpline() will be used.
486  * Beware: You have to care that the created underobjects will be deleted
487  *
488  * uses @see nD1::cSpline::evalueSpline()
489  * The method should give the same result as
490  * createSplineItrFastBorderAreasForPoints() but faster and with less
491  * Fib elements.
492  * It will iterativ increase the number of parameters for the splines
493  * (from 1 to uiMaxNumberOfParameters).
494  *
495  * @param setMinimumArea the set with the datapoints to combine to
496  * Fib objects with the help of area and function elements;
497  * the created area should contain all of these points;
498  * The given points should be positions in an matrix, positions in
499  * the matrix but not given, will be considerd not to be in the area
500  * to create.
501  * @param setMaximumArea the set with the datapoints to combine to
502  * Fib objects with the help of area and function elements;
503  * the created area can contain these points;
504  * this set should contain all points from setMinimumArea;
505  * The given points should be positions in an matrix, positions in
506  * the matrix but not given, will be considerd not to be in the area
507  * to create.
508  * @param pUnderobject a pointer to the underobject, which the created
509  * Fib elements should contain and which should be evalued for the
510  * point positions
511  * @param pVariableX a pointer to the variable for the x position
512  * @param pVariableY a pointer to the variable for the y position
513  * @param uiMaxSplineParameters the number of parameters for the spline;
514  * Don't choose this number to big, because the evaluation time will
515  * grow exponentialy with this number. Even splines with 8
516  * parameters will take some time.
517  * @param pOutSetMissingPoints if not NULL, the points not in the
518  * created area will be inserted/added into this set, when this
519  * function returns
520  * @param maxValue the maximum possible value in all parameters
521  * the evalued spline/function elements will allways have value
522  * parameters vecFactors[i] with
523  * -1 * maxValue <= vecFactors[i] <= maxValue for 0 <= i < vecFactors.size();
524  * if 0 (standard value) is given, the maximum possible value will
525  * be evalued from the given data
526  * @param maxError the maximal error for the border polynoms to find;
527  * the error on the interpolated polynoms for the borders will be
528  * equal or less than maxError
529  * @param maxErrorPerValue the maximal error for the border polynoms to
530  * find on one border point; the error on the interpolated polynom
531  * for every border point in vecData will be equal or less than
532  * maxErrorPerValue
533  * @return a Fib object with the created Fib underobjects, wher the
534  * given variables for the given pUnderobject will go over all
535  * point positions in the given set setPoints or NULL if non
536  * such could be created;
537  * some positions can be evalued twice;
538  * the Fib underobjects, wich evalue the most points, are on the
539  * front of the listobject (have a lower underobject number);
540  * if NULL is returnd, you have to care that pUnderobject will be
541  * deleted, else pUnderobject will be included in one
542  * underobject of the created listobject and the other underobject will
543  * contain copies of pUnderobject
544  * Structur of the created Fib object:
545  * area( fun( fun( fun( area( pUnderobject )))))
546  * or if this previos given structur is not possible
547  * list(
548  * area( fun( fun( fun( area( pUnderobject )))))
549  * ...
550  * area( fun( fun( fun( area( pUnderobject )))))
551  * )
552  * (some fun or areas can be missing, if they are not needed, eg. for lines)
553  */
554  template <class tX>
556  const set< nD1::cDataPoint<tX, tX> > & setMinimumArea,
557  const set< nD1::cDataPoint<tX, tX> > & setMaximumArea,
558  cFibElement * pUnderobject,
559  cFibVariable * pVariableDimX,
560  cFibVariable * pVariableDimY,
561  const unsigned int uiMaxSplineParameters = 4,
562  set< nD1::cDataPoint<tX, tX> > * pOutSetMissingPoints = NULL,
563  double maxValue = 0.0,
564  const double maxError = 0.0,
565  const double maxErrorPerValue = 0.0 );
566 
567 
568 #else //FEATURE_C_SPLINE_USE_GLP_LIB_LINAR_PROBLEM_SOLVING
569 
570 
571  /**
572  * This function combines the given set of points to Fib objects,
573  * with the help of splies (polynoms with fixed number of parametes
574  * uiMaxSplineParameters) .
575  * Beware: You have to care that the created underobjects will be deleted
576  *
577  * uses @see nD1::cPolynom::evalueSplineIterativFast()
578  * The method should give the same result as
579  * createSplineBorderAreasForPoints() but faster.
580  * It will iterativ increase the number of parameters for the splines
581  * (from 1 to uiMaxNumberOfParameters) and will try to not use all of
582  * the given range points to find the polynom.
583  *
584  * @param setPoints the set with the datapoints to combine to
585  * Fib objects with the help of area and function elements;
586  * The given points should be positions in an matrix, positions in
587  * the matrix but not given, will be considerd not to be in the area
588  * to create.
589  * @param pUnderobject a pointer to the underobject, which the created
590  * Fib elements should contain and which should be evalued for the
591  * point positions
592  * @param pVariableX a pointer to the variable for the x position
593  * @param pVariableY a pointer to the variable for the y position
594  * @param uiMaxSplineParameters the number of parameters for the spline;
595  * Don't choose this number to big, because the evaluation time will
596  * grow exponentialy with this number. Even splines with 8
597  * parameters will take some time.
598  * @param uiMinBitsToStoreMantissa the minimal number of bits to store
599  * the mantissa of the function value parameters, when the parameter
600  * is in the form: mantissa * 2^exponent ;
601  * the method will try to reduce the bits, to store a parameter of the
602  * returned vector, to the uiMinBitsToStoreMantissa value;
603  * if uiMinBitsToStoreMantissa is 0, no optimization for the mantissa
604  * bits will be done
605  * @param maxValue the maximum possible value in all parameters
606  * the evalued spline/function elements will allways have value
607  * parameters vecFactors[i] with
608  * -1 * maxValue <= vecFactors[i] <= maxValue for 0 <= i < vecFactors.size();
609  * if 0 (standard value) is given, the maximum possible value will
610  * be evalued from the given data
611  * @param maxError the maximal error for the border polynoms to find;
612  * the error on the interpolated polynoms for the borders will be
613  * equal or less than maxError
614  * @param ulMaxMemoryCost a number for the maximum memory cost this
615  * method is allowed to use; if 0 the maximum memory cost is unbounded
616  * @return a Fib object with the created Fib underobjects, wher the
617  * given variables for the given pUnderobject will go over all
618  * point positions in the given set setPoints or NULL if non
619  * such could be created;
620  * some positions can be evalued twice;
621  * the Fib underobjects, wich evalue the most points, are on the
622  * front of the listobject (have a lower underobject number);
623  * if NULL is returnd, you have to care that pUnderobject will be
624  * deleted, else pUnderobject will be included in one
625  * underobject of the created listobject and the other underobject will
626  * contain copies of pUnderobject
627  * Structur of the created Fib object:
628  * area( fun( fun( fun( area( pUnderobject )))))
629  * or if this previos given structur is not possible
630  * list(
631  * area( fun( fun( fun( area( pUnderobject )))))
632  * ...
633  * area( fun( fun( fun( area( pUnderobject )))))
634  * )
635  * (some fun or areas can be missing, if they are not needed, eg. for lines)
636  */
637  template <class tX>
639  const set< nD1::cDataPoint<tX, tX> > & setPoints,
640  cFibElement * pUnderobject,
641  cFibVariable * pVariableDimX,
642  cFibVariable * pVariableDimY,
643  const unsigned int uiMaxSplineParameters = 4,
644  const unsigned int uiMinBitsToStoreMantissa = 1,
645  double maxValue = 0.0,
646  const double maxError = 0,
647  const unsigned long ulMaxMemoryCost = 100000 );
648 
649  /**
650  * This function combines the given set of points to Fib objects,
651  * with the help of splies (polynoms with fixed number of parametes
652  * uiMaxSplineParameters) .
653  * Beware: You have to care that the created underobjects will be deleted
654  *
655  * uses @see nD1::cPolynom::evalueSplineIterativFast()
656  * The method should give the same result as
657  * createSplineBorderAreasForPoints() but faster.
658  * It will iterativ increase the number of parameters for the splines
659  * (from 1 to uiMaxNumberOfParameters) and will try to not use all of
660  * the given range points to find the polynom.
661  *
662  * @param setMinimumArea the set with the datapoints to combine to
663  * Fib objects with the help of area and function elements;
664  * the created area should contain all of these points;
665  * The given points should be positions in an matrix, positions in
666  * the matrix but not given, will be considerd not to be in the area
667  * to create.
668  * @param setMaximumArea the set with the datapoints to combine to
669  * Fib objects with the help of area and function elements;
670  * the created area can contain these points;
671  * this set should contain all points from setMinimumArea;
672  * The given points should be positions in an matrix, positions in
673  * the matrix but not given, will be considerd not to be in the area
674  * to create.
675  * @param pUnderobject a pointer to the underobject, which the created
676  * Fib elements should contain and which should be evalued for the
677  * point positions
678  * @param pVariableX a pointer to the variable for the x position
679  * @param pVariableY a pointer to the variable for the y position
680  * @param uiMaxSplineParameters the number of parameters for the spline;
681  * Don't choose this number to big, because the evaluation time will
682  * grow exponentialy with this number. Even splines with 8
683  * parameters will take some time.
684  * @param pOutSetMissingPoints if not NULL, the points not in the
685  * created area will be inserted/added into this set, when this
686  * function returns
687  * @param uiMinBitsToStoreMantissa the minimal number of bits to store
688  * the mantissa of the function value parameters, when the parameter
689  * is in the form: mantissa * 2^exponent ;
690  * the method will try to reduce the bits, to store a parameter of the
691  * returned vector, to the uiMinBitsToStoreMantissa value;
692  * if uiMinBitsToStoreMantissa is 0, no optimization for the mantissa
693  * bits will be done
694  * @param maxValue the maximum possible value in all parameters
695  * the evalued spline/function elements will allways have value
696  * parameters vecFactors[i] with
697  * -1 * maxValue <= vecFactors[i] <= maxValue for 0 <= i < vecFactors.size();
698  * if 0 (standard value) is given, the maximum possible value will
699  * be evalued from the given data
700  * @param maxError the maximal error for the border polynoms to find;
701  * the error on the interpolated polynoms for the borders will be
702  * equal or less than maxError
703  * @param ulMaxMemoryCost a number for the maximum memory cost this
704  * method is allowed to use; if 0 the maximum memory cost is unbounded
705  * @return a Fib object with the created Fib underobjects, wher the
706  * given variables for the given pUnderobject will go over all
707  * point positions in the given set setPoints or NULL if non
708  * such could be created;
709  * some positions can be evalued twice;
710  * the Fib underobjects, wich evalue the most points, are on the
711  * front of the listobject (have a lower underobject number);
712  * if NULL is returnd, you have to care that pUnderobject will be
713  * deleted, else pUnderobject will be included in one
714  * underobject of the created listobject and the other underobject will
715  * contain copies of pUnderobject
716  * Structur of the created Fib object:
717  * area( fun( fun( fun( area( pUnderobject )))))
718  * or if this previos given structur is not possible
719  * list(
720  * area( fun( fun( fun( area( pUnderobject )))))
721  * ...
722  * area( fun( fun( fun( area( pUnderobject )))))
723  * )
724  * (some fun or areas can be missing, if they are not needed, eg. for lines)
725  */
726  template <class tX>
728  const set< nD1::cDataPoint<tX, tX> > & setMinimumArea,
729  const set< nD1::cDataPoint<tX, tX> > & setMaximumArea,
730  cFibElement * pUnderobject,
731  cFibVariable * pVariableDimX,
732  cFibVariable * pVariableDimY,
733  const unsigned int uiMaxSplineParameters = 4,
734  set< nD1::cDataPoint<tX, tX> > * pOutSetMissingPoints = NULL,
735  const unsigned int uiMinBitsToStoreMantissa = 1,
736  double maxValue = 0.0,
737  const double maxError = 0,
738  const unsigned long ulMaxMemoryCost = 100000 );
739 
740 
741  /**
742  * This function combines the given set of points to Fib objects,
743  * with the help of splies (polynoms with fixed number of parametes
744  * uiMaxSplineParameters) .
745  * For this the method @see nD1::cSpline::evalueSpline() will be used.
746  * Beware: You have to care that the created underobjects will be deleted
747  *
748  * uses @see nD1::cSpline::evalueSpline()
749  * The method should give the same result as
750  * createSplineItrFastBorderAreasForPoints() but faster and with less
751  * Fib elements.
752  * It will iterativ increase the number of parameters for the splines
753  * (from 1 to uiMaxNumberOfParameters).
754  *
755  * @param setPoints the set with the datapoints to combine to
756  * Fib objects with the help of area and function elements;
757  * The given points should be positions in an matrix, positions in
758  * the matrix but not given, will be considerd not to be in the area
759  * to create.
760  * @param pUnderobject a pointer to the underobject, which the created
761  * Fib elements should contain and which should be evalued for the
762  * point positions
763  * @param pVariableX a pointer to the variable for the x position
764  * @param pVariableY a pointer to the variable for the y position
765  * @param uiMaxSplineParameters the number of parameters for the spline;
766  * Don't choose this number to big, because the evaluation time will
767  * grow exponentialy with this number. Even splines with 8
768  * parameters will take some time.
769  * @param uiMinBitsToStoreMantissa the minimal number of bits to store
770  * the mantissa of the function value parameters, when the parameter
771  * is in the form: mantissa * 2^exponent ;
772  * the method will try to reduce the bits, to store a parameter of the
773  * returned vector, to the uiMinBitsToStoreMantissa value;
774  * if uiMinBitsToStoreMantissa is 0, no optimization for the mantissa
775  * bits will be done
776  * @param maxValue the maximum possible value in all parameters
777  * the evalued spline/function elements will allways have value
778  * parameters vecFactors[i] with
779  * -1 * maxValue <= vecFactors[i] <= maxValue for 0 <= i < vecFactors.size();
780  * if 0 (standard value) is given, the maximum possible value will
781  * be evalued from the given data
782  * @param maxError the maximal error for the border polynoms to find;
783  * the error on the interpolated polynoms for the borders will be
784  * equal or less than maxError
785  * @param ulMaxMemoryCost a number for the maximum memory cost this
786  * method is allowed to use; if 0 the maximum memory cost is unbounded
787  * @return a Fib object with the created Fib underobjects, wher the
788  * given variables for the given pUnderobject will go over all
789  * point positions in the given set setPoints or NULL if non
790  * such could be created;
791  * some positions can be evalued twice;
792  * the Fib underobjects, wich evalue the most points, are on the
793  * front of the listobject (have a lower underobject number);
794  * if NULL is returnd, you have to care that pUnderobject will be
795  * deleted, else pUnderobject will be included in one
796  * underobject of the created listobject and the other underobject will
797  * contain copies of pUnderobject
798  * Structur of the created Fib object:
799  * area( fun( fun( fun( area( pUnderobject )))))
800  * or if this previos given structur is not possible
801  * list(
802  * area( fun( fun( fun( area( pUnderobject )))))
803  * ...
804  * area( fun( fun( fun( area( pUnderobject )))))
805  * )
806  * (some fun or areas can be missing, if they are not needed, eg. for lines)
807  */
808  template <class tX>
810  const set< nD1::cDataPoint<tX, tX> > & setPoints,
811  cFibElement * pUnderobject,
812  cFibVariable * pVariableDimX,
813  cFibVariable * pVariableDimY,
814  const unsigned int uiMaxSplineParameters = 4,
815  const unsigned int uiMinBitsToStoreMantissa = 1,
816  double maxValue = 0.0,
817  const double maxError = 0,
818  const unsigned long ulMaxMemoryCost = 100000 );
819 
820 
821  /**
822  * This function combines the given set of points to Fib objects,
823  * with the help of splies (polynoms with fixed number of parametes
824  * uiMaxSplineParameters) .
825  * For this the method @see nD1::cSpline::evalueSpline() will be used.
826  * Beware: You have to care that the created underobjects will be deleted
827  *
828  * uses @see nD1::cSpline::evalueSpline()
829  * The method should give the same result as
830  * createSplineItrFastBorderAreasForPoints() but faster and with less
831  * Fib elements.
832  * It will iterativ increase the number of parameters for the splines
833  * (from 1 to uiMaxNumberOfParameters).
834  *
835  * @param setMinimumArea the set with the datapoints to combine to
836  * Fib objects with the help of area and function elements;
837  * the created area should contain all of these points;
838  * The given points should be positions in an matrix, positions in
839  * the matrix but not given, will be considerd not to be in the area
840  * to create.
841  * @param setMaximumArea the set with the datapoints to combine to
842  * Fib objects with the help of area and function elements;
843  * the created area can contain these points;
844  * this set should contain all points from setMinimumArea;
845  * The given points should be positions in an matrix, positions in
846  * the matrix but not given, will be considerd not to be in the area
847  * to create.
848  * @param pUnderobject a pointer to the underobject, which the created
849  * Fib elements should contain and which should be evalued for the
850  * point positions
851  * @param pVariableX a pointer to the variable for the x position
852  * @param pVariableY a pointer to the variable for the y position
853  * @param uiMaxSplineParameters the number of parameters for the spline;
854  * Don't choose this number to big, because the evaluation time will
855  * grow exponentialy with this number. Even splines with 8
856  * parameters will take some time.
857  * @param pOutSetMissingPoints if not NULL, the points not in the
858  * created area will be inserted/added into this set, when this
859  * function returns
860  * @param uiMinBitsToStoreMantissa the minimal number of bits to store
861  * the mantissa of the function value parameters, when the parameter
862  * is in the form: mantissa * 2^exponent ;
863  * the method will try to reduce the bits, to store a parameter of the
864  * returned vector, to the uiMinBitsToStoreMantissa value;
865  * if uiMinBitsToStoreMantissa is 0, no optimization for the mantissa
866  * bits will be done
867  * @param maxValue the maximum possible value in all parameters
868  * the evalued spline/function elements will allways have value
869  * parameters vecFactors[i] with
870  * -1 * maxValue <= vecFactors[i] <= maxValue for 0 <= i < vecFactors.size();
871  * if 0 (standard value) is given, the maximum possible value will
872  * be evalued from the given data
873  * @param maxError the maximal error for the border polynoms to find;
874  * the error on the interpolated polynoms for the borders will be
875  * equal or less than maxError
876  * @param ulMaxMemoryCost a number for the maximum memory cost this
877  * method is allowed to use; if 0 the maximum memory cost is unbounded
878  * @return a Fib object with the created Fib underobjects, wher the
879  * given variables for the given pUnderobject will go over all
880  * point positions in the given set setPoints or NULL if non
881  * such could be created;
882  * some positions can be evalued twice;
883  * the Fib underobjects, wich evalue the most points, are on the
884  * front of the listobject (have a lower underobject number);
885  * if NULL is returnd, you have to care that pUnderobject will be
886  * deleted, else pUnderobject will be included in one
887  * underobject of the created listobject and the other underobject will
888  * contain copies of pUnderobject
889  * Structur of the created Fib object:
890  * area( fun( fun( fun( area( pUnderobject )))))
891  * or if this previos given structur is not possible
892  * list(
893  * area( fun( fun( fun( area( pUnderobject )))))
894  * ...
895  * area( fun( fun( fun( area( pUnderobject )))))
896  * )
897  * (some fun or areas can be missing, if they are not needed, eg. for lines)
898  */
899  template <class tX>
901  const set< nD1::cDataPoint<tX, tX> > & setMinimumArea,
902  const set< nD1::cDataPoint<tX, tX> > & setMaximumArea,
903  cFibElement * pUnderobject,
904  cFibVariable * pVariableDimX,
905  cFibVariable * pVariableDimY,
906  const unsigned int uiMaxSplineParameters = 4,
907  set< nD1::cDataPoint<tX, tX> > * pOutSetMissingPoints = NULL,
908  const unsigned int uiMinBitsToStoreMantissa = 1,
909  double maxValue = 0.0,
910  const double maxError = 0,
911  const unsigned long ulMaxMemoryCost = 100000 );
912 
913 #endif //FEATURE_C_SPLINE_USE_GLP_LIB_LINAR_PROBLEM_SOLVING
914 
915 
916 };//end namespace nD2
917 };//end namespace algorithms
918 };//end namespace fib
919 
920 //include template implementation
921 #define ___N_D2_H_INCLUDE__
922 #include "../nD2/src/nD2.cpp"
923 #undef ___N_D2_H_INCLUDE__
924 
925 
926 
927 #endif //___N_D2_H__