<!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>FTGL: FTBBox.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.6.2-20100208 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</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>Globals</span></a></li> </ul> </div> <h1>FTBBox.h</h1><a href="FTBBox_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> * FTGL - OpenGL font library</span> <a name="l00003"></a>00003 <span class="comment"> *</span> <a name="l00004"></a>00004 <span class="comment"> * Copyright (c) 2001-2004 Henry Maddocks <ftgl@opengl.geek.nz></span> <a name="l00005"></a>00005 <span class="comment"> * Copyright (c) 2008 Sam Hocevar <sam@zoy.org></span> <a name="l00006"></a>00006 <span class="comment"> * Copyright (c) 2008 Sean Morrison <learner@brlcad.org></span> <a name="l00007"></a>00007 <span class="comment"> *</span> <a name="l00008"></a>00008 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span> <a name="l00009"></a>00009 <span class="comment"> * a copy of this software and associated documentation files (the</span> <a name="l00010"></a>00010 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span> <a name="l00011"></a>00011 <span class="comment"> * without limitation the rights to use, copy, modify, merge, publish,</span> <a name="l00012"></a>00012 <span class="comment"> * distribute, sublicense, and/or sell copies of the Software, and to</span> <a name="l00013"></a>00013 <span class="comment"> * permit persons to whom the Software is furnished to do so, subject to</span> <a name="l00014"></a>00014 <span class="comment"> * the following conditions:</span> <a name="l00015"></a>00015 <span class="comment"> *</span> <a name="l00016"></a>00016 <span class="comment"> * The above copyright notice and this permission notice shall be</span> <a name="l00017"></a>00017 <span class="comment"> * included in all copies or substantial portions of the Software.</span> <a name="l00018"></a>00018 <span class="comment"> *</span> <a name="l00019"></a>00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span> <a name="l00020"></a>00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span> <a name="l00021"></a>00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.</span> <a name="l00022"></a>00022 <span class="comment"> * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY</span> <a name="l00023"></a>00023 <span class="comment"> * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,</span> <a name="l00024"></a>00024 <span class="comment"> * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE</span> <a name="l00025"></a>00025 <span class="comment"> * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</span> <a name="l00026"></a>00026 <span class="comment"> */</span> <a name="l00027"></a>00027 <a name="l00028"></a>00028 <span class="preprocessor">#ifndef __ftgl__</span> <a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor"># warning This header is deprecated. Please use <FTGL/ftgl.h> from now.</span> <a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor"># include <<a class="code" href="ftgl_8h.html">FTGL/ftgl.h</a>></span> <a name="l00031"></a>00031 <span class="preprocessor">#endif</span> <a name="l00032"></a>00032 <span class="preprocessor"></span> <a name="l00033"></a>00033 <span class="preprocessor">#ifndef __FTBBox__</span> <a name="l00034"></a>00034 <span class="preprocessor"></span><span class="preprocessor">#define __FTBBox__</span> <a name="l00035"></a>00035 <span class="preprocessor"></span> <a name="l00036"></a>00036 <span class="preprocessor">#ifdef __cplusplus</span> <a name="l00037"></a>00037 <span class="preprocessor"></span> <a name="l00038"></a>00038 <a name="l00042"></a><a class="code" href="classFTBBox.html">00042</a> <span class="keyword">class </span><a class="code" href="ftgl_8h.html#ae472b08d77a4ead09abe74fe37220270">FTGL_EXPORT</a> <a class="code" href="classFTBBox.html" title="FTBBox is a convenience class for handling bounding boxes.">FTBBox</a> <a name="l00043"></a>00043 { <a name="l00044"></a>00044 <span class="keyword">public</span>: <a name="l00048"></a><a class="code" href="classFTBBox.html#a1779a36f0f573c6215de9a1bcee61f15">00048</a> <a class="code" href="classFTBBox.html" title="FTBBox is a convenience class for handling bounding boxes.">FTBBox</a>() <a name="l00049"></a>00049 : lower(0.0f, 0.0f, 0.0f), <a name="l00050"></a>00050 upper(0.0f, 0.0f, 0.0f) <a name="l00051"></a>00051 {} <a name="l00052"></a>00052 <a name="l00056"></a><a class="code" href="classFTBBox.html#a13345139067cc08b799bf7082895bda0">00056</a> <a class="code" href="classFTBBox.html" title="FTBBox is a convenience class for handling bounding boxes.">FTBBox</a>(<span class="keywordtype">float</span> lx, <span class="keywordtype">float</span> ly, <span class="keywordtype">float</span> lz, <span class="keywordtype">float</span> ux, <span class="keywordtype">float</span> uy, <span class="keywordtype">float</span> uz) <a name="l00057"></a>00057 : lower(lx, ly, lz), <a name="l00058"></a>00058 upper(ux, uy, uz) <a name="l00059"></a>00059 {} <a name="l00060"></a>00060 <a name="l00064"></a><a class="code" href="classFTBBox.html#ad09fe772cbaeeeadba6f01d3655b3ca4">00064</a> <a class="code" href="classFTBBox.html" title="FTBBox is a convenience class for handling bounding boxes.">FTBBox</a>(<a class="code" href="classFTPoint.html" title="FTPoint class is a basic 3-dimensional point or vector.">FTPoint</a> l, <a class="code" href="classFTPoint.html" title="FTPoint class is a basic 3-dimensional point or vector.">FTPoint</a> u) <a name="l00065"></a>00065 : lower(l), <a name="l00066"></a>00066 upper(u) <a name="l00067"></a>00067 {} <a name="l00068"></a>00068 <a name="l00075"></a><a class="code" href="classFTBBox.html#a08a2bdc33037650e5f2d430c127e7d14">00075</a> <a class="code" href="classFTBBox.html" title="FTBBox is a convenience class for handling bounding boxes.">FTBBox</a>(FT_GlyphSlot glyph) <a name="l00076"></a>00076 : lower(0.0f, 0.0f, 0.0f), <a name="l00077"></a>00077 upper(0.0f, 0.0f, 0.0f) <a name="l00078"></a>00078 { <a name="l00079"></a>00079 FT_BBox bbox; <a name="l00080"></a>00080 FT_Outline_Get_CBox(&(glyph->outline), &bbox); <a name="l00081"></a>00081 <a name="l00082"></a>00082 lower.X(static_cast<float>(bbox.xMin) / 64.0f); <a name="l00083"></a>00083 lower.Y(static_cast<float>(bbox.yMin) / 64.0f); <a name="l00084"></a>00084 lower.Z(0.0f); <a name="l00085"></a>00085 upper.X(static_cast<float>(bbox.xMax) / 64.0f); <a name="l00086"></a>00086 upper.Y(static_cast<float>(bbox.yMax) / 64.0f); <a name="l00087"></a>00087 upper.Z(0.0f); <a name="l00088"></a>00088 } <a name="l00089"></a>00089 <a name="l00093"></a><a class="code" href="classFTBBox.html#a377c940076f798b35450636d2cc58095">00093</a> ~<a class="code" href="classFTBBox.html" title="FTBBox is a convenience class for handling bounding boxes.">FTBBox</a>() <a name="l00094"></a>00094 {} <a name="l00095"></a>00095 <a name="l00100"></a><a class="code" href="classFTBBox.html#a1432e63029459c4c4964fcab0043919e">00100</a> <span class="keywordtype">void</span> Invalidate() <a name="l00101"></a>00101 { <a name="l00102"></a>00102 lower = <a class="code" href="classFTPoint.html" title="FTPoint class is a basic 3-dimensional point or vector.">FTPoint</a>(1.0f, 1.0f, 1.0f); <a name="l00103"></a>00103 upper = <a class="code" href="classFTPoint.html" title="FTPoint class is a basic 3-dimensional point or vector.">FTPoint</a>(-1.0f, -1.0f, -1.0f); <a name="l00104"></a>00104 } <a name="l00105"></a>00105 <a name="l00112"></a><a class="code" href="classFTBBox.html#a90dfe0b5a8d0f22632074fd8fb554926">00112</a> <span class="keywordtype">bool</span> IsValid() <a name="l00113"></a>00113 { <a name="l00114"></a>00114 <span class="keywordflow">return</span> lower.X() <= upper.X() <a name="l00115"></a>00115 && lower.Y() <= upper.Y() <a name="l00116"></a>00116 && lower.Z() <= upper.Z(); <a name="l00117"></a>00117 } <a name="l00118"></a>00118 <a name="l00124"></a><a class="code" href="classFTBBox.html#ae19d47a4085d77eafeb6d311686e46e8">00124</a> <a class="code" href="classFTBBox.html" title="FTBBox is a convenience class for handling bounding boxes.">FTBBox</a>& operator += (<span class="keyword">const</span> <a class="code" href="classFTPoint.html" title="FTPoint class is a basic 3-dimensional point or vector.">FTPoint</a> vector) <a name="l00125"></a>00125 { <a name="l00126"></a>00126 lower += vector; <a name="l00127"></a>00127 upper += vector; <a name="l00128"></a>00128 <a name="l00129"></a>00129 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00130"></a>00130 } <a name="l00131"></a>00131 <a name="l00138"></a><a class="code" href="classFTBBox.html#a98a2344c0f33fe4a6e91082af595e754">00138</a> <a class="code" href="classFTBBox.html" title="FTBBox is a convenience class for handling bounding boxes.">FTBBox</a>& operator |= (<span class="keyword">const</span> <a class="code" href="classFTBBox.html" title="FTBBox is a convenience class for handling bounding boxes.">FTBBox</a>& bbox) <a name="l00139"></a>00139 { <a name="l00140"></a>00140 <span class="keywordflow">if</span>(bbox.lower.<a class="code" href="classFTPoint.html#af027f8076fcdfe488aea94fddf6bf7a3" title="Setters.">X</a>() < lower.X()) lower.<a class="code" href="classFTPoint.html#af027f8076fcdfe488aea94fddf6bf7a3" title="Setters.">X</a>(bbox.lower.<a class="code" href="classFTPoint.html#af027f8076fcdfe488aea94fddf6bf7a3" title="Setters.">X</a>()); <a name="l00141"></a>00141 <span class="keywordflow">if</span>(bbox.lower.<a class="code" href="classFTPoint.html#a050f6a715fe7934cb899cb13c0bca20f">Y</a>() < lower.Y()) lower.Y(bbox.lower.<a class="code" href="classFTPoint.html#a050f6a715fe7934cb899cb13c0bca20f">Y</a>()); <a name="l00142"></a>00142 <span class="keywordflow">if</span>(bbox.lower.<a class="code" href="classFTPoint.html#a1119a7cda143b4ac4ae970519a8a53ce">Z</a>() < lower.Z()) lower.Z(bbox.lower.<a class="code" href="classFTPoint.html#a1119a7cda143b4ac4ae970519a8a53ce">Z</a>()); <a name="l00143"></a>00143 <span class="keywordflow">if</span>(bbox.upper.<a class="code" href="classFTPoint.html#af027f8076fcdfe488aea94fddf6bf7a3" title="Setters.">X</a>() > upper.X()) upper.X(bbox.upper.<a class="code" href="classFTPoint.html#af027f8076fcdfe488aea94fddf6bf7a3" title="Setters.">X</a>()); <a name="l00144"></a>00144 <span class="keywordflow">if</span>(bbox.upper.<a class="code" href="classFTPoint.html#a050f6a715fe7934cb899cb13c0bca20f">Y</a>() > upper.Y()) upper.Y(bbox.upper.<a class="code" href="classFTPoint.html#a050f6a715fe7934cb899cb13c0bca20f">Y</a>()); <a name="l00145"></a>00145 <span class="keywordflow">if</span>(bbox.upper.<a class="code" href="classFTPoint.html#a1119a7cda143b4ac4ae970519a8a53ce">Z</a>() > upper.Z()) upper.Z(bbox.upper.<a class="code" href="classFTPoint.html#a1119a7cda143b4ac4ae970519a8a53ce">Z</a>()); <a name="l00146"></a>00146 <a name="l00147"></a>00147 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00148"></a>00148 } <a name="l00149"></a>00149 <a name="l00150"></a><a class="code" href="classFTBBox.html#a40d501414c5eeaf4d35034c017cbc9ab">00150</a> <span class="keywordtype">void</span> SetDepth(<span class="keywordtype">float</span> depth) <a name="l00151"></a>00151 { <a name="l00152"></a>00152 <span class="keywordflow">if</span>(depth > 0) <a name="l00153"></a>00153 upper.Z(lower.Z() + depth); <a name="l00154"></a>00154 <span class="keywordflow">else</span> <a name="l00155"></a>00155 lower.Z(upper.Z() + depth); <a name="l00156"></a>00156 } <a name="l00157"></a>00157 <a name="l00158"></a>00158 <a name="l00159"></a><a class="code" href="classFTBBox.html#a9c33d51b0bddc05ad89ecbf6790b4193">00159</a> <span class="keyword">inline</span> <a class="code" href="classFTPoint.html" title="FTPoint class is a basic 3-dimensional point or vector.">FTPoint</a> <span class="keyword">const</span> Upper()<span class="keyword"> const</span> <a name="l00160"></a>00160 <span class="keyword"> </span>{ <a name="l00161"></a>00161 <span class="keywordflow">return</span> upper; <a name="l00162"></a>00162 } <a name="l00163"></a>00163 <a name="l00164"></a>00164 <a name="l00165"></a><a class="code" href="classFTBBox.html#a8172e5c98a2a6e02ba7d4dc0cd6c0b0e">00165</a> <span class="keyword">inline</span> <a class="code" href="classFTPoint.html" title="FTPoint class is a basic 3-dimensional point or vector.">FTPoint</a> <span class="keyword">const</span> Lower()<span class="keyword"> const</span> <a name="l00166"></a>00166 <span class="keyword"> </span>{ <a name="l00167"></a>00167 <span class="keywordflow">return</span> lower; <a name="l00168"></a>00168 } <a name="l00169"></a>00169 <a name="l00170"></a>00170 <span class="keyword">private</span>: <a name="l00174"></a>00174 <a class="code" href="classFTPoint.html" title="FTPoint class is a basic 3-dimensional point or vector.">FTPoint</a> lower, upper; <a name="l00175"></a>00175 }; <a name="l00176"></a>00176 <a name="l00177"></a>00177 <span class="preprocessor">#endif //__cplusplus</span> <a name="l00178"></a>00178 <span class="preprocessor"></span> <a name="l00179"></a>00179 <span class="preprocessor">#endif // __FTBBox__</span> <a name="l00180"></a>00180 <span class="preprocessor"></span> </pre></div></div> <hr class="footer"/><address style="text-align: right;"><small>Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2-20100208 </small></address> </body> </html>