<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>Irrlicht Engine: aabbox3d.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <table class="irrlicht" > <tr valign="middle"> <td><font size="2"><a class="qindex" href="index.html"><font color="#FFFFFF">Home</font></a> | <a class="qindex" href="namespaces.html"><font color="#FFFFFF">Namespaces</font></a> | <a class="qindex" href="hierarchy.html"><font color="#FFFFFF">Hierarchy</font></a> | <a class="qindex" href="classes.html"><font color="#FFFFFF">Alphabetical List</font></a> | <a class="qindex" href="annotated.html"><font color="#FFFFFF"> Class list</font></a> | <a class="qindex" href="files.html"><font color="#FFFFFF">Files</font></a> | <a class="qindex" href="namespacemembers.html"><font color="#FFFFFF"> Namespace Members</font></a> | <a class="qindex" href="functions.html"><font color="#FFFFFF">Class members</font></a> | <a class="qindex" href="globals.html"><font color="#FFFFFF">File members</font></a> | <a class="qindex" href="pages.html"><font color="#FFFFFF">Tutorials</font></a></font> </td> </tr> </table> <!-- Generated by Doxygen 1.6.2 --> <h1>aabbox3d.h</h1><a href="aabbox3d_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Copyright (C) 2002-2010 Nikolaus Gebhardt</span> <a name="l00002"></a>00002 <span class="comment">// This file is part of the "Irrlicht Engine".</span> <a name="l00003"></a>00003 <span class="comment">// For conditions of distribution and use, see copyright notice in irrlicht.h</span> <a name="l00004"></a>00004 <a name="l00005"></a>00005 <span class="preprocessor">#ifndef __IRR_AABBOX_3D_H_INCLUDED__</span> <a name="l00006"></a>00006 <span class="preprocessor"></span><span class="preprocessor">#define __IRR_AABBOX_3D_H_INCLUDED__</span> <a name="l00007"></a>00007 <span class="preprocessor"></span> <a name="l00008"></a>00008 <span class="preprocessor">#include "<a class="code" href="irr_math_8h.html">irrMath.h</a>"</span> <a name="l00009"></a>00009 <span class="preprocessor">#include "<a class="code" href="plane3d_8h.html">plane3d.h</a>"</span> <a name="l00010"></a>00010 <span class="preprocessor">#include "<a class="code" href="line3d_8h.html">line3d.h</a>"</span> <a name="l00011"></a>00011 <a name="l00012"></a><a class="code" href="namespaceirr_1_1core.html">00012</a> <span class="keyword">namespace </span>irr <a name="l00013"></a>00013 { <a name="l00014"></a>00014 <span class="keyword">namespace </span>core <a name="l00015"></a><a class="code" href="classirr_1_1core_1_1aabbox3d.html#aec7f681b248d9f0e07d62be0c921767e">00015</a> { <a name="l00016"></a>00016 <a name="l00018"></a>00018 <a name="l00020"></a>00020 <span class="keyword">template</span> <<span class="keyword">class</span> T> <a name="l00021"></a><a class="code" href="classirr_1_1core_1_1aabbox3d.html#af73ac9adeaae3abf8afaeb5f6be4a52c">00021</a> <span class="keyword">class </span><a class="code" href="classirr_1_1core_1_1aabbox3d.html" title="Axis aligned bounding box in 3d dimensional space.">aabbox3d</a> <a name="l00022"></a>00022 { <a name="l00023"></a>00023 <span class="keyword">public</span>: <a name="l00024"></a>00024 <a name="l00026"></a>00026 <a class="code" href="classirr_1_1core_1_1aabbox3d.html#aec7f681b248d9f0e07d62be0c921767e" title="Default Constructor.">aabbox3d</a>(): <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>(-1,-1,-1), <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>(1,1,1) {} <a name="l00028"></a>00028 <a class="code" href="classirr_1_1core_1_1aabbox3d.html#aec7f681b248d9f0e07d62be0c921767e" title="Default Constructor.">aabbox3d</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector3d.html" title="3d vector template class with lots of operators and methods.">vector3d<T></a>& min, <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector3d.html" title="3d vector template class with lots of operators and methods.">vector3d<T></a>& max): <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>(min), <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>(max) {} <a name="l00030"></a>00030 <a class="code" href="classirr_1_1core_1_1aabbox3d.html#aec7f681b248d9f0e07d62be0c921767e" title="Default Constructor.">aabbox3d</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector3d.html" title="3d vector template class with lots of operators and methods.">vector3d<T></a>& init): <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>(init), <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>(init) {} <a name="l00032"></a>00032 <a class="code" href="classirr_1_1core_1_1aabbox3d.html#aec7f681b248d9f0e07d62be0c921767e" title="Default Constructor.">aabbox3d</a>(T minx, T miny, T minz, T maxx, T maxy, T maxz): <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>(minx, miny, minz), <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>(maxx, maxy, maxz) {} <a name="l00033"></a>00033 <a name="l00034"></a>00034 <span class="comment">// operators</span> <a name="l00036"></a>00036 <span class="comment"></span> <a name="l00038"></a>00038 <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a0cc0518e11f284b8a6c3b3cb0f8cc389" title="Equality operator.">operator==</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html" title="Axis aligned bounding box in 3d dimensional space.">aabbox3d<T></a>& other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a> == other.<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a> && other.<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a> == <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>);} <a name="l00040"></a>00040 <a name="l00042"></a>00042 <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a6a8209973478e2c5bffde1259dfe95b6" title="Inequality operator.">operator!=</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html" title="Axis aligned bounding box in 3d dimensional space.">aabbox3d<T></a>& other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> !(<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a> == other.<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a> && other.<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a> == <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>);} <a name="l00043"></a>00043 <a name="l00044"></a>00044 <span class="comment">// functions</span> <a name="l00045"></a>00045 <a name="l00047"></a><a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5f7139087de60b4c16b5df015ade1cba">00047</a> <a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#afc718e96ed11aa71a30311d32bfc885a" title="Resets the bounding box to a one-point box.">reset</a>(T x, T y, T z) <a name="l00051"></a>00051 { <a name="l00052"></a>00052 <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>.set(x,y,z); <a name="l00053"></a>00053 <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a> = <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>; <a name="l00054"></a><a class="code" href="classirr_1_1core_1_1aabbox3d.html#af777a607745b2bd3f4390dfee8263944">00054</a> } <a name="l00055"></a>00055 <a name="l00057"></a>00057 <a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#afc718e96ed11aa71a30311d32bfc885a" title="Resets the bounding box to a one-point box.">reset</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html" title="Axis aligned bounding box in 3d dimensional space.">aabbox3d<T></a>& initValue) <a name="l00059"></a>00059 { <a name="l00060"></a>00060 *<span class="keyword">this</span> = initValue; <a name="l00061"></a>00061 } <a name="l00062"></a>00062 <a name="l00064"></a>00064 <a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#afc718e96ed11aa71a30311d32bfc885a" title="Resets the bounding box to a one-point box.">reset</a>(<span class="keyword">const</span> vector3d<T>& initValue) <a name="l00066"></a>00066 { <a name="l00067"></a>00067 <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a> = initValue; <a name="l00068"></a>00068 <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a> = initValue; <a name="l00069"></a>00069 } <a name="l00070"></a>00070 <a name="l00072"></a>00072 <a name="l00074"></a>00074 <span class="keywordtype">void</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a49e3765fd2f40a115f8f28bd74d62ccf" title="Adds a point to the bounding box.">addInternalPoint</a>(<span class="keyword">const</span> vector3d<T>& p) <a name="l00075"></a>00075 { <a name="l00076"></a>00076 <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a49e3765fd2f40a115f8f28bd74d62ccf" title="Adds a point to the bounding box.">addInternalPoint</a>(p.X, p.Y, p.Z); <a name="l00077"></a>00077 } <a name="l00078"></a>00078 <a name="l00080"></a>00080 <a name="l00082"></a><a class="code" href="classirr_1_1core_1_1aabbox3d.html#a123947cb6d77a3e0d6cbb65b63e8b86f">00082</a> <span class="keywordtype">void</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7ccc210a3fb0ce82765d28f2047942c5" title="Adds another bounding box.">addInternalBox</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html" title="Axis aligned bounding box in 3d dimensional space.">aabbox3d<T></a>& b) <a name="l00083"></a>00083 { <a name="l00084"></a>00084 <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a49e3765fd2f40a115f8f28bd74d62ccf" title="Adds a point to the bounding box.">addInternalPoint</a>(b.<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>); <a name="l00085"></a>00085 <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a49e3765fd2f40a115f8f28bd74d62ccf" title="Adds a point to the bounding box.">addInternalPoint</a>(b.<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>); <a name="l00086"></a>00086 } <a name="l00087"></a>00087 <a name="l00089"></a>00089 <a name="l00093"></a>00093 <span class="keywordtype">void</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a49e3765fd2f40a115f8f28bd74d62ccf" title="Adds a point to the bounding box.">addInternalPoint</a>(T x, T y, T z) <a name="l00094"></a>00094 { <a name="l00095"></a><a class="code" href="classirr_1_1core_1_1aabbox3d.html#a0d90eef7ce15729367337ce1a2233172">00095</a> <span class="keywordflow">if</span> (x><a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>.X) <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>.X = x; <a name="l00096"></a>00096 <span class="keywordflow">if</span> (y><a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>.Y) <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>.Y = y; <a name="l00097"></a>00097 <span class="keywordflow">if</span> (z><a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>.Z) <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>.Z = z; <a name="l00098"></a>00098 <a name="l00099"></a>00099 <span class="keywordflow">if</span> (x<<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.X) <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.X = x; <a name="l00100"></a>00100 <span class="keywordflow">if</span> (y<<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Y) <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Y = y; <a name="l00101"></a>00101 <span class="keywordflow">if</span> (z<<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Z) <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Z = z; <a name="l00102"></a><a class="code" href="classirr_1_1core_1_1aabbox3d.html#afedfc9540da0f3b2b3b7e6b0fd14a2a4">00102</a> } <a name="l00103"></a>00103 <a name="l00105"></a>00105 <a name="l00106"></a>00106 <a class="code" href="classirr_1_1core_1_1vector3d.html" title="3d vector template class with lots of operators and methods.">vector3d<T></a> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a0d90eef7ce15729367337ce1a2233172" title="Get center of the bounding box.">getCenter</a>()<span class="keyword"> const</span> <a name="l00107"></a>00107 <span class="keyword"> </span>{ <a name="l00108"></a>00108 <span class="keywordflow">return</span> (<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a> + <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>) / 2; <a name="l00109"></a>00109 } <a name="l00110"></a><a class="code" href="classirr_1_1core_1_1aabbox3d.html#a03ac10858bbe4e66a18f751358098528">00110</a> <a name="l00112"></a>00112 <a name="l00113"></a>00113 <a class="code" href="classirr_1_1core_1_1vector3d.html" title="3d vector template class with lots of operators and methods.">vector3d<T></a> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#afedfc9540da0f3b2b3b7e6b0fd14a2a4" title="Get extent of the box (maximal distance of two points in the box).">getExtent</a>()<span class="keyword"> const</span> <a name="l00114"></a>00114 <span class="keyword"> </span>{ <a name="l00115"></a>00115 <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a> - <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>; <a name="l00116"></a><a class="code" href="classirr_1_1core_1_1aabbox3d.html#ad948446d174e97e25d843ef0cd71a7a1">00116</a> } <a name="l00117"></a>00117 <a name="l00119"></a>00119 <a name="l00121"></a>00121 <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a03ac10858bbe4e66a18f751358098528" title="Check if the box is empty.">isEmpty</a>()<span class="keyword"> const</span> <a name="l00122"></a>00122 <span class="keyword"> </span>{ <a name="l00123"></a><a class="code" href="classirr_1_1core_1_1aabbox3d.html#a1609de045595ba6b6d57def85bcdffbf">00123</a> <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.equals ( <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a> ); <a name="l00124"></a>00124 } <a name="l00125"></a>00125 <a name="l00127"></a>00127 T <a class="code" href="classirr_1_1core_1_1aabbox3d.html#ad948446d174e97e25d843ef0cd71a7a1" title="Get the volume enclosed by the box in cubed units.">getVolume</a>()<span class="keyword"> const</span> <a name="l00128"></a>00128 <span class="keyword"> </span>{ <a name="l00129"></a>00129 <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector3d.html" title="3d vector template class with lots of operators and methods.">vector3d<T></a> e = <a class="code" href="classirr_1_1core_1_1aabbox3d.html#afedfc9540da0f3b2b3b7e6b0fd14a2a4" title="Get extent of the box (maximal distance of two points in the box).">getExtent</a>(); <a name="l00130"></a>00130 <span class="keywordflow">return</span> e.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a> * e.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a> * e.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a>; <a name="l00131"></a><a class="code" href="classirr_1_1core_1_1aabbox3d.html#a2b35e19c6c400c4c3d2b92ced108ca79">00131</a> } <a name="l00132"></a>00132 <a name="l00134"></a>00134 T <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a1609de045595ba6b6d57def85bcdffbf" title="Get the surface area of the box in squared units.">getArea</a>()<span class="keyword"> const</span> <a name="l00135"></a>00135 <span class="keyword"> </span>{ <a name="l00136"></a>00136 <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector3d.html" title="3d vector template class with lots of operators and methods.">vector3d<T></a> e = <a class="code" href="classirr_1_1core_1_1aabbox3d.html#afedfc9540da0f3b2b3b7e6b0fd14a2a4" title="Get extent of the box (maximal distance of two points in the box).">getExtent</a>(); <a name="l00137"></a>00137 <span class="keywordflow">return</span> 2*(e.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a>*e.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a> + e.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a>*e.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a> + e.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a>*e.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a>); <a name="l00138"></a>00138 } <a name="l00139"></a>00139 <a name="l00141"></a>00141 <a name="l00142"></a>00142 <span class="keywordtype">void</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a2b35e19c6c400c4c3d2b92ced108ca79" title="Stores all 8 edges of the box into an array.">getEdges</a>(vector3d<T> *edges)<span class="keyword"> const</span> <a name="l00143"></a>00143 <span class="keyword"> </span>{ <a name="l00144"></a>00144 <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector3d.html" title="3d vector template class with lots of operators and methods.">core::vector3d<T></a> middle = <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a0d90eef7ce15729367337ce1a2233172" title="Get center of the bounding box.">getCenter</a>(); <a name="l00145"></a>00145 <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector3d.html" title="3d vector template class with lots of operators and methods.">core::vector3d<T></a> diag = middle - <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>; <a name="l00146"></a>00146 <a name="l00147"></a>00147 <span class="comment">/*</span> <a name="l00148"></a>00148 <span class="comment"> Edges are stored in this way:</span> <a name="l00149"></a>00149 <span class="comment"> Hey, am I an ascii artist, or what? :) niko.</span> <a name="l00150"></a>00150 <span class="comment"> /3--------/7</span> <a name="l00151"></a>00151 <span class="comment"> / | / |</span> <a name="l00152"></a>00152 <span class="comment"> / | / |</span> <a name="l00153"></a>00153 <span class="comment"> 1---------5 |</span> <a name="l00154"></a>00154 <span class="comment"> | /2- - -|- -6</span> <a name="l00155"></a>00155 <span class="comment"> | / | /</span> <a name="l00156"></a>00156 <span class="comment"> |/ | /</span> <a name="l00157"></a>00157 <span class="comment"> 0---------4/</span> <a name="l00158"></a>00158 <span class="comment"> */</span> <a name="l00159"></a>00159 <a name="l00160"></a>00160 edges[0].set(middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a> + diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a>, middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a> + diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a>, middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a> + diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a>); <a name="l00161"></a><a class="code" href="classirr_1_1core_1_1aabbox3d.html#a904b14e6b6a99187820a7407b5d7cf23">00161</a> edges[1].set(middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a> + diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a>, middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a> - diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a>, middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a> + diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a>); <a name="l00162"></a>00162 edges[2].set(middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a> + diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a>, middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a> + diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a>, middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a> - diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a>); <a name="l00163"></a>00163 edges[3].set(middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a> + diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a>, middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a> - diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a>, middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a> - diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a>); <a name="l00164"></a>00164 edges[4].set(middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a> - diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a>, middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a> + diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a>, middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a> + diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a>); <a name="l00165"></a>00165 edges[5].set(middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a> - diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a>, middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a> - diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a>, middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a> + diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a>); <a name="l00166"></a>00166 edges[6].set(middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a> - diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a>, middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a> + diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a>, middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a> - diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a>); <a name="l00167"></a>00167 edges[7].set(middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a> - diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a>, middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a> - diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a>, middle.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a> - diag.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a>); <a name="l00168"></a>00168 } <a name="l00169"></a>00169 <a name="l00171"></a>00171 <a name="l00172"></a>00172 <span class="keywordtype">void</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a904b14e6b6a99187820a7407b5d7cf23" title="Repairs the box.">repair</a>() <a name="l00173"></a>00173 { <a name="l00174"></a>00174 T t; <a name="l00175"></a>00175 <a name="l00176"></a>00176 <span class="keywordflow">if</span> (<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.X > MaxEdge.X) <a name="l00177"></a>00177 { t=<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.X; <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.X = MaxEdge.X; MaxEdge.X=t; } <a name="l00178"></a>00178 <span class="keywordflow">if</span> (<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Y > MaxEdge.Y) <a name="l00179"></a><a class="code" href="classirr_1_1core_1_1aabbox3d.html#a9dc0f5991971a440532f924584306814">00179</a> { t=<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Y; <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Y = MaxEdge.Y; MaxEdge.Y=t; } <a name="l00180"></a>00180 <span class="keywordflow">if</span> (<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Z > MaxEdge.Z) <a name="l00181"></a>00181 { t=<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Z; <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Z = MaxEdge.Z; MaxEdge.Z=t; } <a name="l00182"></a>00182 } <a name="l00183"></a>00183 <a name="l00185"></a>00185 <a name="l00190"></a><a class="code" href="classirr_1_1core_1_1aabbox3d.html#aee439d703d121617c3bd6095c93e6852">00190</a> <a class="code" href="classirr_1_1core_1_1aabbox3d.html" title="Axis aligned bounding box in 3d dimensional space.">aabbox3d<T></a> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a9dc0f5991971a440532f924584306814" title="Calculates a new interpolated bounding box.">getInterpolated</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html" title="Axis aligned bounding box in 3d dimensional space.">aabbox3d<T></a>& other, <a class="code" href="namespaceirr.html#a0277be98d67dc26ff93b1a6a1d086b07" title="32 bit floating point variable.">f32</a> d)<span class="keyword"> const</span> <a name="l00191"></a>00191 <span class="keyword"> </span>{ <a name="l00192"></a>00192 <a class="code" href="namespaceirr.html#a0277be98d67dc26ff93b1a6a1d086b07" title="32 bit floating point variable.">f32</a> inv = 1.0f - d; <a name="l00193"></a>00193 <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html" title="Axis aligned bounding box in 3d dimensional space.">aabbox3d<T></a>((other.<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>*inv) + (<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>*d), <a name="l00194"></a>00194 (other.<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>*inv) + (MaxEdge*d)); <a name="l00195"></a>00195 } <a name="l00196"></a>00196 <a name="l00198"></a>00198 <a name="l00201"></a><a class="code" href="classirr_1_1core_1_1aabbox3d.html#a4e5d76484af9f3da23c1d5d3bb8bac9f">00201</a> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#aee439d703d121617c3bd6095c93e6852" title="Determines if a point is within this box.">isPointInside</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector3d.html" title="3d vector template class with lots of operators and methods.">vector3d<T></a>& p)<span class="keyword"> const</span> <a name="l00202"></a>00202 <span class="keyword"> </span>{ <a name="l00203"></a>00203 <span class="keywordflow">return</span> (p.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a> >= <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.X && p.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a> <= MaxEdge.X && <a name="l00204"></a>00204 p.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a> >= <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Y && p.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a> <= MaxEdge.Y && <a name="l00205"></a>00205 p.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a> >= <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Z && p.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a> <= MaxEdge.Z); <a name="l00206"></a>00206 } <a name="l00207"></a>00207 <a name="l00209"></a>00209 <a name="l00212"></a><a class="code" href="classirr_1_1core_1_1aabbox3d.html#a05f821fed7111655366fd8b3e9d8036f">00212</a> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a4e5d76484af9f3da23c1d5d3bb8bac9f" title="Determines if a point is within this box and not its borders.">isPointTotalInside</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector3d.html" title="3d vector template class with lots of operators and methods.">vector3d<T></a>& p)<span class="keyword"> const</span> <a name="l00213"></a>00213 <span class="keyword"> </span>{ <a name="l00214"></a>00214 <span class="keywordflow">return</span> (p.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a> > <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.X && p.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a> < MaxEdge.X && <a name="l00215"></a>00215 p.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a> > <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Y && p.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a> < MaxEdge.Y && <a name="l00216"></a>00216 p.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a> > <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Z && p.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a> < MaxEdge.Z); <a name="l00217"></a>00217 } <a name="l00218"></a>00218 <a name="l00220"></a>00220 <a name="l00223"></a>00223 <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a05f821fed7111655366fd8b3e9d8036f" title="Check if this box is completely inside the &#39;other&#39; box.">isFullInside</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html" title="Axis aligned bounding box in 3d dimensional space.">aabbox3d<T></a>& other)<span class="keyword"> const</span> <a name="l00224"></a>00224 <span class="keyword"> </span>{ <a name="l00225"></a>00225 <span class="keywordflow">return</span> (<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.X >= other.<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.X && <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Y >= other.<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Y && <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Z >= other.<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Z && <a name="l00226"></a>00226 MaxEdge.X <= other.<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>.X && MaxEdge.Y <= other.<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>.Y && MaxEdge.Z <= other.<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92" title="The far edge.">MaxEdge</a>.Z); <a name="l00227"></a>00227 } <a name="l00228"></a>00228 <a name="l00230"></a>00230 <a name="l00233"></a>00233 <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5d3d9d09354c4c362625dab7a15dcedb" title="Determines if the axis-aligned box intersects with another axis-aligned box.">intersectsWithBox</a>(<span class="keyword">const</span> aabbox3d<T>& other)<span class="keyword"> const</span> <a name="l00234"></a>00234 <span class="keyword"> </span>{ <a name="l00235"></a>00235 <span class="keywordflow">return</span> (<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.X <= other.MaxEdge.X && <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Y <= other.MaxEdge.Y && <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Z <= other.MaxEdge.Z && <a name="l00236"></a>00236 MaxEdge.X >= other.MinEdge.X && MaxEdge.Y >= other.MinEdge.Y && MaxEdge.Z >= other.MinEdge.Z); <a name="l00237"></a>00237 } <a name="l00238"></a>00238 <a name="l00240"></a>00240 <a name="l00242"></a><a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7e252d09fdc83431955f48156ca2ae5c">00242</a> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a34923d0c727e92df84906f256277e503" title="Tests if the box intersects with a line.">intersectsWithLine</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1line3d.html" title="3D line between two points with intersection methods.">line3d<T></a>& line)<span class="keyword"> const</span> <a name="l00243"></a>00243 <span class="keyword"> </span>{ <a name="l00244"></a>00244 <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7e252d09fdc83431955f48156ca2ae5c" title="Tests if the box intersects with a line.">intersectsWithLine</a>(line.<a class="code" href="classirr_1_1core_1_1line3d.html#a2d4f769eb73ef41e3223dc0b2713a759" title="Get middle of line.">getMiddle</a>(), line.<a class="code" href="classirr_1_1core_1_1line3d.html#a1394b59b713cec4044259d1999bbcc80" title="Get vector of line.">getVector</a>().normalize(), <a name="l00245"></a>00245 (T)(line.<a class="code" href="classirr_1_1core_1_1line3d.html#abbcbf8958f99c0204c54024322c07a03" title="Get length of line.">getLength</a>() * 0.5)); <a name="l00246"></a>00246 } <a name="l00247"></a>00247 <a name="l00249"></a>00249 <a name="l00253"></a>00253 <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a34923d0c727e92df84906f256277e503" title="Tests if the box intersects with a line.">intersectsWithLine</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector3d.html" title="3d vector template class with lots of operators and methods.">vector3d<T></a>& linemiddle, <a name="l00254"></a>00254 <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector3d.html" title="3d vector template class with lots of operators and methods.">vector3d<T></a>& linevect, T halflength)<span class="keyword"> const</span> <a name="l00255"></a>00255 <span class="keyword"> </span>{ <a name="l00256"></a>00256 <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector3d.html" title="3d vector template class with lots of operators and methods.">vector3d<T></a> e = <a class="code" href="classirr_1_1core_1_1aabbox3d.html#afedfc9540da0f3b2b3b7e6b0fd14a2a4" title="Get extent of the box (maximal distance of two points in the box).">getExtent</a>() * (T)0.5; <a name="l00257"></a>00257 <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector3d.html" title="3d vector template class with lots of operators and methods.">vector3d<T></a> t = <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a0d90eef7ce15729367337ce1a2233172" title="Get center of the bounding box.">getCenter</a>() - linemiddle; <a name="l00258"></a>00258 <a name="l00259"></a>00259 <span class="keywordflow">if</span> ((fabs(t.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a>) > e.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a> + halflength * fabs(linevect.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a>)) || <a name="l00260"></a>00260 (fabs(t.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a>) > e.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a> + halflength * fabs(linevect.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a>)) || <a name="l00261"></a>00261 (fabs(t.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a>) > e.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a> + halflength * fabs(linevect.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a>)) ) <a name="l00262"></a>00262 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00263"></a>00263 <a name="l00264"></a>00264 T r = e.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a> * (T)fabs(linevect.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a>) + e.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a> * (T)fabs(linevect.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a>); <a name="l00265"></a>00265 <span class="keywordflow">if</span> (fabs(t.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a>*linevect.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a> - t.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a>*linevect.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a>) > r ) <a name="l00266"></a>00266 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00267"></a>00267 <a name="l00268"></a>00268 r = e.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a> * (T)fabs(linevect.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a>) + e.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a> * (T)fabs(linevect.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a>); <a name="l00269"></a>00269 <span class="keywordflow">if</span> (fabs(t.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a>*linevect.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a> - t.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a>*linevect.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a>) > r ) <a name="l00270"></a>00270 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00271"></a>00271 <a name="l00272"></a>00272 r = e.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a> * (T)fabs(linevect.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a>) + e.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a> * (T)fabs(linevect.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a>); <a name="l00273"></a><a class="code" href="classirr_1_1core_1_1aabbox3d.html#aec3f7aa9c61ac773eea6c12924bcaea6">00273</a> <span class="keywordflow">if</span> (fabs(t.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a>*linevect.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a> - t.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a>*linevect.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a>) > r) <a name="l00274"></a>00274 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00275"></a>00275 <a name="l00276"></a>00276 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00277"></a>00277 } <a name="l00278"></a>00278 <a name="l00280"></a>00280 <a name="l00284"></a>00284 <a class="code" href="namespaceirr_1_1core.html#a8a9999eb0d151083f48afe5f7d17a96c" title="Enumeration for intersection relations of 3d objects.">EIntersectionRelation3D</a> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#aec3f7aa9c61ac773eea6c12924bcaea6" title="Classifies a relation with a plane.">classifyPlaneRelation</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1plane3d.html" title="Template plane class with some intersection testing methods.">plane3d<T></a>& plane)<span class="keyword"> const</span> <a name="l00285"></a>00285 <span class="keyword"> </span>{ <a name="l00286"></a>00286 <a class="code" href="classirr_1_1core_1_1vector3d.html" title="3d vector template class with lots of operators and methods.">vector3d<T></a> nearPoint(MaxEdge); <a name="l00287"></a>00287 <a class="code" href="classirr_1_1core_1_1vector3d.html" title="3d vector template class with lots of operators and methods.">vector3d<T></a> farPoint(<a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>); <a name="l00288"></a>00288 <a name="l00289"></a>00289 <span class="keywordflow">if</span> (plane.<a class="code" href="classirr_1_1core_1_1plane3d.html#a932ca6e90e55cdceedb4f15ab706b719" title="Normal vector of the plane.">Normal</a>.X > (T)0) <a name="l00290"></a>00290 { <a name="l00291"></a>00291 nearPoint.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a> = <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.X; <a name="l00292"></a>00292 farPoint.<a class="code" href="classirr_1_1core_1_1vector3d.html#a8c9ed06774dc668112bcefacb6e7732b" title="X coordinate of the vector.">X</a> = MaxEdge.X; <a name="l00293"></a>00293 } <a name="l00294"></a>00294 <a name="l00295"></a>00295 <span class="keywordflow">if</span> (plane.<a class="code" href="classirr_1_1core_1_1plane3d.html#a932ca6e90e55cdceedb4f15ab706b719" title="Normal vector of the plane.">Normal</a>.Y > (T)0) <a name="l00296"></a>00296 { <a name="l00297"></a>00297 nearPoint.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a> = <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Y; <a name="l00298"></a>00298 farPoint.<a class="code" href="classirr_1_1core_1_1vector3d.html#af8f87c2fe0ce717ade7c3d7419302fbd" title="Y coordinate of the vector.">Y</a> = MaxEdge.Y; <a name="l00299"></a>00299 } <a name="l00300"></a>00300 <a name="l00301"></a>00301 <span class="keywordflow">if</span> (plane.<a class="code" href="classirr_1_1core_1_1plane3d.html#a932ca6e90e55cdceedb4f15ab706b719" title="Normal vector of the plane.">Normal</a>.Z > (T)0) <a name="l00302"></a>00302 { <a name="l00303"></a>00303 nearPoint.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a> = <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>.Z; <a name="l00304"></a>00304 farPoint.<a class="code" href="classirr_1_1core_1_1vector3d.html#ac2beb702e718c3579971348981b220ed" title="Z coordinate of the vector.">Z</a> = MaxEdge.Z; <a name="l00305"></a>00305 } <a name="l00306"></a><a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5">00306</a> <a name="l00307"></a>00307 <span class="keywordflow">if</span> (plane.<a class="code" href="classirr_1_1core_1_1plane3d.html#a932ca6e90e55cdceedb4f15ab706b719" title="Normal vector of the plane.">Normal</a>.dotProduct(nearPoint) + plane.<a class="code" href="classirr_1_1core_1_1plane3d.html#afa304cf77cf1a3aae2351d5add5606a8" title="Distance from origin.">D</a> > (T)0) <a name="l00308"></a>00308 <span class="keywordflow">return</span> <a class="code" href="namespaceirr_1_1core.html#a8a9999eb0d151083f48afe5f7d17a96ca30484977b2480b6d6621114512d0b703">ISREL3D_FRONT</a>; <a name="l00309"></a><a class="code" href="classirr_1_1core_1_1aabbox3d.html#a5aad7217e8189f09dde3ec4a69e4ac92">00309</a> <a name="l00310"></a>00310 <span class="keywordflow">if</span> (plane.<a class="code" href="classirr_1_1core_1_1plane3d.html#a932ca6e90e55cdceedb4f15ab706b719" title="Normal vector of the plane.">Normal</a>.dotProduct(farPoint) + plane.<a class="code" href="classirr_1_1core_1_1plane3d.html#afa304cf77cf1a3aae2351d5add5606a8" title="Distance from origin.">D</a> > (T)0) <a name="l00311"></a>00311 <span class="keywordflow">return</span> <a class="code" href="namespaceirr_1_1core.html#a8a9999eb0d151083f48afe5f7d17a96ca4a33464e7b7175c8614c5a6c9f9a3751">ISREL3D_CLIPPED</a>; <a name="l00312"></a>00312 <a name="l00313"></a>00313 <span class="keywordflow">return</span> <a class="code" href="namespaceirr_1_1core.html#a8a9999eb0d151083f48afe5f7d17a96cae3f42495b4c63c980c19a82a44b7746b">ISREL3D_BACK</a>; <a name="l00314"></a>00314 } <a name="l00315"></a>00315 <a name="l00317"></a>00317 <a class="code" href="classirr_1_1core_1_1vector3d.html" title="3d vector template class with lots of operators and methods.">vector3d<T></a> <a class="code" href="classirr_1_1core_1_1aabbox3d.html#a7501c7df834939fa25e5f70b8527e7b5" title="The near edge.">MinEdge</a>; <a name="l00318"></a>00318 <a name="l00320"></a><a class="code" href="namespaceirr_1_1core.html#adfc8fa01b30044c55f3332a1d6c1aa19">00320</a> <a class="code" href="classirr_1_1core_1_1vector3d.html" title="3d vector template class with lots of operators and methods.">vector3d<T></a> MaxEdge; <a name="l00321"></a>00321 }; <a name="l00322"></a><a class="code" href="namespaceirr_1_1core.html#aef0f05a94d0d0f232a80bb36cbb070b5">00322</a> <a name="l00324"></a>00324 <span class="keyword">typedef</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html">aabbox3d<f32></a> <a class="code" href="classirr_1_1core_1_1aabbox3d.html">aabbox3df</a>; <a name="l00326"></a>00326 <span class="keyword">typedef</span> <a class="code" href="classirr_1_1core_1_1aabbox3d.html" title="Axis aligned bounding box in 3d dimensional space.">aabbox3d<s32></a> <a class="code" href="classirr_1_1core_1_1aabbox3d.html" title="Axis aligned bounding box in 3d dimensional space.">aabbox3di</a>; <a name="l00327"></a>00327 <a name="l00328"></a>00328 } <span class="comment">// end namespace core</span> <a name="l00329"></a>00329 } <span class="comment">// end namespace irr</span> <a name="l00330"></a>00330 <a name="l00331"></a>00331 <span class="preprocessor">#endif</span> <a name="l00332"></a>00332 <span class="preprocessor"></span> </pre></div></div> <hr size="1"> <address style="align: right;"> <small> </small> </address> <table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td width="0"> <div align="left"><small><a href="http://irrlicht.sourceforge.net" target="_blank"><img src="irrlicht.png" alt="The Irrlicht Engine" align="middle" border=0 width=88 height=31></a></small></div></td> <td> <div align="left"><small><em><font size="2">The <a href="http://irrlicht.sourceforge.net" target="_blank">Irrlicht Engine</a> Documentation © 2003-2010 by Nikolaus Gebhardt. Generated on Sun Oct 24 12:41:56 2010 by <a href="http://www.doxygen.org" target="_blank">Doxygen</a> (1.6.2)</font></em></small></div></td> </tr> </table> <address style="align: right;"> </address> </body> </html>