npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
bilinearSection.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_BILINEARSECTION_HH_
2 #define NPSTAT_BILINEARSECTION_HH_
3 
4 /*!
5 // \file bilinearSection.hh
6 //
7 // \brief Determine constant level contours in a bilinear interpolation cell
8 //
9 // Author: I. Volobouev
10 //
11 // July 2011
12 */
13 
14 #include <vector>
15 #include <utility>
16 
17 namespace npstat {
18  /**
19  // This function finds the contours of the intersection of a bilinear
20  // interpolation cell (specified by values at the corners of the unit
21  // square) with a given constant level. To be used as a low-level building
22  // block of contouring procedures which work with interpolated surfaces.
23  //
24  // The function assumes that the parameters z00, z10, z11, and z01
25  // are the values at the corners (x,y) = (0,0), (1,0), (1,1), and (0,1),
26  // respectively (i.e., in the counterclockwise order starting from
27  // the origin).
28  //
29  // "level" is the crossing level for which the contours are found.
30  //
31  // "nPointsToSample" is the number of points to have in each contour.
32  // If this is 1, a fast and crude check will be made and only one point
33  // produced (at the center of the cell) if the level crosses the cell
34  // anywhere. More reasonable curve representations typically need
35  // at least 5 points.
36  //
37  // The return value of the function is the number of contours found
38  // (could be 0, 1, or 2). "section1" is filled with "nPointsToSample"
39  // points if this value is at least 1. "section2" is filled if this
40  // value is 2. All coordinates will be between 0 and 1. Appropriate
41  // shifting and scaling is left up to the user of this function.
42  */
43  unsigned bilinearSection(double z00, double z10, double z11, double z01,
44  double level, unsigned nPointsToSample,
45  std::vector<std::pair<double,double> >* section1,
46  std::vector<std::pair<double,double> >* section2);
47 }
48 
49 #endif // NPSTAT_BILINEARSECTION_HH_
Definition: AbsArrayProjector.hh:14
unsigned bilinearSection(double z00, double z10, double z11, double z01, double level, unsigned nPointsToSample, std::vector< std::pair< double, double > > *section1, std::vector< std::pair< double, double > > *section2)