<!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: FTPoint.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>FTPoint.h</h1><a href="FTPoint_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 __FTPoint__</span> <a name="l00034"></a>00034 <span class="preprocessor"></span><span class="preprocessor">#define __FTPoint__</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="classFTPoint.html">00042</a> <span class="keyword">class </span><a class="code" href="ftgl_8h.html#ae472b08d77a4ead09abe74fe37220270">FTGL_EXPORT</a> <a class="code" href="classFTPoint.html" title="FTPoint class is a basic 3-dimensional point or vector.">FTPoint</a> <a name="l00043"></a>00043 { <a name="l00044"></a>00044 <span class="keyword">public</span>: <a name="l00048"></a><a class="code" href="classFTPoint.html#a6c00bdf61c452b16980169c61dcf4514">00048</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>() <a name="l00049"></a>00049 { <a name="l00050"></a>00050 values[0] = 0; <a name="l00051"></a>00051 values[1] = 0; <a name="l00052"></a>00052 values[2] = 0; <a name="l00053"></a>00053 } <a name="l00054"></a>00054 <a name="l00062"></a><a class="code" href="classFTPoint.html#a62568cd075b9f58ca56d3645f78ce1d5">00062</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> <a class="code" href="ftgl_8h.html#ae792fb2619b3890381a8b68babbdac74">FTGL_DOUBLE</a> x, <span class="keyword">const</span> <a class="code" href="ftgl_8h.html#ae792fb2619b3890381a8b68babbdac74">FTGL_DOUBLE</a> y, <a name="l00063"></a>00063 <span class="keyword">const</span> <a class="code" href="ftgl_8h.html#ae792fb2619b3890381a8b68babbdac74">FTGL_DOUBLE</a> z = 0) <a name="l00064"></a>00064 { <a name="l00065"></a>00065 values[0] = x; <a name="l00066"></a>00066 values[1] = y; <a name="l00067"></a>00067 values[2] = z; <a name="l00068"></a>00068 } <a name="l00069"></a>00069 <a name="l00075"></a><a class="code" href="classFTPoint.html#acdd9d671667825e31bc5008890abbac1">00075</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> FT_Vector& ft_vector) <a name="l00076"></a>00076 { <a name="l00077"></a>00077 values[0] = ft_vector.x; <a name="l00078"></a>00078 values[1] = ft_vector.y; <a name="l00079"></a>00079 values[2] = 0; <a name="l00080"></a>00080 } <a name="l00081"></a>00081 <a name="l00088"></a>00088 <a class="code" href="classFTPoint.html" title="FTPoint class is a basic 3-dimensional point or vector.">FTPoint</a> Normalise(); <a name="l00089"></a>00089 <a name="l00090"></a>00090 <a name="l00097"></a><a class="code" href="classFTPoint.html#a087f24c3952a77fb1159fe109db12b57">00097</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>& 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>& point) <a name="l00098"></a>00098 { <a name="l00099"></a>00099 values[0] += point.values[0]; <a name="l00100"></a>00100 values[1] += point.values[1]; <a name="l00101"></a>00101 values[2] += point.values[2]; <a name="l00102"></a>00102 <a name="l00103"></a>00103 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00104"></a>00104 } <a name="l00105"></a>00105 <a name="l00112"></a><a class="code" href="classFTPoint.html#a8463c959f8db1592b8fa4d9468483b28">00112</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> 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>& point)<span class="keyword"> const</span> <a name="l00113"></a>00113 <span class="keyword"> </span>{ <a name="l00114"></a>00114 <a class="code" href="classFTPoint.html" title="FTPoint class is a basic 3-dimensional point or vector.">FTPoint</a> temp; <a name="l00115"></a>00115 temp.values[0] = values[0] + point.values[0]; <a name="l00116"></a>00116 temp.values[1] = values[1] + point.values[1]; <a name="l00117"></a>00117 temp.values[2] = values[2] + point.values[2]; <a name="l00118"></a>00118 <a name="l00119"></a>00119 <span class="keywordflow">return</span> temp; <a name="l00120"></a>00120 } <a name="l00121"></a>00121 <a name="l00128"></a><a class="code" href="classFTPoint.html#a8fc27f0cb5454436443cf80b117d343e">00128</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>& 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>& point) <a name="l00129"></a>00129 { <a name="l00130"></a>00130 values[0] -= point.values[0]; <a name="l00131"></a>00131 values[1] -= point.values[1]; <a name="l00132"></a>00132 values[2] -= point.values[2]; <a name="l00133"></a>00133 <a name="l00134"></a>00134 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00135"></a>00135 } <a name="l00136"></a>00136 <a name="l00143"></a><a class="code" href="classFTPoint.html#af32afeabde2a0b1fa8f83c816f8177fb">00143</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> 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>& point)<span class="keyword"> const</span> <a name="l00144"></a>00144 <span class="keyword"> </span>{ <a name="l00145"></a>00145 <a class="code" href="classFTPoint.html" title="FTPoint class is a basic 3-dimensional point or vector.">FTPoint</a> temp; <a name="l00146"></a>00146 temp.values[0] = values[0] - point.values[0]; <a name="l00147"></a>00147 temp.values[1] = values[1] - point.values[1]; <a name="l00148"></a>00148 temp.values[2] = values[2] - point.values[2]; <a name="l00149"></a>00149 <a name="l00150"></a>00150 <span class="keywordflow">return</span> temp; <a name="l00151"></a>00151 } <a name="l00152"></a>00152 <a name="l00159"></a><a class="code" href="classFTPoint.html#a5194bac39f94b1d1cfd876d6fdea51ca">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> operator * (<span class="keywordtype">double</span> multiplier)<span class="keyword"> const</span> <a name="l00160"></a>00160 <span class="keyword"> </span>{ <a name="l00161"></a>00161 <a class="code" href="classFTPoint.html" title="FTPoint class is a basic 3-dimensional point or vector.">FTPoint</a> temp; <a name="l00162"></a>00162 temp.values[0] = values[0] * multiplier; <a name="l00163"></a>00163 temp.values[1] = values[1] * multiplier; <a name="l00164"></a>00164 temp.values[2] = values[2] * multiplier; <a name="l00165"></a>00165 <a name="l00166"></a>00166 <span class="keywordflow">return</span> temp; <a name="l00167"></a>00167 } <a name="l00168"></a>00168 <a name="l00169"></a>00169 <a name="l00177"></a><a class="code" href="classFTPoint.html#a7903e518fd65dda8330101cd39e09bb1">00177</a> <span class="keyword">inline</span> <span class="keyword">friend</span> <a class="code" href="classFTPoint.html" title="FTPoint class is a basic 3-dimensional point or vector.">FTPoint</a> operator * (<span class="keywordtype">double</span> multiplier, <a class="code" href="classFTPoint.html" title="FTPoint class is a basic 3-dimensional point or vector.">FTPoint</a>& point) <a name="l00178"></a>00178 { <a name="l00179"></a>00179 <span class="keywordflow">return</span> point * multiplier; <a name="l00180"></a>00180 } <a name="l00181"></a>00181 <a name="l00182"></a>00182 <a name="l00190"></a><a class="code" href="classFTPoint.html#afa70ba765b2dfb14bf7a22c9ee76c37f">00190</a> <span class="keyword">inline</span> <span class="keyword">friend</span> <span class="keywordtype">double</span> operator * (<a class="code" href="classFTPoint.html" title="FTPoint class is a basic 3-dimensional point or vector.">FTPoint</a> &a, <a class="code" href="classFTPoint.html" title="FTPoint class is a basic 3-dimensional point or vector.">FTPoint</a>& b) <a name="l00191"></a>00191 { <a name="l00192"></a>00192 <span class="keywordflow">return</span> a.values[0] * b.values[0] <a name="l00193"></a>00193 + a.values[1] * b.values[1] <a name="l00194"></a>00194 + a.values[2] * b.values[2]; <a name="l00195"></a>00195 } <a name="l00196"></a>00196 <a name="l00197"></a>00197 <a name="l00204"></a><a class="code" href="classFTPoint.html#a5944e73a8b8bcd35c79de1df2e542e4a">00204</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> 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>& point) <a name="l00205"></a>00205 { <a name="l00206"></a>00206 <a class="code" href="classFTPoint.html" title="FTPoint class is a basic 3-dimensional point or vector.">FTPoint</a> temp; <a name="l00207"></a>00207 temp.values[0] = values[1] * point.values[2] <a name="l00208"></a>00208 - values[2] * point.values[1]; <a name="l00209"></a>00209 temp.values[1] = values[2] * point.values[0] <a name="l00210"></a>00210 - values[0] * point.values[2]; <a name="l00211"></a>00211 temp.values[2] = values[0] * point.values[1] <a name="l00212"></a>00212 - values[1] * point.values[0]; <a name="l00213"></a>00213 <span class="keywordflow">return</span> temp; <a name="l00214"></a>00214 } <a name="l00215"></a>00215 <a name="l00216"></a>00216 <a name="l00224"></a>00224 <span class="keyword">friend</span> <span class="keywordtype">bool</span> 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> &a, <span class="keyword">const</span> <a class="code" href="classFTPoint.html" title="FTPoint class is a basic 3-dimensional point or vector.">FTPoint</a> &b); <a name="l00225"></a>00225 <a name="l00226"></a>00226 <a name="l00234"></a>00234 <span class="keyword">friend</span> <span class="keywordtype">bool</span> 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> &a, <span class="keyword">const</span> <a class="code" href="classFTPoint.html" title="FTPoint class is a basic 3-dimensional point or vector.">FTPoint</a> &b); <a name="l00235"></a>00235 <a name="l00236"></a>00236 <a name="l00240"></a><a class="code" href="classFTPoint.html#a1c64e553bcf305042f61f014f256d47a">00240</a> <span class="keyword">inline</span> operator const FTGL_DOUBLE*()<span class="keyword"> const</span> <a name="l00241"></a>00241 <span class="keyword"> </span>{ <a name="l00242"></a>00242 <span class="keywordflow">return</span> values; <a name="l00243"></a>00243 } <a name="l00244"></a>00244 <a name="l00245"></a>00245 <a name="l00249"></a><a class="code" href="classFTPoint.html#af027f8076fcdfe488aea94fddf6bf7a3">00249</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classFTPoint.html#af027f8076fcdfe488aea94fddf6bf7a3" title="Setters.">X</a>(<a class="code" href="ftgl_8h.html#ae792fb2619b3890381a8b68babbdac74">FTGL_DOUBLE</a> x) { values[0] = x; }; <a name="l00250"></a><a class="code" href="classFTPoint.html#a050f6a715fe7934cb899cb13c0bca20f">00250</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classFTPoint.html#a050f6a715fe7934cb899cb13c0bca20f">Y</a>(<a class="code" href="ftgl_8h.html#ae792fb2619b3890381a8b68babbdac74">FTGL_DOUBLE</a> y) { values[1] = y; }; <a name="l00251"></a><a class="code" href="classFTPoint.html#a1119a7cda143b4ac4ae970519a8a53ce">00251</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classFTPoint.html#a1119a7cda143b4ac4ae970519a8a53ce">Z</a>(<a class="code" href="ftgl_8h.html#ae792fb2619b3890381a8b68babbdac74">FTGL_DOUBLE</a> z) { values[2] = z; }; <a name="l00252"></a>00252 <a name="l00253"></a>00253 <a name="l00257"></a><a class="code" href="classFTPoint.html#a457293e822d995d3bab82dc021d39b6a">00257</a> <span class="keyword">inline</span> <a class="code" href="ftgl_8h.html#ae792fb2619b3890381a8b68babbdac74">FTGL_DOUBLE</a> <a class="code" href="classFTPoint.html#a457293e822d995d3bab82dc021d39b6a" title="Getters.">X</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> values[0]; }; <a name="l00258"></a><a class="code" href="classFTPoint.html#a49d45371eb101c2b85963338b01af6d3">00258</a> <span class="keyword">inline</span> <a class="code" href="ftgl_8h.html#ae792fb2619b3890381a8b68babbdac74">FTGL_DOUBLE</a> <a class="code" href="classFTPoint.html#a49d45371eb101c2b85963338b01af6d3">Y</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> values[1]; }; <a name="l00259"></a><a class="code" href="classFTPoint.html#a2a5784d1b50ff47e07ff327b295fe2ba">00259</a> <span class="keyword">inline</span> <a class="code" href="ftgl_8h.html#ae792fb2619b3890381a8b68babbdac74">FTGL_DOUBLE</a> <a class="code" href="classFTPoint.html#a2a5784d1b50ff47e07ff327b295fe2ba">Z</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> values[2]; }; <a name="l00260"></a><a class="code" href="classFTPoint.html#ab1d302e6449554c1436344f53d837567">00260</a> <span class="keyword">inline</span> <a class="code" href="ftgl_8h.html#ad08e479bb6a0dbe611100e8549d55a1b">FTGL_FLOAT</a> <a class="code" href="classFTPoint.html#ab1d302e6449554c1436344f53d837567">Xf</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><a class="code" href="ftgl_8h.html#ad08e479bb6a0dbe611100e8549d55a1b">FTGL_FLOAT</a><span class="keyword">></span>(values[0]); }; <a name="l00261"></a><a class="code" href="classFTPoint.html#a053519d9a0a76828a4f66850755316d0">00261</a> <span class="keyword">inline</span> <a class="code" href="ftgl_8h.html#ad08e479bb6a0dbe611100e8549d55a1b">FTGL_FLOAT</a> <a class="code" href="classFTPoint.html#a053519d9a0a76828a4f66850755316d0">Yf</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><a class="code" href="ftgl_8h.html#ad08e479bb6a0dbe611100e8549d55a1b">FTGL_FLOAT</a><span class="keyword">></span>(values[1]); }; <a name="l00262"></a><a class="code" href="classFTPoint.html#a00c075c3d15a95a611094e1d13bf32b9">00262</a> <span class="keyword">inline</span> <a class="code" href="ftgl_8h.html#ad08e479bb6a0dbe611100e8549d55a1b">FTGL_FLOAT</a> <a class="code" href="classFTPoint.html#a00c075c3d15a95a611094e1d13bf32b9">Zf</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><a class="code" href="ftgl_8h.html#ad08e479bb6a0dbe611100e8549d55a1b">FTGL_FLOAT</a><span class="keyword">></span>(values[2]); }; <a name="l00263"></a>00263 <a name="l00264"></a>00264 <span class="keyword">private</span>: <a name="l00268"></a>00268 <a class="code" href="ftgl_8h.html#ae792fb2619b3890381a8b68babbdac74">FTGL_DOUBLE</a> values[3]; <a name="l00269"></a>00269 }; <a name="l00270"></a>00270 <a name="l00271"></a>00271 <span class="preprocessor">#endif //__cplusplus</span> <a name="l00272"></a>00272 <span class="preprocessor"></span> <a name="l00273"></a>00273 <span class="preprocessor">#endif // __FTPoint__</span> <a name="l00274"></a>00274 <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>