<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 Page</span></a></li> <li><a href="pages.html"><span>Related 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 List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="dir_d1aed8900ec9d9a2c165e57f18bd6f10.html">axes</a> </div> </div> <div class="contents"> <h1>Range.cxx</h1><a href="Range_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">#ifdef _MSC_VER</span> <a name="l00013"></a>00013 <span class="preprocessor"></span><span class="comment">// Include max() and min() missing from MicroSoft Visual C++.</span> <a name="l00014"></a>00014 <span class="preprocessor">#include "msdevstudio/MSconfig.h"</span> <a name="l00015"></a>00015 <span class="preprocessor">#endif</span> <a name="l00016"></a>00016 <span class="preprocessor"></span> <a name="l00017"></a>00017 <span class="preprocessor">#include "<a class="code" href="Range_8h.html" title="hippodraw::Range class interface">Range.h</a>"</span> <a name="l00018"></a>00018 <a name="l00019"></a>00019 <span class="preprocessor">#include <algorithm></span> <a name="l00020"></a>00020 <a name="l00021"></a>00021 <span class="preprocessor">#include <cassert></span> <a name="l00022"></a>00022 <span class="preprocessor">#include <cmath></span> <a name="l00023"></a>00023 <span class="preprocessor">#include <ostream></span> <a name="l00024"></a>00024 <a name="l00025"></a>00025 <span class="preprocessor">#ifndef _MSC_VER</span> <a name="l00026"></a>00026 <span class="preprocessor"></span><span class="keyword">using</span> std::floor; <a name="l00027"></a>00027 <span class="preprocessor">#endif</span> <a name="l00028"></a>00028 <span class="preprocessor"></span> <a name="l00029"></a>00029 <span class="keyword">using</span> std::ostream; <a name="l00030"></a>00030 <span class="keyword">using</span> std::max; <a name="l00031"></a>00031 <span class="keyword">using</span> std::min; <a name="l00032"></a>00032 <span class="keyword">using</span> std::vector; <a name="l00033"></a>00033 <a name="l00034"></a>00034 <span class="keyword">using namespace </span>hippodraw; <a name="l00035"></a>00035 <a name="l00036"></a><a class="code" href="classhippodraw_1_1Range.html#afa61e339c5d7dd76c25663fc2718da8a">00036</a> Range::Range ( ) <a name="l00037"></a>00037 : m_min( 0.0 ), <a name="l00038"></a>00038 m_max( 0.0 ), <a name="l00039"></a>00039 m_pos( DBL_MAX ), <a name="l00040"></a>00040 m_empty( true ) <a name="l00041"></a>00041 { <a name="l00042"></a>00042 } <a name="l00043"></a>00043 <a name="l00044"></a><a class="code" href="classhippodraw_1_1Range.html#a893d8234300eaa323b48d68fcef3f4db">00044</a> <a class="code" href="classhippodraw_1_1Range.html#afa61e339c5d7dd76c25663fc2718da8a" title="The following constructors sets the range to {0.0, 0.0} but sets m_empty to true...">Range::Range</a> ( <span class="keywordtype">double</span> x, <span class="keywordtype">double</span> y, <span class="keywordtype">double</span> p ) <a name="l00045"></a>00045 { <a name="l00046"></a>00046 <a name="l00047"></a>00047 <span class="comment">// x and y are being passed as 'nan' in some cases, leading to failure</span> <a name="l00048"></a>00048 <span class="comment">// of assertion below. I dont know why they are being passed as nan and</span> <a name="l00049"></a>00049 <span class="comment">// from where.</span> <a name="l00050"></a>00050 <a name="l00051"></a>00051 <span class="keywordflow">if</span> ( x > y ) { <a name="l00052"></a>00052 <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> = 0; <a name="l00053"></a>00053 <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> = 0; <a name="l00054"></a>00054 <a class="code" href="classhippodraw_1_1Range.html#a0f2dc708a2d9dc5aa37c32f2c36e734d" title="The minimum positive value in the range, for log scale.">m_pos</a> = DBL_MAX; <a name="l00055"></a>00055 <a class="code" href="classhippodraw_1_1Range.html#ac21f18624d637a3e48f64730fb79c479" title="A flag indicating that the range is empty.">m_empty</a> = <span class="keyword">true</span>; <a name="l00056"></a>00056 } <a name="l00057"></a>00057 <span class="keywordflow">else</span>{ <a name="l00058"></a>00058 <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> = x; <a name="l00059"></a>00059 <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> = y; <a name="l00060"></a>00060 <a class="code" href="classhippodraw_1_1Range.html#a0f2dc708a2d9dc5aa37c32f2c36e734d" title="The minimum positive value in the range, for log scale.">m_pos</a> = p; <a name="l00061"></a>00061 <a class="code" href="classhippodraw_1_1Range.html#ac21f18624d637a3e48f64730fb79c479" title="A flag indicating that the range is empty.">m_empty</a> = <span class="keyword">false</span>; <a name="l00062"></a>00062 } <a name="l00063"></a>00063 <a name="l00064"></a>00064 <span class="comment">// This assertion is failing.</span> <a name="l00065"></a>00065 <span class="comment">//assert ( m_min <= m_max );</span> <a name="l00066"></a>00066 <a name="l00067"></a>00067 <span class="comment">//This is a dirty fix:</span> <a name="l00068"></a>00068 <span class="keywordflow">if</span> ( ! ( <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> <= <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> ) ){ <a name="l00069"></a>00069 <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> = 0; <a name="l00070"></a>00070 <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> = 0.1; <a name="l00071"></a>00071 <a class="code" href="classhippodraw_1_1Range.html#a0f2dc708a2d9dc5aa37c32f2c36e734d" title="The minimum positive value in the range, for log scale.">m_pos</a> = DBL_MAX; <a name="l00072"></a>00072 <a class="code" href="classhippodraw_1_1Range.html#ac21f18624d637a3e48f64730fb79c479" title="A flag indicating that the range is empty.">m_empty</a> = <span class="keyword">true</span>; <a name="l00073"></a>00073 } <a name="l00074"></a>00074 <a name="l00075"></a>00075 assert ( <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> <= <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> ); <a name="l00076"></a>00076 <a name="l00077"></a>00077 } <a name="l00078"></a>00078 <a name="l00079"></a>00079 <a class="code" href="classhippodraw_1_1Range.html#afa61e339c5d7dd76c25663fc2718da8a" title="The following constructors sets the range to {0.0, 0.0} but sets m_empty to true...">Range::</a> <a name="l00080"></a><a class="code" href="classhippodraw_1_1Range.html#a5c491a566e0faffcc8131b967cba22eb">00080</a> <a class="code" href="classhippodraw_1_1Range.html#afa61e339c5d7dd76c25663fc2718da8a" title="The following constructors sets the range to {0.0, 0.0} but sets m_empty to true...">Range</a> ( <span class="keyword">const</span> std::vector < double > & array ) <a name="l00081"></a>00081 { <a name="l00082"></a>00082 <a class="code" href="classhippodraw_1_1Range.html#addffd7d4904f8f6261dae4e2cb51b734" title="Changes the current Range.">setRange</a> ( array.begin(), array.end () ); <a name="l00083"></a>00083 } <a name="l00084"></a>00084 <a name="l00085"></a>00085 <span class="keywordtype">double</span> <a name="l00086"></a><a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9">00086</a> <a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9" title="Returns the minimum of the range object.">Range::low</a>()<span class="keyword"> const</span> <a name="l00087"></a>00087 <span class="keyword"></span>{ <a name="l00088"></a>00088 <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a>; <a name="l00089"></a>00089 } <a name="l00090"></a>00090 <a name="l00091"></a>00091 <span class="keywordtype">void</span> <a name="l00092"></a><a class="code" href="classhippodraw_1_1Range.html#a2618a41860251089e4ab57a83429c27f">00092</a> <a class="code" href="classhippodraw_1_1Range.html#a2618a41860251089e4ab57a83429c27f" title="Sets the minimum of the range object.">Range::setLow</a> ( <span class="keywordtype">double</span> x ) <a name="l00093"></a>00093 { <a name="l00094"></a>00094 <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> = x; <a name="l00095"></a>00095 assert ( <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> <= <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> ); <a name="l00096"></a>00096 } <a name="l00097"></a>00097 <a name="l00098"></a>00098 <span class="keywordtype">double</span> <a name="l00099"></a><a class="code" href="classhippodraw_1_1Range.html#a10f7231db7f0fe0855fc344e98575714">00099</a> <a class="code" href="classhippodraw_1_1Range.html#a10f7231db7f0fe0855fc344e98575714" title="Returns the maximum of the range object.">Range::high</a>()<span class="keyword"> const</span> <a name="l00100"></a>00100 <span class="keyword"></span>{ <a name="l00101"></a>00101 <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a>; <a name="l00102"></a>00102 } <a name="l00103"></a>00103 <a name="l00104"></a>00104 <span class="keywordtype">void</span> <a name="l00105"></a><a class="code" href="classhippodraw_1_1Range.html#a57518687fc2be69b208d7424048b9baa">00105</a> <a class="code" href="classhippodraw_1_1Range.html#a57518687fc2be69b208d7424048b9baa" title="Sets the maximum of the range object.">Range::setHigh</a> ( <span class="keywordtype">double</span> x ) <a name="l00106"></a>00106 { <a name="l00107"></a>00107 <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> = x; <a name="l00108"></a>00108 assert ( <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> <= <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> ); <a name="l00109"></a>00109 } <a name="l00110"></a>00110 <a name="l00111"></a>00111 <span class="keywordtype">double</span> <a name="l00112"></a><a class="code" href="classhippodraw_1_1Range.html#a4b02f1648e2efd2c179f8398b350285b">00112</a> <a class="code" href="classhippodraw_1_1Range.html#a4b02f1648e2efd2c179f8398b350285b" title="Returns the first positive element in range.">Range::pos</a>()<span class="keyword"> const</span> <a name="l00113"></a>00113 <span class="keyword"></span>{ <a name="l00114"></a>00114 <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1Range.html#a0f2dc708a2d9dc5aa37c32f2c36e734d" title="The minimum positive value in the range, for log scale.">m_pos</a>; <a name="l00115"></a>00115 } <a name="l00116"></a>00116 <a name="l00117"></a>00117 <span class="keywordtype">void</span> <a name="l00118"></a><a class="code" href="classhippodraw_1_1Range.html#aa68d6e844913778c3aeb6b509dbef8f2">00118</a> <a class="code" href="classhippodraw_1_1Range.html#aa68d6e844913778c3aeb6b509dbef8f2" title="Sets the first positive element in range.">Range::setPos</a> (<span class="keywordtype">double</span> x) <a name="l00119"></a>00119 { <a name="l00120"></a>00120 <a class="code" href="classhippodraw_1_1Range.html#a0f2dc708a2d9dc5aa37c32f2c36e734d" title="The minimum positive value in the range, for log scale.">m_pos</a> = x; <a name="l00121"></a>00121 assert ( <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> <= <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> ); <a name="l00122"></a>00122 } <a name="l00123"></a>00123 <a name="l00124"></a>00124 <span class="keywordtype">void</span> <a name="l00125"></a><a class="code" href="classhippodraw_1_1Range.html#addffd7d4904f8f6261dae4e2cb51b734">00125</a> <a class="code" href="classhippodraw_1_1Range.html#addffd7d4904f8f6261dae4e2cb51b734" title="Changes the current Range.">Range::setRange</a> ( <span class="keywordtype">double</span> low, <span class="keywordtype">double</span> high, <span class="keywordtype">double</span> pos ) <a name="l00126"></a>00126 { <a name="l00127"></a>00127 <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> = low; <a name="l00128"></a>00128 <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> = high; <a name="l00129"></a>00129 <a class="code" href="classhippodraw_1_1Range.html#a0f2dc708a2d9dc5aa37c32f2c36e734d" title="The minimum positive value in the range, for log scale.">m_pos</a> = pos; <a name="l00130"></a>00130 assert ( <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> <= <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> ); <a name="l00131"></a>00131 } <a name="l00132"></a>00132 <a name="l00133"></a>00133 <span class="keywordtype">void</span> <a name="l00134"></a><a class="code" href="classhippodraw_1_1Range.html#a351c05149e0c2de1ad130b9c13bd2cb3">00134</a> <a class="code" href="classhippodraw_1_1Range.html#a351c05149e0c2de1ad130b9c13bd2cb3" title="Sets the length of the range.">Range::setLength</a> ( <span class="keywordtype">double</span> val, <span class="keywordtype">bool</span> high_hold ) <a name="l00135"></a>00135 { <a name="l00136"></a>00136 <span class="keywordflow">if</span>( high_hold ){ <a name="l00137"></a>00137 <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> = <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> - val; <a name="l00138"></a>00138 } <span class="keywordflow">else</span> { <a name="l00139"></a>00139 <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> = <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> + val; <a name="l00140"></a>00140 } <a name="l00141"></a>00141 assert ( <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> <= <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> ); <a name="l00142"></a>00142 } <a name="l00143"></a>00143 <a name="l00144"></a>00144 <span class="keywordtype">bool</span> <a name="l00145"></a><a class="code" href="classhippodraw_1_1Range.html#acd177035de6a486f16f65dd95e8e6c46">00145</a> <a class="code" href="classhippodraw_1_1Range.html#acd177035de6a486f16f65dd95e8e6c46" title="Returns true if the argument value is inside the range.">Range::includes</a> ( <span class="keywordtype">double</span> val )<span class="keyword"> const</span> <a name="l00146"></a>00146 <span class="keyword"></span>{ <a name="l00147"></a>00147 <span class="keywordflow">return</span> val >= <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> && val <= <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a>; <a name="l00148"></a>00148 } <a name="l00149"></a>00149 <a name="l00150"></a>00150 <span class="keywordtype">bool</span> <a name="l00151"></a>00151 <a class="code" href="classhippodraw_1_1Range.html#a1062a86b983b84980e86256108d50e53" title="Returns true if the argument value is outside the range.">Range::</a> <a name="l00152"></a><a class="code" href="classhippodraw_1_1Range.html#a1062a86b983b84980e86256108d50e53">00152</a> <a class="code" href="classhippodraw_1_1Range.html#a1062a86b983b84980e86256108d50e53" title="Returns true if the argument value is outside the range.">excludes</a> ( <span class="keywordtype">double</span> value )<span class="keyword"> const</span> <a name="l00153"></a>00153 <span class="keyword"></span>{ <a name="l00154"></a>00154 <span class="keywordflow">return</span> value < m_min || value > <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a>; <a name="l00155"></a>00155 } <a name="l00156"></a>00156 <a name="l00157"></a>00157 <span class="keywordtype">double</span> <a name="l00158"></a>00158 <a class="code" href="classhippodraw_1_1Range.html#a5204cd27f4aa3ed971ec90fb269594d1" title="Returns the fraction of the range that value represents.">Range::</a> <a name="l00159"></a><a class="code" href="classhippodraw_1_1Range.html#a5204cd27f4aa3ed971ec90fb269594d1">00159</a> <a class="code" href="classhippodraw_1_1Range.html#a5204cd27f4aa3ed971ec90fb269594d1" title="Returns the fraction of the range that value represents.">fraction</a> ( <span class="keywordtype">double</span> value )<span class="keyword"> const</span> <a name="l00160"></a>00160 <span class="keyword"></span>{ <a name="l00161"></a>00161 <span class="keywordflow">return</span> ( value - <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> ) / ( <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> - <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> ); <a name="l00162"></a>00162 } <a name="l00163"></a>00163 <a name="l00164"></a><a class="code" href="classhippodraw_1_1Range.html#ac50078a13b75f1d0b50fc233d2874fbc">00164</a> <span class="keywordtype">void</span> <a class="code" href="classhippodraw_1_1Range.html#ac50078a13b75f1d0b50fc233d2874fbc" title="Sets the range to empty.">Range::setEmpty</a> ( <span class="keywordtype">bool</span> yes ) <a name="l00165"></a>00165 { <a name="l00166"></a>00166 <a class="code" href="classhippodraw_1_1Range.html#ac21f18624d637a3e48f64730fb79c479" title="A flag indicating that the range is empty.">m_empty</a> = yes; <a name="l00167"></a>00167 } <a name="l00168"></a>00168 <a name="l00169"></a><a class="code" href="classhippodraw_1_1Range.html#ab05916911b0d4c4c64403cef68d336b4">00169</a> <span class="keywordtype">void</span> <a class="code" href="classhippodraw_1_1Range.html#ab05916911b0d4c4c64403cef68d336b4" title="Forms the union with the range range.">Range::setUnion</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> & range ) <a name="l00170"></a>00170 { <a name="l00171"></a>00171 <span class="keywordflow">if</span> ( <a class="code" href="classhippodraw_1_1Range.html#ac21f18624d637a3e48f64730fb79c479" title="A flag indicating that the range is empty.">m_empty</a> ) { <a name="l00172"></a>00172 <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> = range.<a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a>; <a name="l00173"></a>00173 <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> = range.<a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a>; <a name="l00174"></a>00174 <a class="code" href="classhippodraw_1_1Range.html#a0f2dc708a2d9dc5aa37c32f2c36e734d" title="The minimum positive value in the range, for log scale.">m_pos</a> = range.<a class="code" href="classhippodraw_1_1Range.html#a0f2dc708a2d9dc5aa37c32f2c36e734d" title="The minimum positive value in the range, for log scale.">m_pos</a>; <a name="l00175"></a>00175 <a class="code" href="classhippodraw_1_1Range.html#ac21f18624d637a3e48f64730fb79c479" title="A flag indicating that the range is empty.">m_empty</a> = <span class="keyword">false</span>; <a name="l00176"></a>00176 } <a name="l00177"></a>00177 <span class="keywordflow">else</span> { <a name="l00178"></a>00178 <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> = min ( <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a>, range.<a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> ); <a name="l00179"></a>00179 <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> = max ( <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a>, range.<a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> ); <a name="l00180"></a>00180 <a class="code" href="classhippodraw_1_1Range.html#a0f2dc708a2d9dc5aa37c32f2c36e734d" title="The minimum positive value in the range, for log scale.">m_pos</a> = min ( <a class="code" href="classhippodraw_1_1Range.html#a0f2dc708a2d9dc5aa37c32f2c36e734d" title="The minimum positive value in the range, for log scale.">m_pos</a>, range.<a class="code" href="classhippodraw_1_1Range.html#a0f2dc708a2d9dc5aa37c32f2c36e734d" title="The minimum positive value in the range, for log scale.">m_pos</a> ); <a name="l00181"></a>00181 } <a name="l00182"></a>00182 <a name="l00183"></a>00183 assert ( <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> <= <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> ); <a name="l00184"></a>00184 <a name="l00185"></a>00185 } <a name="l00186"></a>00186 <a name="l00187"></a><a class="code" href="classhippodraw_1_1Range.html#ad682f5ca049b6fc2149e152d6ec29444">00187</a> <span class="keywordtype">void</span> <a class="code" href="classhippodraw_1_1Range.html#ad682f5ca049b6fc2149e152d6ec29444" title="Forms the intersect with the range in the argument.">Range::setIntersect</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> & range ) <a name="l00188"></a>00188 { <a name="l00189"></a>00189 <span class="keywordflow">if</span> ( <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> > range.<a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> || <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> < range.<a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> ) <span class="keywordflow">return</span>; <a name="l00190"></a>00190 <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> = max ( <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a>, range.<a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> ); <a name="l00191"></a>00191 <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> = min ( <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a>, range.<a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> ); <a name="l00192"></a>00192 <a class="code" href="classhippodraw_1_1Range.html#a0f2dc708a2d9dc5aa37c32f2c36e734d" title="The minimum positive value in the range, for log scale.">m_pos</a> = max ( <a class="code" href="classhippodraw_1_1Range.html#a0f2dc708a2d9dc5aa37c32f2c36e734d" title="The minimum positive value in the range, for log scale.">m_pos</a>, range.<a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> ); <a name="l00193"></a>00193 <a name="l00194"></a>00194 assert ( <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> <= <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> ); <a name="l00195"></a>00195 } <a name="l00196"></a>00196 <a name="l00197"></a>00197 <span class="keywordtype">int</span> <a name="l00198"></a><a class="code" href="classhippodraw_1_1Range.html#aac7ad60dfb481e246f610964a7c9f327">00198</a> <a class="code" href="classhippodraw_1_1Range.html#aac7ad60dfb481e246f610964a7c9f327" title="Returns the number of bins of width width required to fill the range.">Range::numberOfBins</a> ( <span class="keywordtype">double</span> width )<span class="keyword"> const</span> <a name="l00199"></a>00199 <span class="keyword"></span>{ <a name="l00200"></a>00200 assert ( <a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> > <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a> ); <a name="l00201"></a>00201 <span class="keywordtype">double</span> number = (<a class="code" href="classhippodraw_1_1Range.html#acf06000c1aa1991f025243b032b5dcad" title="The maximum in the range.">m_max</a> - <a class="code" href="classhippodraw_1_1Range.html#a373432986a680c846c5917927a926992" title="The minimum in the range.">m_min</a>) / width; <a name="l00202"></a>00202 <a name="l00203"></a>00203 <span class="preprocessor">#ifdef _MSC_VER</span> <a name="l00204"></a>00204 <span class="preprocessor"></span> <span class="keywordflow">return</span> static_cast < <span class="keywordtype">int</span> > ( number+0.5 ); <a name="l00205"></a>00205 <span class="preprocessor">#else</span> <a name="l00206"></a>00206 <span class="preprocessor"></span> <span class="keywordflow">return</span> static_cast < <span class="keywordtype">int</span> > ( rint( number ) ); <a name="l00207"></a>00207 <span class="preprocessor">#endif</span> <a name="l00208"></a>00208 <span class="preprocessor"></span>} </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>