Sophie

Sophie

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

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_e91d7d57230b93275afa36a649c1c346.html">colorreps</a>
  </div>
</div>
<div class="contents">
<h1>BinToKamaeScale.cxx</h1><a href="BinToKamaeScale_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="BinToKamaeScale_8h.html" title="BinToKamaeScale class interface.">BinToKamaeScale.h</a>&quot;</span>
<a name="l00013"></a>00013 
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;cmath&gt;</span>
<a name="l00015"></a>00015 
<a name="l00016"></a>00016 <span class="preprocessor">#include &lt;cassert&gt;</span>
<a name="l00017"></a>00017 
<a name="l00018"></a>00018 <span class="keyword">namespace </span>hippodraw {
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <a class="code" href="classhippodraw_1_1BinToKamaeScale.html#a2d1935e6bd725c9058aafab0806ee1b6" title="The constructor.">BinToKamaeScale::</a>
<a name="l00021"></a><a class="code" href="classhippodraw_1_1BinToKamaeScale.html#a2d1935e6bd725c9058aafab0806ee1b6">00021</a> <a class="code" href="classhippodraw_1_1BinToKamaeScale.html#a2d1935e6bd725c9058aafab0806ee1b6" title="The constructor.">BinToKamaeScale</a> ( <span class="keyword">const</span> <span class="keywordtype">char</span> * name )
<a name="l00022"></a>00022   : <a class="code" href="classhippodraw_1_1BinToColor.html" title="The base class for the value to the color transformation.">BinToColor</a> ( name )
<a name="l00023"></a>00023 {
<a name="l00024"></a>00024 }
<a name="l00025"></a>00025 
<a name="l00026"></a><a class="code" href="classhippodraw_1_1BinToKamaeScale.html#a62e7d1d73a551a0980ef23061eb0e36b">00026</a> <a class="code" href="classhippodraw_1_1BinToKamaeScale.html#a2d1935e6bd725c9058aafab0806ee1b6" title="The constructor.">BinToKamaeScale::BinToKamaeScale</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1BinToKamaeScale.html" title="The class derived from the BinToColor class.">BinToKamaeScale</a> &amp; bin_to_color )
<a name="l00027"></a>00027   : <a class="code" href="classhippodraw_1_1BinToColor.html" title="The base class for the value to the color transformation.">BinToColor</a> ( bin_to_color )
<a name="l00028"></a>00028 {
<a name="l00029"></a>00029 }
<a name="l00030"></a>00030 
<a name="l00031"></a><a class="code" href="classhippodraw_1_1BinToKamaeScale.html#acf2d9ae0de44b8efbce24084b3ea5184">00031</a> <a class="code" href="classhippodraw_1_1BinToColor.html" title="The base class for the value to the color transformation.">BinToColor</a> * <a class="code" href="classhippodraw_1_1BinToKamaeScale.html#acf2d9ae0de44b8efbce24084b3ea5184" title="Creates a copy of itself.">BinToKamaeScale:: clone</a> ()<span class="keyword"> const</span>
<a name="l00032"></a>00032 <span class="keyword"></span>{
<a name="l00033"></a>00033   <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classhippodraw_1_1BinToKamaeScale.html#a2d1935e6bd725c9058aafab0806ee1b6" title="The constructor.">BinToKamaeScale</a> ( *<span class="keyword">this</span> );
<a name="l00034"></a>00034 }
<a name="l00035"></a>00035 
<a name="l00036"></a>00036 <span class="keywordtype">void</span>
<a name="l00037"></a>00037 <a class="code" href="classhippodraw_1_1BinToKamaeScale.html#a63a596c7bccb4282016c1a5a4f0cf8a0" title="This function does the actual calculation that transforms the given value into a...">BinToKamaeScale::</a>
<a name="l00038"></a><a class="code" href="classhippodraw_1_1BinToKamaeScale.html#a63a596c7bccb4282016c1a5a4f0cf8a0">00038</a> <a class="code" href="classhippodraw_1_1BinToKamaeScale.html#a63a596c7bccb4282016c1a5a4f0cf8a0" title="This function does the actual calculation that transforms the given value into a...">doubleToColor</a> ( <span class="keywordtype">double</span> value, <a class="code" href="classhippodraw_1_1Color.html" title="A Color class for creating the color object following the standard RGB color space...">Color</a> &amp; color )<span class="keyword"> const</span>
<a name="l00039"></a>00039 <span class="keyword"></span>{
<a name="l00040"></a>00040    <span class="keywordtype">double</span> z = ( value - <a class="code" href="classhippodraw_1_1BinToColor.html#a48e433b9625c7e774073dce89c270905" title="The minimum value expected.">m_vmin</a> ) / <a class="code" href="classhippodraw_1_1BinToColor.html#ae9fd181c15aa94a45d97274d011e7b26" title="The distance of the expected values, i.e.">m_dv</a>;
<a name="l00041"></a>00041    z = std::max ( 0.0, z );
<a name="l00042"></a>00042    z = std::min ( 1.0, z );
<a name="l00043"></a>00043 
<a name="l00044"></a>00044    <span class="keywordtype">double</span> r = std::min ( 255., 
<a name="l00045"></a>00045                          113.9 * sin ( 7.64 * pow ( z, 1.705 ) + 0.701 )
<a name="l00046"></a>00046                          - 916.1 * pow ( ( z + 1.755), 1.862 )
<a name="l00047"></a>00047                          + 3587.9 * z + 2563.4 );
<a name="l00048"></a>00048    <span class="keywordtype">double</span> g = std::min ( 255.,
<a name="l00049"></a>00049                          70.0 * sin ( 8.7 * pow ( z, 1.26 ) - 2.418 )
<a name="l00050"></a>00050                          + 151.7 * pow ( z, 0.5 )
<a name="l00051"></a>00051                          + 70.0 );
<a name="l00052"></a>00052    <span class="keywordtype">double</span> b = std::min ( 255.,
<a name="l00053"></a>00053                          194.5 * pow ( z, 2.88 )
<a name="l00054"></a>00054                          + 99.72 * exp ( -77.24 *pow ( z - 0.742, 2 ) )
<a name="l00055"></a>00055                          + 45.4 * pow ( z, 0.089 )
<a name="l00056"></a>00056                          + 10.0 );
<a name="l00057"></a>00057 
<a name="l00058"></a>00058    <span class="keywordtype">int</span> red   = static_cast &lt; <span class="keywordtype">int</span> &gt; ( r );
<a name="l00059"></a>00059    <span class="keywordtype">int</span> green = static_cast &lt; <span class="keywordtype">int</span> &gt; ( g );
<a name="l00060"></a>00060    <span class="keywordtype">int</span> blue  = static_cast &lt; <span class="keywordtype">int</span> &gt; ( b );
<a name="l00061"></a>00061 
<a name="l00062"></a>00062    assert ( red &lt; 256 &amp;&amp; green &lt; 256 &amp;&amp; blue &lt; 256 );
<a name="l00063"></a>00063    color.<a class="code" href="classhippodraw_1_1Color.html#aff0b32998d700c5a25a89f1b0304b035" title="Sets the color.">setColor</a> ( red, green, blue );
<a name="l00064"></a>00064 }
<a name="l00065"></a>00065 
<a name="l00066"></a>00066 } <span class="comment">// namespace hippodraw</span>
<a name="l00067"></a>00067 
</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>