<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>Mercator: Segment.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.3 --> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">Mercator</div> </td> </tr> </tbody> </table> </div> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</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> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> </ul> </div> <div class="header"> <div class="headertitle"> <h1>Segment.h</h1> </div> </div> <div class="contents"> <div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// This file may be redistributed and modified only under the terms of</span> <a name="l00002"></a>00002 <span class="comment">// the GNU General Public License (See COPYING for details).</span> <a name="l00003"></a>00003 <span class="comment">// Copyright (C) 2003 Alistair Riddoch, Damien McGinnes</span> <a name="l00004"></a>00004 <a name="l00005"></a>00005 <span class="preprocessor">#ifndef MERCATOR_SEGMENT_H</span> <a name="l00006"></a>00006 <span class="preprocessor"></span><span class="preprocessor">#define MERCATOR_SEGMENT_H</span> <a name="l00007"></a>00007 <span class="preprocessor"></span> <a name="l00008"></a>00008 <span class="preprocessor">#include <Mercator/Mercator.h></span> <a name="l00009"></a>00009 <span class="preprocessor">#include <Mercator/Matrix.h></span> <a name="l00010"></a>00010 <span class="preprocessor">#include <Mercator/BasePoint.h></span> <a name="l00011"></a>00011 <a name="l00012"></a>00012 <span class="preprocessor">#include <wfmath/vector.h></span> <a name="l00013"></a>00013 <span class="preprocessor">#include <wfmath/axisbox.h></span> <a name="l00014"></a>00014 <a name="l00015"></a>00015 <span class="preprocessor">#include <set></span> <a name="l00016"></a>00016 <span class="preprocessor">#include <map></span> <a name="l00017"></a>00017 <a name="l00018"></a>00018 <span class="keyword">namespace </span>Mercator { <a name="l00019"></a>00019 <a name="l00020"></a>00020 <span class="keyword">class </span>Terrain; <a name="l00021"></a>00021 <span class="keyword">class </span>Surface; <a name="l00022"></a>00022 <span class="keyword">class </span>TerrainMod; <a name="l00023"></a>00023 <span class="keyword">typedef</span> std::set<TerrainMod *> ModList; <a name="l00024"></a>00024 <span class="keyword">class </span>Area; <a name="l00025"></a>00025 <a name="l00026"></a>00026 <span class="comment">// This class will need to be reference counted if we want the code to</span> <a name="l00027"></a>00027 <span class="comment">// be able to hold onto it, as currently they get deleted internally</span> <a name="l00028"></a>00028 <span class="comment">// whenever height points are asserted.</span> <a name="l00029"></a>00029 <a name="l00032"></a><a class="code" href="classMercator_1_1Segment.html">00032</a> <span class="keyword">class </span><a class="code" href="classMercator_1_1Segment.html" title="Class storing heightfield and other data for a single fixed size square area of terrain defined by fo...">Segment</a> { <a name="l00033"></a>00033 <span class="keyword">public</span>: <a name="l00035"></a><a class="code" href="classMercator_1_1Segment.html#a4a47008ac7949b6958f07159b3e82262">00035</a> <span class="keyword">typedef</span> std::map<int, Surface *> <a class="code" href="classMercator_1_1Segment.html#a4a47008ac7949b6958f07159b3e82262" title="STL map of pointers to Surface objects.">Surfacestore</a>; <a name="l00036"></a>00036 <a name="l00038"></a><a class="code" href="classMercator_1_1Segment.html#ad3aa3e9f341da2ed35fb417d5c0961f7">00038</a> <span class="keyword">typedef</span> std::multimap<int, Area *> <a class="code" href="classMercator_1_1Segment.html#ad3aa3e9f341da2ed35fb417d5c0961f7" title="STL multimap of pointers to Area objects affecting this segment.">Areastore</a>; <a name="l00039"></a>00039 <span class="keyword">private</span>: <a name="l00041"></a><a class="code" href="classMercator_1_1Segment.html#abd9c19268851728d53a0032e6fa0a78c">00041</a> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classMercator_1_1Segment.html#abd9c19268851728d53a0032e6fa0a78c" title="Distance between segments.">m_res</a>; <a name="l00043"></a><a class="code" href="classMercator_1_1Segment.html#a491907412d4eb428e2347eee96b05a28">00043</a> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classMercator_1_1Segment.html#a491907412d4eb428e2347eee96b05a28" title="Size of segment, m_res + 1.">m_size</a>; <a name="l00045"></a><a class="code" href="classMercator_1_1Segment.html#ad1277eafb57d7b03b03a53736307e375">00045</a> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classMercator_1_1Segment.html#ad1277eafb57d7b03b03a53736307e375" title="Global x reference of this segment.">m_xRef</a>; <a name="l00047"></a><a class="code" href="classMercator_1_1Segment.html#aee621475381f71afa25e89f830ab0d45">00047</a> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classMercator_1_1Segment.html#aee621475381f71afa25e89f830ab0d45" title="Global y reference of this segment.">m_yRef</a>; <a name="l00049"></a><a class="code" href="classMercator_1_1Segment.html#a21d4394ff5c5e586410bf9c7dea6b6af">00049</a> <a class="code" href="classMercator_1_1Matrix.html">Matrix<2, 2, BasePoint></a> <a class="code" href="classMercator_1_1Segment.html#a21d4394ff5c5e586410bf9c7dea6b6af" title="2x2 matrix of points which control this segment">m_controlPoints</a>; <a name="l00051"></a><a class="code" href="classMercator_1_1Segment.html#ac22600d95051cd017f53f10fca12a20e">00051</a> <span class="keywordtype">float</span> * <a class="code" href="classMercator_1_1Segment.html#ac22600d95051cd017f53f10fca12a20e" title="Pointer to buffer containing height points.">m_points</a>; <a name="l00053"></a><a class="code" href="classMercator_1_1Segment.html#ac0b0f720ce76aab5d6dcebfcd5469ed6">00053</a> <span class="keywordtype">float</span> * <a class="code" href="classMercator_1_1Segment.html#ac0b0f720ce76aab5d6dcebfcd5469ed6" title="Pointer to buffer containing normals for height points.">m_normals</a>; <a name="l00055"></a><a class="code" href="classMercator_1_1Segment.html#a771ad07baa6490732728ab150fd11b9d">00055</a> <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1Segment.html#a771ad07baa6490732728ab150fd11b9d" title="Maximum height of any point in this segment.">m_max</a>; <a name="l00057"></a><a class="code" href="classMercator_1_1Segment.html#a18c43d5280f8072849cac10927296a2b">00057</a> <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1Segment.html#a18c43d5280f8072849cac10927296a2b" title="Minimum height of any point in this segment.">m_min</a>; <a name="l00058"></a>00058 <a name="l00060"></a><a class="code" href="classMercator_1_1Segment.html#a14403c34b1b0668886484b2f569064e3">00060</a> <a class="code" href="classMercator_1_1Segment.html#a4a47008ac7949b6958f07159b3e82262" title="STL map of pointers to Surface objects.">Surfacestore</a> <a class="code" href="classMercator_1_1Segment.html#a14403c34b1b0668886484b2f569064e3" title="Store of surfaces which can be rendered on this terrain.">m_surfaces</a>; <a name="l00061"></a>00061 <a name="l00063"></a><a class="code" href="classMercator_1_1Segment.html#ab63a28adb71347baccdffd5eab91f58a">00063</a> <a class="code" href="classMercator_1_1Segment.html#ad3aa3e9f341da2ed35fb417d5c0961f7" title="STL multimap of pointers to Area objects affecting this segment.">Areastore</a> <a class="code" href="classMercator_1_1Segment.html#ab63a28adb71347baccdffd5eab91f58a" title="Areas which intersect this segment.">m_areas</a>; <a name="l00064"></a>00064 <span class="keyword">public</span>: <a name="l00065"></a>00065 <span class="keyword">explicit</span> <a class="code" href="classMercator_1_1Segment.html#a52dcdd9bf2119d4be307ec4a4cc200ca" title="Construct an empty segment with the given resolution.">Segment</a>(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> resolution); <a name="l00066"></a>00066 <a class="code" href="classMercator_1_1Segment.html#afb36a3fda77564d705e72edf4fe80c04" title="Destruct the Segment.">~Segment</a>(); <a name="l00067"></a>00067 <a name="l00069"></a><a class="code" href="classMercator_1_1Segment.html#a0d84f96353ff60732a60b39609f127c2">00069</a> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classMercator_1_1Segment.html#a0d84f96353ff60732a60b39609f127c2" title="Accessor for resolution of this segment.">getResolution</a>()<span class="keyword"> const </span>{ <a name="l00070"></a>00070 <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1Segment.html#abd9c19268851728d53a0032e6fa0a78c" title="Distance between segments.">m_res</a>; <a name="l00071"></a>00071 } <a name="l00072"></a>00072 <a name="l00074"></a><a class="code" href="classMercator_1_1Segment.html#a344de223eb8af9cd47afb8c406783466">00074</a> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classMercator_1_1Segment.html#a344de223eb8af9cd47afb8c406783466" title="Accessor for array size of this segment.">getSize</a>()<span class="keyword"> const </span>{ <a name="l00075"></a>00075 <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1Segment.html#a491907412d4eb428e2347eee96b05a28" title="Size of segment, m_res + 1.">m_size</a>; <a name="l00076"></a>00076 } <a name="l00077"></a>00077 <a name="l00079"></a><a class="code" href="classMercator_1_1Segment.html#a0af58690a77291326481d94c73a916a4">00079</a> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classMercator_1_1Segment.html#a0af58690a77291326481d94c73a916a4" title="Accessor for Global x reference of this segment.">getXRef</a>()<span class="keyword"> const </span>{ <a name="l00080"></a>00080 <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1Segment.html#ad1277eafb57d7b03b03a53736307e375" title="Global x reference of this segment.">m_xRef</a>; <a name="l00081"></a>00081 } <a name="l00082"></a>00082 <a name="l00084"></a><a class="code" href="classMercator_1_1Segment.html#a05f29873596234b74ca0d45f80970d92">00084</a> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classMercator_1_1Segment.html#a05f29873596234b74ca0d45f80970d92" title="Accessor for Global y reference of this segment.">getYRef</a>()<span class="keyword"> const </span>{ <a name="l00085"></a>00085 <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1Segment.html#aee621475381f71afa25e89f830ab0d45" title="Global y reference of this segment.">m_yRef</a>; <a name="l00086"></a>00086 } <a name="l00087"></a>00087 <a name="l00091"></a><a class="code" href="classMercator_1_1Segment.html#a0db338f77e6209301ce61eb2a9f9ad46">00091</a> <span class="keyword">const</span> <span class="keywordtype">bool</span> <a class="code" href="classMercator_1_1Segment.html#a0db338f77e6209301ce61eb2a9f9ad46" title="Check whether this Segment contains valid point data.">isValid</a>()<span class="keyword"> const </span>{ <a name="l00092"></a>00092 <span class="keywordflow">return</span> (<a class="code" href="classMercator_1_1Segment.html#ac22600d95051cd017f53f10fca12a20e" title="Pointer to buffer containing height points.">m_points</a> != 0); <a name="l00093"></a>00093 } <a name="l00094"></a>00094 <a name="l00099"></a><a class="code" href="classMercator_1_1Segment.html#a7806c078346ecb524e9b8b32b80071f3">00099</a> <span class="keywordtype">void</span> <a class="code" href="classMercator_1_1Segment.html#a7806c078346ecb524e9b8b32b80071f3" title="Set min and max height values for this Segment.">setMinMax</a>(<span class="keywordtype">float</span> min, <span class="keywordtype">float</span> max) { <a name="l00100"></a>00100 <a class="code" href="classMercator_1_1Segment.html#a18c43d5280f8072849cac10927296a2b" title="Minimum height of any point in this segment.">m_min</a> = min; <a name="l00101"></a>00101 <a class="code" href="classMercator_1_1Segment.html#a771ad07baa6490732728ab150fd11b9d" title="Maximum height of any point in this segment.">m_max</a> = max; <a name="l00102"></a>00102 } <a name="l00103"></a>00103 <a name="l00104"></a>00104 <span class="keywordtype">void</span> <a class="code" href="classMercator_1_1Segment.html#af576b4f2de72a6a5eb5f6cd7d83c1440" title="Mark the contents of this Segment as stale.">invalidate</a>(<span class="keywordtype">bool</span> points = <span class="keyword">true</span>); <a name="l00105"></a>00105 <a name="l00112"></a><a class="code" href="classMercator_1_1Segment.html#aa77a2f47f03333a1be1d4e8ec6d1995a">00112</a> <span class="keywordtype">void</span> <a class="code" href="classMercator_1_1Segment.html#aa77a2f47f03333a1be1d4e8ec6d1995a" title="Set the BasePoint data for one of the four that define this Segment.">setCornerPoint</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> x, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> y, <span class="keyword">const</span> <a class="code" href="classMercator_1_1BasePoint.html" title="Point on the fundamental grid that is used as the basis for terrain.">BasePoint</a> & bp) { <a name="l00113"></a>00113 <a class="code" href="classMercator_1_1Segment.html#a21d4394ff5c5e586410bf9c7dea6b6af" title="2x2 matrix of points which control this segment">m_controlPoints</a>(x, y) = bp; <a name="l00114"></a>00114 <a class="code" href="classMercator_1_1Segment.html#af576b4f2de72a6a5eb5f6cd7d83c1440" title="Mark the contents of this Segment as stale.">invalidate</a>(); <a name="l00115"></a>00115 } <a name="l00116"></a>00116 <a name="l00118"></a><a class="code" href="classMercator_1_1Segment.html#aa763522ab22e67e924670b690da6d9c7">00118</a> <span class="keyword">const</span> <a class="code" href="classMercator_1_1Matrix.html">Matrix<2, 2, BasePoint></a> & <a class="code" href="classMercator_1_1Segment.html#aa763522ab22e67e924670b690da6d9c7" title="Accessor for 2D matrix of base points.">getControlPoints</a>()<span class="keyword"> const </span>{ <a name="l00119"></a>00119 <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1Segment.html#a21d4394ff5c5e586410bf9c7dea6b6af" title="2x2 matrix of points which control this segment">m_controlPoints</a>; <a name="l00120"></a>00120 } <a name="l00121"></a>00121 <a name="l00123"></a><a class="code" href="classMercator_1_1Segment.html#a96982b1977a321cbe43ada0f277cae82">00123</a> <a class="code" href="classMercator_1_1Matrix.html">Matrix<2, 2, BasePoint></a> & <a class="code" href="classMercator_1_1Segment.html#a96982b1977a321cbe43ada0f277cae82" title="Accessor for modifying 2D matrix of base points.">getControlPoints</a>() { <a name="l00124"></a>00124 <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1Segment.html#a21d4394ff5c5e586410bf9c7dea6b6af" title="2x2 matrix of points which control this segment">m_controlPoints</a>; <a name="l00125"></a>00125 } <a name="l00126"></a>00126 <a name="l00128"></a><a class="code" href="classMercator_1_1Segment.html#a3a54bd89ebaedb6b6b67759db6cf5d5a">00128</a> <span class="keyword">const</span> <a class="code" href="classMercator_1_1Segment.html#a4a47008ac7949b6958f07159b3e82262" title="STL map of pointers to Surface objects.">Surfacestore</a> & <a class="code" href="classMercator_1_1Segment.html#a3a54bd89ebaedb6b6b67759db6cf5d5a" title="Accessor for list of attached Surface objects.">getSurfaces</a>()<span class="keyword"> const </span>{ <a name="l00129"></a>00129 <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1Segment.html#a14403c34b1b0668886484b2f569064e3" title="Store of surfaces which can be rendered on this terrain.">m_surfaces</a>; <a name="l00130"></a>00130 } <a name="l00131"></a>00131 <a name="l00133"></a><a class="code" href="classMercator_1_1Segment.html#a98c913863ad84e76791326527a56b67c">00133</a> <a class="code" href="classMercator_1_1Segment.html#a4a47008ac7949b6958f07159b3e82262" title="STL map of pointers to Surface objects.">Surfacestore</a> & <a class="code" href="classMercator_1_1Segment.html#a98c913863ad84e76791326527a56b67c" title="Accessor for modifying list of attached Surface objects.">getSurfaces</a>() { <a name="l00134"></a>00134 <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1Segment.html#a14403c34b1b0668886484b2f569064e3" title="Store of surfaces which can be rendered on this terrain.">m_surfaces</a>; <a name="l00135"></a>00135 } <a name="l00136"></a>00136 <a name="l00138"></a><a class="code" href="classMercator_1_1Segment.html#a1ccc784c8d62838972cb093f7061655d">00138</a> <span class="keyword">const</span> <span class="keywordtype">float</span> * <a class="code" href="classMercator_1_1Segment.html#a1ccc784c8d62838972cb093f7061655d" title="Accessor for buffer containing height points.">getPoints</a>()<span class="keyword"> const </span>{ <a name="l00139"></a>00139 <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1Segment.html#ac22600d95051cd017f53f10fca12a20e" title="Pointer to buffer containing height points.">m_points</a>; <a name="l00140"></a>00140 } <a name="l00141"></a>00141 <a name="l00143"></a><a class="code" href="classMercator_1_1Segment.html#a960838ae49895e75bbea60f2a8d06d57">00143</a> <span class="keywordtype">float</span> * <a class="code" href="classMercator_1_1Segment.html#a960838ae49895e75bbea60f2a8d06d57" title="Accessor for write access to buffer containing height points.">getPoints</a>() { <a name="l00144"></a>00144 <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1Segment.html#ac22600d95051cd017f53f10fca12a20e" title="Pointer to buffer containing height points.">m_points</a>; <a name="l00145"></a>00145 } <a name="l00146"></a>00146 <a name="l00148"></a><a class="code" href="classMercator_1_1Segment.html#ac549eabb29ac3b021d99c08d69906197">00148</a> <span class="keyword">const</span> <span class="keywordtype">float</span> * <a class="code" href="classMercator_1_1Segment.html#ac549eabb29ac3b021d99c08d69906197" title="Accessor for buffer containing surface normals.">getNormals</a>()<span class="keyword"> const </span>{ <a name="l00149"></a>00149 <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1Segment.html#ac0b0f720ce76aab5d6dcebfcd5469ed6" title="Pointer to buffer containing normals for height points.">m_normals</a>; <a name="l00150"></a>00150 } <a name="l00151"></a>00151 <a name="l00153"></a><a class="code" href="classMercator_1_1Segment.html#a9e4c71441bbfd097b76e55d950f696df">00153</a> <span class="keywordtype">float</span> * <a class="code" href="classMercator_1_1Segment.html#a9e4c71441bbfd097b76e55d950f696df" title="Accessor for write access to buffer containing surface normals.">getNormals</a>() { <a name="l00154"></a>00154 <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1Segment.html#ac0b0f720ce76aab5d6dcebfcd5469ed6" title="Pointer to buffer containing normals for height points.">m_normals</a>; <a name="l00155"></a>00155 } <a name="l00156"></a>00156 <a name="l00158"></a><a class="code" href="classMercator_1_1Segment.html#a5710d0991f8922b734f457b2fbb18f65">00158</a> <span class="keywordtype">float</span> <span class="keyword">get</span>(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y) <span class="keyword">const</span> { <a name="l00159"></a>00159 <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1Segment.html#ac22600d95051cd017f53f10fca12a20e" title="Pointer to buffer containing height points.">m_points</a>[y * (<a class="code" href="classMercator_1_1Segment.html#abd9c19268851728d53a0032e6fa0a78c" title="Distance between segments.">m_res</a> + 1) + x]; <a name="l00160"></a>00160 } <a name="l00161"></a>00161 <a name="l00162"></a>00162 <span class="keywordtype">void</span> <a class="code" href="classMercator_1_1Segment.html#a5b0e305c1c9b87e5b6dbd0291c7cea01" title="Get an accurate height and normal vector at a given coordinate relative to this segment.">getHeightAndNormal</a>(<span class="keywordtype">float</span> x, <span class="keywordtype">float</span> y, <span class="keywordtype">float</span> &h, <a name="l00163"></a>00163 WFMath::Vector<3> &normal) <span class="keyword">const</span>; <a name="l00164"></a>00164 <span class="keywordtype">bool</span> <a class="code" href="classMercator_1_1Segment.html#aab07ede0cd641dc7a96023cc97695f65" title="Determine the intersection between an axis aligned box and this segment.">clipToSegment</a>(<span class="keyword">const</span> WFMath::AxisBox<2> &bbox, <span class="keywordtype">int</span> &lx, <span class="keywordtype">int</span> &hx, <span class="keywordtype">int</span> &ly, <span class="keywordtype">int</span> &hy) <span class="keyword">const</span>; <a name="l00165"></a>00165 <a name="l00166"></a>00166 <a name="l00167"></a>00167 <span class="keywordtype">void</span> <a class="code" href="classMercator_1_1Segment.html#a58cc1d8e3359fae3ea38c14fcf3b3e88" title="Populate the Segment with heightfield data.">populate</a>(); <a name="l00168"></a>00168 <span class="keywordtype">void</span> <a class="code" href="classMercator_1_1Segment.html#a73f1453d0e22f30e1941b458ba69ed9f" title="Populate the Segment with surface normal data.">populateNormals</a>(); <a name="l00169"></a>00169 <span class="keywordtype">void</span> <a class="code" href="classMercator_1_1Segment.html#aeb53cd468934f8053ee7898e6f1505d8" title="Populate the surfaces associated with this Segment.">populateSurfaces</a>(); <a name="l00170"></a>00170 <a name="l00172"></a><a class="code" href="classMercator_1_1Segment.html#ab956f69332118b0829b37cf3703b6ed2">00172</a> <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1Segment.html#ab956f69332118b0829b37cf3703b6ed2" title="Accessor for the maximum height value in this Segment.">getMax</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1Segment.html#a771ad07baa6490732728ab150fd11b9d" title="Maximum height of any point in this segment.">m_max</a>; } <a name="l00174"></a><a class="code" href="classMercator_1_1Segment.html#ae5d0fd3bd438a7ddfedae5030525f8ca">00174</a> <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1Segment.html#ae5d0fd3bd438a7ddfedae5030525f8ca" title="Accessor for the minimum height value in this Segment.">getMin</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1Segment.html#a18c43d5280f8072849cac10927296a2b" title="Minimum height of any point in this segment.">m_min</a>; } <a name="l00175"></a>00175 <a name="l00177"></a>00177 WFMath::AxisBox<2> <a class="code" href="classMercator_1_1Segment.html#ab83e3a523eb6c9ca15a8143a6d994289" title="The 2d area covered by this segment.">getRect</a>() <span class="keyword">const</span>; <a name="l00178"></a>00178 <a name="l00180"></a>00180 WFMath::AxisBox<3> <a class="code" href="classMercator_1_1Segment.html#ad7165c7f86288bc04aba21d243edee85" title="The 3d box covered by this segment.">getBox</a>() <span class="keyword">const</span>; <a name="l00181"></a>00181 <a name="l00182"></a>00182 <span class="keywordtype">void</span> <a class="code" href="classMercator_1_1Segment.html#a30345d00cf856e09495b6a126a70fbfa" title="Add a TerrainMod to this Segment.">addMod</a>(<a class="code" href="classMercator_1_1TerrainMod.html" title="Base class for modifiers to the procedurally generated terrain.">TerrainMod</a> *t); <a name="l00183"></a>00183 <span class="keywordtype">void</span> <a class="code" href="classMercator_1_1Segment.html#a9a592c7b03d5ac08d284e1cd2d73b562" title="Remove a TerrainMod from this Segment.">removeMod</a>(<a class="code" href="classMercator_1_1TerrainMod.html" title="Base class for modifiers to the procedurally generated terrain.">TerrainMod</a> *t); <a name="l00184"></a>00184 <span class="keywordtype">void</span> <a class="code" href="classMercator_1_1Segment.html#afa3f6bf647f377e13a54656581f2d846" title="Delete all the modifications applied to this Segment.">clearMods</a>(); <a name="l00185"></a>00185 <a name="l00187"></a><a class="code" href="classMercator_1_1Segment.html#ae5209f0c97ae9a316c21ad5bde3dbfe0">00187</a> <span class="keyword">const</span> <a class="code" href="classMercator_1_1Segment.html#ad3aa3e9f341da2ed35fb417d5c0961f7" title="STL multimap of pointers to Area objects affecting this segment.">Areastore</a>& <a class="code" href="classMercator_1_1Segment.html#ae5209f0c97ae9a316c21ad5bde3dbfe0" title="Accessor for multimap of Area objects.">getAreas</a>()<span class="keyword"> const</span> <a name="l00188"></a>00188 <span class="keyword"> </span>{ <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1Segment.html#ab63a28adb71347baccdffd5eab91f58a" title="Areas which intersect this segment.">m_areas</a>; } <a name="l00189"></a>00189 <a name="l00190"></a>00190 <span class="keywordtype">void</span> <a class="code" href="classMercator_1_1Segment.html#a322a95b5e6b7ed3f7dc72f1abbd92bef" title="Add an area to those that affect this segment.">addArea</a>(<a class="code" href="classMercator_1_1Area.html" title="Region of terrain surface which is modified.">Area</a>* a); <a name="l00191"></a>00191 <span class="keywordtype">void</span> <a class="code" href="classMercator_1_1Segment.html#a2fb6529438f35c83185d5faae6954b15" title="Remove an area from those that affect this segment.">removeArea</a>(<a class="code" href="classMercator_1_1Area.html" title="Region of terrain surface which is modified.">Area</a>* a); <a name="l00192"></a>00192 <span class="keyword">private</span>: <a name="l00197"></a><a class="code" href="classMercator_1_1Segment.html#ad4bff40869f8b8b3bf5d1cb60e9ffc27">00197</a> <span class="keywordtype">void</span> <a class="code" href="classMercator_1_1Segment.html#ad4bff40869f8b8b3bf5d1cb60e9ffc27" title="Check a value against m_min and m_max and set one of them if appropriate.">checkMaxMin</a>(<span class="keywordtype">float</span> h) { <a name="l00198"></a>00198 <span class="keywordflow">if</span> (h<<a class="code" href="classMercator_1_1Segment.html#a18c43d5280f8072849cac10927296a2b" title="Minimum height of any point in this segment.">m_min</a>) { <a name="l00199"></a>00199 <a class="code" href="classMercator_1_1Segment.html#a18c43d5280f8072849cac10927296a2b" title="Minimum height of any point in this segment.">m_min</a>=h; <a name="l00200"></a>00200 } <a name="l00201"></a>00201 <span class="keywordflow">if</span> (h><a class="code" href="classMercator_1_1Segment.html#a771ad07baa6490732728ab150fd11b9d" title="Maximum height of any point in this segment.">m_max</a>) { <a name="l00202"></a>00202 <a class="code" href="classMercator_1_1Segment.html#a771ad07baa6490732728ab150fd11b9d" title="Maximum height of any point in this segment.">m_max</a>=h; <a name="l00203"></a>00203 } <a name="l00204"></a>00204 } <a name="l00205"></a>00205 <a name="l00206"></a>00206 <span class="keywordtype">void</span> <a class="code" href="classMercator_1_1Segment.html#a83e6e6c1dac2d37ed3402702cb3e1df6" title="One dimensional midpoint displacement fractal.">fill1d</a>(<span class="keyword">const</span> <a class="code" href="classMercator_1_1BasePoint.html" title="Point on the fundamental grid that is used as the basis for terrain.">BasePoint</a>& l, <span class="keyword">const</span> <a class="code" href="classMercator_1_1BasePoint.html" title="Point on the fundamental grid that is used as the basis for terrain.">BasePoint</a> &h, <span class="keywordtype">float</span> *array) <span class="keyword">const</span>; <a name="l00207"></a>00207 <a name="l00208"></a>00208 <span class="keywordtype">void</span> <a class="code" href="classMercator_1_1Segment.html#aebf73701914c4751d15d9cec484ce4a0" title="Two dimensional midpoint displacement fractal.">fill2d</a>(<span class="keyword">const</span> <a class="code" href="classMercator_1_1BasePoint.html" title="Point on the fundamental grid that is used as the basis for terrain.">BasePoint</a>& p1, <span class="keyword">const</span> <a class="code" href="classMercator_1_1BasePoint.html" title="Point on the fundamental grid that is used as the basis for terrain.">BasePoint</a>& p2, <a name="l00209"></a>00209 <span class="keyword">const</span> <a class="code" href="classMercator_1_1BasePoint.html" title="Point on the fundamental grid that is used as the basis for terrain.">BasePoint</a>& p3, <span class="keyword">const</span> <a class="code" href="classMercator_1_1BasePoint.html" title="Point on the fundamental grid that is used as the basis for terrain.">BasePoint</a>& p4); <a name="l00210"></a>00210 <a name="l00211"></a>00211 <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1Segment.html#ae293068184348effce810801245bb4e4" title="quasi-Random Midpoint Displacement (qRMD) algorithm.">qRMD</a>(<span class="keywordtype">float</span> nn, <span class="keywordtype">float</span> fn, <span class="keywordtype">float</span> ff, <span class="keywordtype">float</span> nf, <a name="l00212"></a>00212 <span class="keywordtype">float</span> roughness, <span class="keywordtype">float</span> falloff, <span class="keywordtype">int</span> depth) <span class="keyword">const</span>; <a name="l00213"></a>00213 <a name="l00214"></a>00214 <span class="keywordtype">void</span> <a class="code" href="classMercator_1_1Segment.html#a0b08acbed2a9430648ba8b85929043a3" title="Modify the heightfield data using the TerrainMod objects which are attached to this Segment...">applyMod</a>(<a class="code" href="classMercator_1_1TerrainMod.html" title="Base class for modifiers to the procedurally generated terrain.">TerrainMod</a> *t); <a name="l00215"></a>00215 <a name="l00216"></a>00216 <span class="keywordtype">void</span> <a class="code" href="classMercator_1_1Segment.html#a95f3bf7b2c6146edff9d84760c62be3b" title="Mark surfaces as stale.">invalidateSurfaces</a>(); <a name="l00217"></a>00217 <a name="l00219"></a><a class="code" href="classMercator_1_1Segment.html#a6ce82dd99e6fdfc257a09bd09a7f50bb">00219</a> ModList <a class="code" href="classMercator_1_1Segment.html#a6ce82dd99e6fdfc257a09bd09a7f50bb" title="List of TerrainMod objects that are applied to this Segment.">m_modList</a>; <a name="l00220"></a>00220 <a name="l00221"></a>00221 }; <a name="l00222"></a>00222 <a name="l00223"></a>00223 } <span class="comment">// namespace Mercator</span> <a name="l00224"></a>00224 <a name="l00225"></a>00225 <span class="preprocessor">#endif // MERCATOR_SEGMENT_H</span> </pre></div></div> </div> <hr class="footer"/><address class="footer"><small>Generated for Mercator by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address> </body> </html>