Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > eebc325dc36bd6e3b09b9b45133e42f8 > files > 728

HippoDraw-devel-docs-1.21.1-10.fc13.i686.rpm

<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>HippoDraw Class Library</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="hippoApp.ico">
</head><body>
<!-- Generated by Doxygen 1.6.2 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="dir_6dcc65b7c74f97460af44109581e51d3.html">reps</a>
  </div>
</div>
<div class="contents">
<h1>ContourFunctionRep.cxx</h1><a href="ContourFunctionRep_8cxx.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00012"></a>00012 <span class="preprocessor">#include &quot;<a class="code" href="ContourFunctionRep_8h.html" title="ContourFunctionRep class interface.">ContourFunctionRep.h</a>&quot;</span>
<a name="l00013"></a>00013 
<a name="l00014"></a>00014 <span class="preprocessor">#include &quot;<a class="code" href="BinToBlack_8h.html" title="BinToBlack class interface.">colorreps/BinToBlack.h</a>&quot;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &quot;<a class="code" href="DataPointTuple_8h.html" title="hippodraw::DataPointTuple namespace interface">datasrcs/DataPointTuple.h</a>&quot;</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include &quot;<a class="code" href="NTuple_8h.html" title="hippodraw::NTuple class interface.">datasrcs/NTuple.h</a>&quot;</span>
<a name="l00017"></a>00017 <span class="preprocessor">#include &quot;<a class="code" href="FunctionBase_8h.html" title="hippodraw::FunctionBase class interface">functions/FunctionBase.h</a>&quot;</span>
<a name="l00018"></a>00018 
<a name="l00019"></a>00019 <span class="keyword">using</span> std::string;
<a name="l00020"></a>00020 <span class="keyword">using</span> std::vector;
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 <span class="keyword">namespace </span>dp = hippodraw::DataPoint3DTuple;
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 <span class="keyword">namespace </span>hippodraw {
<a name="l00025"></a>00025 
<a name="l00026"></a>00026 <a class="code" href="classhippodraw_1_1ContourFunctionRep.html#aa18cd830925b6b1cbb75bd473478f7d0" title="The default constructor.">ContourFunctionRep::</a>
<a name="l00027"></a><a class="code" href="classhippodraw_1_1ContourFunctionRep.html#aa18cd830925b6b1cbb75bd473478f7d0">00027</a> <a class="code" href="classhippodraw_1_1ContourFunctionRep.html#aa18cd830925b6b1cbb75bd473478f7d0" title="The default constructor.">ContourFunctionRep</a> ( )
<a name="l00028"></a>00028   : <a class="code" href="classhippodraw_1_1ContourPointRep.html" title="A PointRep class that draws a contour lines.">ContourPointRep</a> ( ),
<a name="l00029"></a>00029     m_steps ( 25 )
<a name="l00030"></a>00030 {
<a name="l00031"></a>00031   <a class="code" href="classhippodraw_1_1BinToBlack.html" title="The class derived from the BinToColor class.">BinToBlack</a> * btb = <span class="keyword">new</span> <a class="code" href="classhippodraw_1_1BinToBlack.html" title="The class derived from the BinToColor class.">BinToBlack</a> ( <span class="stringliteral">&quot;black&quot;</span> );
<a name="l00032"></a>00032   <a class="code" href="classhippodraw_1_1ContourPointRep.html#af419da4ce56bc4c5ab5552ef01e6e44f" title="Sets the value transform.">setValueTransform</a> ( btb );
<a name="l00033"></a>00033   
<a name="l00034"></a>00034   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> cols = <a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15a4aa71180778b711338785695df5d7c52" title="number of columns">dp::SIZE</a>;
<a name="l00035"></a>00035   <a class="code" href="classhippodraw_1_1ContourFunctionRep.html#ae963c6d828c76ea09f77a3c974b52a11" title="The table of function values from which to build the contours.">m_ntuple</a> = <span class="keyword">new</span> <a class="code" href="classhippodraw_1_1NTuple.html" title="A DataSource class implemented with std::vector&amp;lt;double&amp;gt; to store the column...">NTuple</a> ( cols );
<a name="l00036"></a>00036   <a class="code" href="classhippodraw_1_1ContourFunctionRep.html#ae963c6d828c76ea09f77a3c974b52a11" title="The table of function values from which to build the contours.">m_ntuple</a> -&gt; reserve ( <a class="code" href="classhippodraw_1_1ContourFunctionRep.html#acf467ee5692ae03de1049e67e4b1250b" title="The number of steps taken to calculate function values.">m_steps</a> * <a class="code" href="classhippodraw_1_1ContourFunctionRep.html#acf467ee5692ae03de1049e67e4b1250b" title="The number of steps taken to calculate function values.">m_steps</a> );
<a name="l00037"></a>00037   
<a name="l00038"></a>00038   vector &lt; unsigned int &gt; <a class="code" href="namespacenum__util.html#a8570d9b34e8e9d714823c1b1986764f7">shape</a> ( 3 );
<a name="l00039"></a>00039   shape[0] = m_steps;
<a name="l00040"></a>00040   shape[1] = m_steps;
<a name="l00041"></a>00041   shape[2] = 3;
<a name="l00042"></a>00042   <a class="code" href="classhippodraw_1_1ContourFunctionRep.html#ae963c6d828c76ea09f77a3c974b52a11" title="The table of function values from which to build the contours.">m_ntuple</a> -&gt; setShape ( shape );
<a name="l00043"></a>00043 }
<a name="l00044"></a>00044 
<a name="l00045"></a>00045 <a class="code" href="classhippodraw_1_1ContourFunctionRep.html#a58085707993838c07c2d99ab58a081aa" title="The destructor.">ContourFunctionRep::</a>
<a name="l00046"></a><a class="code" href="classhippodraw_1_1ContourFunctionRep.html#a58085707993838c07c2d99ab58a081aa">00046</a> <a class="code" href="classhippodraw_1_1ContourFunctionRep.html#a58085707993838c07c2d99ab58a081aa" title="The destructor.">~ContourFunctionRep</a>()
<a name="l00047"></a>00047 {
<a name="l00048"></a>00048 }
<a name="l00049"></a>00049 
<a name="l00050"></a>00050 
<a name="l00051"></a>00051 <span class="keywordtype">void</span>
<a name="l00052"></a>00052 <a class="code" href="classhippodraw_1_1ContourFunctionRep.html#af75ac6fb95f0767925ef6b355b8c7073" title="Draws a two dimension; function as contour lines.">ContourFunctionRep::</a>
<a name="l00053"></a><a class="code" href="classhippodraw_1_1ContourFunctionRep.html#af75ac6fb95f0767925ef6b355b8c7073">00053</a> <a class="code" href="classhippodraw_1_1ContourFunctionRep.html#af75ac6fb95f0767925ef6b355b8c7073" title="Draws a two dimension; function as contour lines.">drawProjectedValues</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp; x_range, <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp; y_range,
<a name="l00054"></a>00054                       <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1FunctionBase.html" title="A function that can be added to a DataRep and used in a fitter.">FunctionBase</a> * function, 
<a name="l00055"></a>00055                       <a class="code" href="classhippodraw_1_1TransformBase.html" title="A transform that transforms coordinates from one coordinate system to another.">TransformBase</a> * transform,
<a name="l00056"></a>00056                       <a class="code" href="classhippodraw_1_1ViewBase.html" title="The abstract base class for views.">ViewBase</a> * view )
<a name="l00057"></a>00057 {
<a name="l00058"></a>00058   <a class="code" href="classhippodraw_1_1ContourFunctionRep.html#ae963c6d828c76ea09f77a3c974b52a11" title="The table of function values from which to build the contours.">m_ntuple</a>-&gt; clear ();
<a name="l00059"></a>00059   
<a name="l00060"></a>00060   <span class="keywordtype">double</span> dx = x_range.<a class="code" href="classhippodraw_1_1Range.html#ad207cb443e371f73f07e874c504f60c1" title="Returns the length of the range object.">length</a>() / <a class="code" href="classhippodraw_1_1ContourFunctionRep.html#acf467ee5692ae03de1049e67e4b1250b" title="The number of steps taken to calculate function values.">m_steps</a>;
<a name="l00061"></a>00061   <span class="keywordtype">double</span> x  = x_range.<a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9" title="Returns the minimum of the range object.">low</a> () + 0.5 * dx;
<a name="l00062"></a>00062 
<a name="l00063"></a>00063   <span class="keywordtype">double</span> dy = y_range.<a class="code" href="classhippodraw_1_1Range.html#ad207cb443e371f73f07e874c504f60c1" title="Returns the length of the range object.">length</a>() / <a class="code" href="classhippodraw_1_1ContourFunctionRep.html#acf467ee5692ae03de1049e67e4b1250b" title="The number of steps taken to calculate function values.">m_steps</a>;
<a name="l00064"></a>00064   <span class="keywordtype">double</span> y_low = y_range.<a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9" title="Returns the minimum of the range object.">low</a> () + 0.5 * dy;
<a name="l00065"></a>00065 
<a name="l00066"></a>00066   vector &lt; double &gt; coord ( 2 );
<a name="l00067"></a>00067   vector &lt; double &gt; row ( <a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15a4aa71180778b711338785695df5d7c52" title="number of columns">dp::SIZE</a> );
<a name="l00068"></a>00068   row [<a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15ac577aa01d3f00f9cfae6e981756f5402" title="error on X or half bin width">dp::XERR</a>] = 0.5 * dx;
<a name="l00069"></a>00069   row [<a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15a877f1ecdc13e795de8b440216711b10d" title="error on Y">dp::YERR</a>] = 0.5 * dy;
<a name="l00070"></a>00070   row [<a class="code" href="namespacehippodraw_1_1DataPoint3DTuple.html#ae78e6e11a40e6dba1bae097358f97d15add01b24f343be1cc937a121b6bb57f66" title="error on Z">dp::ZERR</a>] = 0.;
<a name="l00071"></a>00071   
<a name="l00072"></a>00072   <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="classhippodraw_1_1ContourFunctionRep.html#acf467ee5692ae03de1049e67e4b1250b" title="The number of steps taken to calculate function values.">m_steps</a>; i++, x += dx ) {
<a name="l00073"></a>00073     coord [0] = x;
<a name="l00074"></a>00074     <span class="keywordtype">double</span> y  = y_low;
<a name="l00075"></a>00075     <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j = 0; j &lt; m_steps; j++, y += dy ) {
<a name="l00076"></a>00076       coord [1] = y;
<a name="l00077"></a>00077       <span class="keywordtype">double</span> value = function -&gt; operator() ( coord );
<a name="l00078"></a>00078 
<a name="l00079"></a>00079       row[<a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7a58833a3110c570fb05130d40c365d1e4" title="X axis.">dp::X</a>] = x;
<a name="l00080"></a>00080       row[<a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7a5596231eabd6cf29050967d5ac83ad84" title="Y axis.">dp::Y</a>] = y;
<a name="l00081"></a>00081       row[<a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7aa70478ce277ffc322f8e1e3418e07355" title="Z axis.">dp::Z</a>] = value;
<a name="l00082"></a>00082       
<a name="l00083"></a>00083       <a class="code" href="classhippodraw_1_1ContourFunctionRep.html#ae963c6d828c76ea09f77a3c974b52a11" title="The table of function values from which to build the contours.">m_ntuple</a> -&gt; addRow ( row );
<a name="l00084"></a>00084     } 
<a name="l00085"></a>00085   }
<a name="l00086"></a>00086 
<a name="l00087"></a>00087   <a class="code" href="classhippodraw_1_1ContourFunctionRep.html#af75ac6fb95f0767925ef6b355b8c7073" title="Draws a two dimension; function as contour lines.">ContourPointRep::drawProjectedValues</a> ( <a class="code" href="classhippodraw_1_1ContourFunctionRep.html#ae963c6d828c76ea09f77a3c974b52a11" title="The table of function values from which to build the contours.">m_ntuple</a>, transform, view );
<a name="l00088"></a>00088 }
<a name="l00089"></a>00089 
<a name="l00090"></a>00090 } <span class="comment">// namespace hippodraw</span>
<a name="l00091"></a>00091 
</pre></div></div>
<hr size="1"><address style="align: right;"><small>
Generated for HippoDraw Class Library by <a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0>
</a> </small></address>
</body>
</html>