<!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: vector2d.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.5.6 --> <h1>vector2d.h</h1><a href="vector2d_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-2009 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_POINT_2D_H_INCLUDED__</span> <a name="l00006"></a>00006 <span class="preprocessor"></span><span class="preprocessor">#define __IRR_POINT_2D_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="dimension2d_8h.html">dimension2d.h</a>"</span> <a name="l00010"></a>00010 <a name="l00011"></a>00011 <span class="keyword">namespace </span>irr <a name="l00012"></a>00012 { <a name="l00013"></a>00013 <span class="keyword">namespace </span>core <a name="l00014"></a>00014 { <a name="l00015"></a>00015 <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_1vector2d.html">00021</a> <span class="keyword">class </span><a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d</a> <a name="l00022"></a>00022 { <a name="l00023"></a>00023 <span class="keyword">public</span>: <a name="l00025"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#72c37c85b812bdaee77a32857d12bb7f">00025</a> <a class="code" href="classirr_1_1core_1_1vector2d.html#72c37c85b812bdaee77a32857d12bb7f" title="Default constructor (null vector).">vector2d</a>() : <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>(0), <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>(0) {} <a name="l00027"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#ddeb85b77b2f8372609330c66ffe53b0">00027</a> <a class="code" href="classirr_1_1core_1_1vector2d.html#72c37c85b812bdaee77a32857d12bb7f" title="Default constructor (null vector).">vector2d</a>(T nx, T ny) : <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>(nx), <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>(ny) {} <a name="l00029"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#88a082b80dbf6b5c221e5086fbade7e5">00029</a> <span class="keyword">explicit</span> <a class="code" href="classirr_1_1core_1_1vector2d.html#72c37c85b812bdaee77a32857d12bb7f" title="Default constructor (null vector).">vector2d</a>(T n) : <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>(n), <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>(n) {} <a name="l00031"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#8ebd20ef37425d42120c13aabdf63298">00031</a> <a class="code" href="classirr_1_1core_1_1vector2d.html#72c37c85b812bdaee77a32857d12bb7f" title="Default constructor (null vector).">vector2d</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& other) : <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>(other.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>), <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>(other.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>) {} <a name="l00032"></a>00032 <a name="l00033"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#d394222b16dcdc23c416d57acbb367cb">00033</a> <a class="code" href="classirr_1_1core_1_1vector2d.html#72c37c85b812bdaee77a32857d12bb7f" title="Default constructor (null vector).">vector2d</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1dimension2d.html" title="Specifies a 2 dimensional size.">dimension2d<T></a>& other) : <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>(other.Width), <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>(other.Height) {} <a name="l00034"></a>00034 <a name="l00035"></a>00035 <span class="comment">// operators</span> <a name="l00036"></a>00036 <a name="l00037"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#d3fec2fa4ab4a2c6e5705d67399ee84c">00037</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a> <a class="code" href="classirr_1_1core_1_1vector2d.html#d3fec2fa4ab4a2c6e5705d67399ee84c">operator-</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>(-<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>, -<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>); } <a name="l00038"></a>00038 <a name="l00039"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#26ed12896e0f2b596b90104a10afabe1">00039</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& <a class="code" href="classirr_1_1core_1_1vector2d.html#26ed12896e0f2b596b90104a10afabe1">operator=</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& other) { <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> = other.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>; <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> = other.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>; <span class="keywordflow">return</span> *<span class="keyword">this</span>; } <a name="l00040"></a>00040 <a name="l00041"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#0ee6c8bafead525cd415c84cf74012f2">00041</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& <a class="code" href="classirr_1_1core_1_1vector2d.html#26ed12896e0f2b596b90104a10afabe1">operator=</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1dimension2d.html" title="Specifies a 2 dimensional size.">dimension2d<T></a>& other) { <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> = other.<a class="code" href="classirr_1_1core_1_1dimension2d.html#0399dcc023c19d381d1a192596107db4" title="Width of the dimension.">Width</a>; <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> = other.<a class="code" href="classirr_1_1core_1_1dimension2d.html#89b253523d31336c6b2a6a56dfd48a6b" title="Height of the dimension.">Height</a>; <span class="keywordflow">return</span> *<span class="keyword">this</span>; } <a name="l00042"></a>00042 <a name="l00043"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#d61d79f7e748f3b02eb57cc61c231a99">00043</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a> <a class="code" href="classirr_1_1core_1_1vector2d.html#d61d79f7e748f3b02eb57cc61c231a99">operator+</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>(<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> + other.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>, <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> + other.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>); } <a name="l00044"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#03cea10fda9ab64ad0378ab78bcbb101">00044</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a> <a class="code" href="classirr_1_1core_1_1vector2d.html#d61d79f7e748f3b02eb57cc61c231a99">operator+</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1dimension2d.html" title="Specifies a 2 dimensional size.">dimension2d<T></a>& other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>(<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> + other.<a class="code" href="classirr_1_1core_1_1dimension2d.html#0399dcc023c19d381d1a192596107db4" title="Width of the dimension.">Width</a>, <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> + other.<a class="code" href="classirr_1_1core_1_1dimension2d.html#89b253523d31336c6b2a6a56dfd48a6b" title="Height of the dimension.">Height</a>); } <a name="l00045"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#9562439453b7fe491e3f3310e6e36440">00045</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& <a class="code" href="classirr_1_1core_1_1vector2d.html#9562439453b7fe491e3f3310e6e36440">operator+=</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& other) { <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>+=other.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>; <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>+=other.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>; <span class="keywordflow">return</span> *<span class="keyword">this</span>; } <a name="l00046"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#0f2a30be25c63b94cb64dc158af7d0ee">00046</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a> <a class="code" href="classirr_1_1core_1_1vector2d.html#d61d79f7e748f3b02eb57cc61c231a99">operator+</a>(<span class="keyword">const</span> T v)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>(<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> + v, <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> + v); } <a name="l00047"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#3f2bf3a89761ccd3f63fd252e8627d06">00047</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& <a class="code" href="classirr_1_1core_1_1vector2d.html#9562439453b7fe491e3f3310e6e36440">operator+=</a>(<span class="keyword">const</span> T v) { <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>+=v; <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>+=v; <span class="keywordflow">return</span> *<span class="keyword">this</span>; } <a name="l00048"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#a05c788c6e98643e285ceaa31da30e8d">00048</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& <a class="code" href="classirr_1_1core_1_1vector2d.html#9562439453b7fe491e3f3310e6e36440">operator+=</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1dimension2d.html" title="Specifies a 2 dimensional size.">dimension2d<T></a>& other) { <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> += other.<a class="code" href="classirr_1_1core_1_1dimension2d.html#0399dcc023c19d381d1a192596107db4" title="Width of the dimension.">Width</a>; <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> += other.<a class="code" href="classirr_1_1core_1_1dimension2d.html#89b253523d31336c6b2a6a56dfd48a6b" title="Height of the dimension.">Height</a>; <span class="keywordflow">return</span> *<span class="keyword">this</span>; } <a name="l00049"></a>00049 <a name="l00050"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#12431c746cfdefb6f4c789a610fddbd1">00050</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a> <a class="code" href="classirr_1_1core_1_1vector2d.html#d3fec2fa4ab4a2c6e5705d67399ee84c">operator-</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>(<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> - other.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>, <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> - other.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>); } <a name="l00051"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#f1833e3ff96a4cf3005ceb322cfc62b1">00051</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a> <a class="code" href="classirr_1_1core_1_1vector2d.html#d3fec2fa4ab4a2c6e5705d67399ee84c">operator-</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1dimension2d.html" title="Specifies a 2 dimensional size.">dimension2d<T></a>& other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>(<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> - other.<a class="code" href="classirr_1_1core_1_1dimension2d.html#0399dcc023c19d381d1a192596107db4" title="Width of the dimension.">Width</a>, <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> - other.<a class="code" href="classirr_1_1core_1_1dimension2d.html#89b253523d31336c6b2a6a56dfd48a6b" title="Height of the dimension.">Height</a>); } <a name="l00052"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#557a9942c5592d176276e1af8e6da2a4">00052</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& <a class="code" href="classirr_1_1core_1_1vector2d.html#557a9942c5592d176276e1af8e6da2a4">operator-=</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& other) { <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>-=other.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>; <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>-=other.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>; <span class="keywordflow">return</span> *<span class="keyword">this</span>; } <a name="l00053"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#95e234978a779d84135c123e4ecd0a06">00053</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a> <a class="code" href="classirr_1_1core_1_1vector2d.html#d3fec2fa4ab4a2c6e5705d67399ee84c">operator-</a>(<span class="keyword">const</span> T v)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>(<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> - v, <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> - v); } <a name="l00054"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#7fbdd3a9627d4f7342c2f897b846c131">00054</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& <a class="code" href="classirr_1_1core_1_1vector2d.html#557a9942c5592d176276e1af8e6da2a4">operator-=</a>(<span class="keyword">const</span> T v) { <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>-=v; <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>-=v; <span class="keywordflow">return</span> *<span class="keyword">this</span>; } <a name="l00055"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#9b8112fbfaa7d1a1c07bc3b8fb82e6fa">00055</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& <a class="code" href="classirr_1_1core_1_1vector2d.html#557a9942c5592d176276e1af8e6da2a4">operator-=</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1dimension2d.html" title="Specifies a 2 dimensional size.">dimension2d<T></a>& other) { <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> -= other.<a class="code" href="classirr_1_1core_1_1dimension2d.html#0399dcc023c19d381d1a192596107db4" title="Width of the dimension.">Width</a>; <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> -= other.<a class="code" href="classirr_1_1core_1_1dimension2d.html#89b253523d31336c6b2a6a56dfd48a6b" title="Height of the dimension.">Height</a>; <span class="keywordflow">return</span> *<span class="keyword">this</span>; } <a name="l00056"></a>00056 <a name="l00057"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#d0267af40443b941680e89803710d296">00057</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a> <a class="code" href="classirr_1_1core_1_1vector2d.html#d0267af40443b941680e89803710d296">operator*</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>(<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> * other.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>, <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> * other.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>); } <a name="l00058"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#2053cd0795a974e9531412967efcc605">00058</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& <a class="code" href="classirr_1_1core_1_1vector2d.html#2053cd0795a974e9531412967efcc605">operator*=</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& other) { <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>*=other.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>; <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>*=other.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>; <span class="keywordflow">return</span> *<span class="keyword">this</span>; } <a name="l00059"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#fb6e3105c7a869e05042eedcbc31cc84">00059</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a> <a class="code" href="classirr_1_1core_1_1vector2d.html#d0267af40443b941680e89803710d296">operator*</a>(<span class="keyword">const</span> T v)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>(<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> * v, <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> * v); } <a name="l00060"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#c0935984d68c32a2f0cd7e74c53751a7">00060</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& <a class="code" href="classirr_1_1core_1_1vector2d.html#2053cd0795a974e9531412967efcc605">operator*=</a>(<span class="keyword">const</span> T v) { <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>*=v; <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>*=v; <span class="keywordflow">return</span> *<span class="keyword">this</span>; } <a name="l00061"></a>00061 <a name="l00062"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#4eb3724d5c798fbbe326645829eadc11">00062</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a> <a class="code" href="classirr_1_1core_1_1vector2d.html#4eb3724d5c798fbbe326645829eadc11">operator/</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>(<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> / other.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>, <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> / other.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>); } <a name="l00063"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#2ee6a9455f42afd1f6208332557c7bf6">00063</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& <a class="code" href="classirr_1_1core_1_1vector2d.html#2ee6a9455f42afd1f6208332557c7bf6">operator/=</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& other) { <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>/=other.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>; <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>/=other.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>; <span class="keywordflow">return</span> *<span class="keyword">this</span>; } <a name="l00064"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#343b682b0b27782efecfcc4bc2b62162">00064</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a> <a class="code" href="classirr_1_1core_1_1vector2d.html#4eb3724d5c798fbbe326645829eadc11">operator/</a>(<span class="keyword">const</span> T v)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>(<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> / v, <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> / v); } <a name="l00065"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#0a5115fdbc8023793d11ddfea27dd124">00065</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& <a class="code" href="classirr_1_1core_1_1vector2d.html#2ee6a9455f42afd1f6208332557c7bf6">operator/=</a>(<span class="keyword">const</span> T v) { <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>/=v; <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>/=v; <span class="keywordflow">return</span> *<span class="keyword">this</span>; } <a name="l00066"></a>00066 <a name="l00067"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#828609667abff67902f1de3c2718d9a9">00067</a> <span class="keywordtype">bool</span> operator<=(const vector2d<T>&other) <span class="keyword">const</span> { <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a><=other.X && <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a><=other.Y; } <a name="l00068"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#09446a47463a9b09c55f87c4ffa19841">00068</a> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1vector2d.html#09446a47463a9b09c55f87c4ffa19841">operator>=</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>&other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>>=other.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> && <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>>=other.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>; } <a name="l00069"></a>00069 <a name="l00070"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#c777d6a0b25ed66e73d1b71f25fdbe48">00070</a> <span class="keywordtype">bool</span> operator<(const vector2d<T>&other) <span class="keyword">const</span> { <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a><other.X && <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a><other.Y; } <a name="l00071"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#8cd8cc1a497e428e0318a5f698c8396b">00071</a> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1vector2d.html#8cd8cc1a497e428e0318a5f698c8396b">operator></a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>&other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>>other.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> && <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>>other.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>; } <a name="l00072"></a>00072 <a name="l00073"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#39d74f53f61d65876dc884be7ebe4420">00073</a> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1vector2d.html#39d74f53f61d65876dc884be7ebe4420">operator==</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html#dca6dbf0b73bbed483471137b8b13bd8" title="Checks if this vector equals the other one.">equals</a>(other); } <a name="l00074"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#9270c2d9b665790235d17ecb94450554">00074</a> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1vector2d.html#9270c2d9b665790235d17ecb94450554">operator!=</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> !<a class="code" href="classirr_1_1core_1_1vector2d.html#dca6dbf0b73bbed483471137b8b13bd8" title="Checks if this vector equals the other one.">equals</a>(other); } <a name="l00075"></a>00075 <a name="l00076"></a>00076 <span class="comment">// functions</span> <a name="l00077"></a>00077 <a name="l00079"></a>00079 <a name="l00082"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#dca6dbf0b73bbed483471137b8b13bd8">00082</a> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1vector2d.html#dca6dbf0b73bbed483471137b8b13bd8" title="Checks if this vector equals the other one.">equals</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& other)<span class="keyword"> const</span> <a name="l00083"></a>00083 <span class="keyword"> </span>{ <a name="l00084"></a>00084 <span class="keywordflow">return</span> <a class="code" href="namespaceirr_1_1core.html#9a54aa08fdc2119258ad8dfa44f8dadf" title="returns if a equals b, taking an explicit rounding tolerance into account">core::equals</a>(<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>, other.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>) && <a class="code" href="namespaceirr_1_1core.html#9a54aa08fdc2119258ad8dfa44f8dadf" title="returns if a equals b, taking an explicit rounding tolerance into account">core::equals</a>(<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>, other.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>); <a name="l00085"></a>00085 } <a name="l00086"></a>00086 <a name="l00087"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#b689d358d5ffb2ebf547d4597d6dbb9d">00087</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& <span class="keyword">set</span>(T nx, T ny) {<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>=nx; <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>=ny; <span class="keywordflow">return</span> *<span class="keyword">this</span>; } <a name="l00088"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#da63a008c05eabc08b4974edc409e001">00088</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& <span class="keyword">set</span>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& p) { <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>=p.X; <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>=p.Y; <span class="keywordflow">return</span> *<span class="keyword">this</span>; } <a name="l00089"></a>00089 <a name="l00091"></a>00091 <a name="l00092"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#d4c3614d12e2517223349a31632007ed">00092</a> T <a class="code" href="classirr_1_1core_1_1vector2d.html#d4c3614d12e2517223349a31632007ed" title="Gets the length of the vector.">getLength</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="namespaceirr_1_1core.html#6943186698de9d2ff47ce03fbe025230">core::squareroot</a>( <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>*<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> + <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>*<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> ); } <a name="l00093"></a>00093 <a name="l00095"></a>00095 <a name="l00097"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#50d7eaeed6caf2b99bf3cf86e084c362">00097</a> T <a class="code" href="classirr_1_1core_1_1vector2d.html#50d7eaeed6caf2b99bf3cf86e084c362" title="Get the squared length of this vector.">getLengthSQ</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>*<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> + <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>*<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>; } <a name="l00098"></a>00098 <a name="l00100"></a>00100 <a name="l00102"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#3899c231259a77c4aae6fec8ed72a6bc">00102</a> T <a class="code" href="classirr_1_1core_1_1vector2d.html#3899c231259a77c4aae6fec8ed72a6bc" title="Get the dot product of this vector with another.">dotProduct</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& other)<span class="keyword"> const</span> <a name="l00103"></a>00103 <span class="keyword"> </span>{ <a name="l00104"></a>00104 <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>*other.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> + <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>*other.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>; <a name="l00105"></a>00105 } <a name="l00106"></a>00106 <a name="l00108"></a>00108 <a name="l00111"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#e8541afbe62fe3b01e18fb04130f6d9e">00111</a> T <a class="code" href="classirr_1_1core_1_1vector2d.html#e8541afbe62fe3b01e18fb04130f6d9e" title="Gets distance from another point.">getDistanceFrom</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& other)<span class="keyword"> const</span> <a name="l00112"></a>00112 <span class="keyword"> </span>{ <a name="l00113"></a>00113 <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>(<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> - other.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>, <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> - other.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>).<a class="code" href="classirr_1_1core_1_1vector2d.html#d4c3614d12e2517223349a31632007ed" title="Gets the length of the vector.">getLength</a>(); <a name="l00114"></a>00114 } <a name="l00115"></a>00115 <a name="l00117"></a>00117 <a name="l00120"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#77262661ca3dcd6befea9bbc20bae4aa">00120</a> T <a class="code" href="classirr_1_1core_1_1vector2d.html#77262661ca3dcd6befea9bbc20bae4aa" title="Returns squared distance from another point.">getDistanceFromSQ</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& other)<span class="keyword"> const</span> <a name="l00121"></a>00121 <span class="keyword"> </span>{ <a name="l00122"></a>00122 <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>(<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> - other.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>, <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> - other.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>).<a class="code" href="classirr_1_1core_1_1vector2d.html#50d7eaeed6caf2b99bf3cf86e084c362" title="Get the squared length of this vector.">getLengthSQ</a>(); <a name="l00123"></a>00123 } <a name="l00124"></a>00124 <a name="l00126"></a>00126 <a name="l00129"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#c9c77997f6594d79d5daa5f6bf690ed2">00129</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& <a class="code" href="classirr_1_1core_1_1vector2d.html#c9c77997f6594d79d5daa5f6bf690ed2" title="rotates the point anticlockwise around a center by an amount of degrees.">rotateBy</a>(<a class="code" href="namespaceirr.html#1325b02603ad449f92c68fc640af9b28" title="64 bit floating point variable.">f64</a> degrees, <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& center=<a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>()) <a name="l00130"></a>00130 { <a name="l00131"></a>00131 degrees *= <a class="code" href="namespaceirr_1_1core.html#8e21b5969c8292857f7c9c5dcfd61c35" title="64bit constant for converting from degrees to radians (formally known as GRAD_PI2)...">DEGTORAD64</a>; <a name="l00132"></a>00132 <span class="keyword">const</span> <a class="code" href="namespaceirr.html#1325b02603ad449f92c68fc640af9b28" title="64 bit floating point variable.">f64</a> cs = cos(degrees); <a name="l00133"></a>00133 <span class="keyword">const</span> <a class="code" href="namespaceirr.html#1325b02603ad449f92c68fc640af9b28" title="64 bit floating point variable.">f64</a> sn = sin(degrees); <a name="l00134"></a>00134 <a name="l00135"></a>00135 <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> -= center.X; <a name="l00136"></a>00136 <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> -= center.Y; <a name="l00137"></a>00137 <a name="l00138"></a>00138 <span class="keyword">set</span>((T)(<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>*cs - <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>*sn), (T)(<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>*sn + <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>*cs)); <a name="l00139"></a>00139 <a name="l00140"></a>00140 <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> += center.X; <a name="l00141"></a>00141 <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> += center.Y; <a name="l00142"></a>00142 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00143"></a>00143 } <a name="l00144"></a>00144 <a name="l00146"></a>00146 <a name="l00148"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#5d5c360ed4c4fd28d4a42272634b8e55">00148</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& <a class="code" href="classirr_1_1core_1_1vector2d.html#5d5c360ed4c4fd28d4a42272634b8e55" title="Normalize the vector.">normalize</a>() <a name="l00149"></a>00149 { <a name="l00150"></a>00150 <a class="code" href="namespaceirr.html#0277be98d67dc26ff93b1a6a1d086b07" title="32 bit floating point variable.">f32</a> length = (<a class="code" href="namespaceirr.html#0277be98d67dc26ff93b1a6a1d086b07" title="32 bit floating point variable.">f32</a>)(<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>*<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> + <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>*<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>); <a name="l00151"></a>00151 <span class="keywordflow">if</span> (<a class="code" href="namespaceirr_1_1core.html#bf9b9b140cc365908ea4c8c47451e4e3" title="returns if a equals b, taking possible rounding errors into account">core::equals</a>(length, 0.f)) <a name="l00152"></a>00152 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00153"></a>00153 length = <a class="code" href="namespaceirr_1_1core.html#21c37238a7754b48ff18c486202a1e4b">core::reciprocal_squareroot</a> ( length ); <a name="l00154"></a>00154 <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> = (T)(<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> * length); <a name="l00155"></a>00155 Y = (T)(Y * length); <a name="l00156"></a>00156 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00157"></a>00157 } <a name="l00158"></a>00158 <a name="l00160"></a>00160 <a name="l00163"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#f1baa5b3cf7484262fd32cfbe6698655">00163</a> <a class="code" href="namespaceirr.html#1325b02603ad449f92c68fc640af9b28" title="64 bit floating point variable.">f64</a> <a class="code" href="classirr_1_1core_1_1vector2d.html#f1baa5b3cf7484262fd32cfbe6698655" title="Calculates the angle of this vector in degrees in the trigonometric sense.">getAngleTrig</a>()<span class="keyword"> const</span> <a name="l00164"></a>00164 <span class="keyword"> </span>{ <a name="l00165"></a>00165 <span class="keywordflow">if</span> (<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> == 0) <a name="l00166"></a>00166 <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> < 0 ? 180 : 0; <a name="l00167"></a>00167 <span class="keywordflow">else</span> <a name="l00168"></a>00168 <span class="keywordflow">if</span> (<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> == 0) <a name="l00169"></a>00169 <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> < 0 ? 270 : 90; <a name="l00170"></a>00170 <a name="l00171"></a>00171 <span class="keywordflow">if</span> ( <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> > 0) <a name="l00172"></a>00172 <span class="keywordflow">if</span> (<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> > 0) <a name="l00173"></a>00173 <span class="keywordflow">return</span> atan(<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>/<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>) * <a class="code" href="namespaceirr_1_1core.html#e7afeb48af12f5f5130cd179a644ec58" title="64bit constant for converting from radians to degrees">RADTODEG64</a>; <a name="l00174"></a>00174 <span class="keywordflow">else</span> <a name="l00175"></a>00175 <span class="keywordflow">return</span> 180.0-atan(<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>/-<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>) * <a class="code" href="namespaceirr_1_1core.html#e7afeb48af12f5f5130cd179a644ec58" title="64bit constant for converting from radians to degrees">RADTODEG64</a>; <a name="l00176"></a>00176 <span class="keywordflow">else</span> <a name="l00177"></a>00177 <span class="keywordflow">if</span> (<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> > 0) <a name="l00178"></a>00178 <span class="keywordflow">return</span> 360.0-atan(-<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>/<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>) * <a class="code" href="namespaceirr_1_1core.html#e7afeb48af12f5f5130cd179a644ec58" title="64bit constant for converting from radians to degrees">RADTODEG64</a>; <a name="l00179"></a>00179 <span class="keywordflow">else</span> <a name="l00180"></a>00180 <span class="keywordflow">return</span> 180.0+atan(-<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>/-<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>) * <a class="code" href="namespaceirr_1_1core.html#e7afeb48af12f5f5130cd179a644ec58" title="64bit constant for converting from radians to degrees">RADTODEG64</a>; <a name="l00181"></a>00181 } <a name="l00182"></a>00182 <a name="l00184"></a>00184 <a name="l00186"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#b75f18492cd0dac6dd0936e1ac65dc86">00186</a> <span class="keyword">inline</span> <a class="code" href="namespaceirr.html#1325b02603ad449f92c68fc640af9b28" title="64 bit floating point variable.">f64</a> <a class="code" href="classirr_1_1core_1_1vector2d.html#b75f18492cd0dac6dd0936e1ac65dc86" title="Calculates the angle of this vector in degrees in the counter trigonometric sense...">getAngle</a>()<span class="keyword"> const</span> <a name="l00187"></a>00187 <span class="keyword"> </span>{ <a name="l00188"></a>00188 <span class="keywordflow">if</span> (<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> == 0) <span class="comment">// corrected thanks to a suggestion by Jox</span> <a name="l00189"></a>00189 <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> < 0 ? 180 : 0; <a name="l00190"></a>00190 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> == 0) <a name="l00191"></a>00191 <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> < 0 ? 90 : 270; <a name="l00192"></a>00192 <a name="l00193"></a>00193 <span class="comment">// don't use getLength here to avoid precision loss with s32 vectors</span> <a name="l00194"></a>00194 <a class="code" href="namespaceirr.html#1325b02603ad449f92c68fc640af9b28" title="64 bit floating point variable.">f64</a> tmp = <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> / sqrt((<a class="code" href="namespaceirr.html#1325b02603ad449f92c68fc640af9b28" title="64 bit floating point variable.">f64</a>)(<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>*<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> + <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>*<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>)); <a name="l00195"></a>00195 tmp = atan( <a class="code" href="namespaceirr_1_1core.html#f2f378cc34a19f5da6fe1d4961646d1d">core::squareroot</a>(1 - tmp*tmp) / tmp) * <a class="code" href="namespaceirr_1_1core.html#e7afeb48af12f5f5130cd179a644ec58" title="64bit constant for converting from radians to degrees">RADTODEG64</a>; <a name="l00196"></a>00196 <a name="l00197"></a>00197 <span class="keywordflow">if</span> (<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>>0 && Y>0) <a name="l00198"></a>00198 <span class="keywordflow">return</span> tmp + 270; <a name="l00199"></a>00199 <span class="keywordflow">else</span> <a name="l00200"></a>00200 <span class="keywordflow">if</span> (<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>>0 && Y<0) <a name="l00201"></a>00201 <span class="keywordflow">return</span> tmp + 90; <a name="l00202"></a>00202 <span class="keywordflow">else</span> <a name="l00203"></a>00203 <span class="keywordflow">if</span> (<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a><0 && Y<0) <a name="l00204"></a>00204 <span class="keywordflow">return</span> 90 - tmp; <a name="l00205"></a>00205 <span class="keywordflow">else</span> <a name="l00206"></a>00206 <span class="keywordflow">if</span> (X<0 && Y>0) <a name="l00207"></a>00207 <span class="keywordflow">return</span> 270 - tmp; <a name="l00208"></a>00208 <a name="l00209"></a>00209 <span class="keywordflow">return</span> tmp; <a name="l00210"></a>00210 } <a name="l00211"></a>00211 <a name="l00213"></a>00213 <a name="l00215"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#581ab3975900d5af8d4c7517738beba2">00215</a> <span class="keyword">inline</span> <a class="code" href="namespaceirr.html#1325b02603ad449f92c68fc640af9b28" title="64 bit floating point variable.">f64</a> <a class="code" href="classirr_1_1core_1_1vector2d.html#581ab3975900d5af8d4c7517738beba2" title="Calculates the angle between this vector and another one in degree.">getAngleWith</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& b)<span class="keyword"> const</span> <a name="l00216"></a>00216 <span class="keyword"> </span>{ <a name="l00217"></a>00217 <a class="code" href="namespaceirr.html#1325b02603ad449f92c68fc640af9b28" title="64 bit floating point variable.">f64</a> tmp = <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>*b.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> + <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>*b.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>; <a name="l00218"></a>00218 <a name="l00219"></a>00219 <span class="keywordflow">if</span> (tmp == 0.0) <a name="l00220"></a>00220 <span class="keywordflow">return</span> 90.0; <a name="l00221"></a>00221 <a name="l00222"></a>00222 tmp = tmp / <a class="code" href="namespaceirr_1_1core.html#6943186698de9d2ff47ce03fbe025230">core::squareroot</a>((<a class="code" href="namespaceirr.html#1325b02603ad449f92c68fc640af9b28" title="64 bit floating point variable.">f64</a>)((<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>*<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> + <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>*<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>) * (b.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>*b.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> + b.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>*b.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>))); <a name="l00223"></a>00223 <span class="keywordflow">if</span> (tmp < 0.0) <a name="l00224"></a>00224 tmp = -tmp; <a name="l00225"></a>00225 <a name="l00226"></a>00226 <span class="keywordflow">return</span> atan(sqrt(1 - tmp*tmp) / tmp) * <a class="code" href="namespaceirr_1_1core.html#e7afeb48af12f5f5130cd179a644ec58" title="64bit constant for converting from radians to degrees">RADTODEG64</a>; <a name="l00227"></a>00227 } <a name="l00228"></a>00228 <a name="l00230"></a>00230 <a name="l00234"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#dc8bba9dfd48218d083dcbe88bf98da0">00234</a> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1vector2d.html#dc8bba9dfd48218d083dcbe88bf98da0" title="Returns if this vector interpreted as a point is on a line between two other points...">isBetweenPoints</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& begin, <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& end)<span class="keyword"> const</span> <a name="l00235"></a>00235 <span class="keyword"> </span>{ <a name="l00236"></a>00236 <span class="keywordflow">if</span> (begin.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> != end.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>) <a name="l00237"></a>00237 { <a name="l00238"></a>00238 <span class="keywordflow">return</span> ((begin.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> <= <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> && <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> <= end.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>) || <a name="l00239"></a>00239 (begin.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> >= <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> && <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> >= end.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>)); <a name="l00240"></a>00240 } <a name="l00241"></a>00241 <span class="keywordflow">else</span> <a name="l00242"></a>00242 { <a name="l00243"></a>00243 <span class="keywordflow">return</span> ((begin.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> <= <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> && <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> <= end.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>) || <a name="l00244"></a>00244 (begin.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> >= <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> && <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> >= end.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>)); <a name="l00245"></a>00245 } <a name="l00246"></a>00246 } <a name="l00247"></a>00247 <a name="l00249"></a>00249 <a name="l00253"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#865bbbdb5d5a7408cdf733d573c8d747">00253</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a> <a class="code" href="classirr_1_1core_1_1vector2d.html#865bbbdb5d5a7408cdf733d573c8d747" title="Creates an interpolated vector between this vector and another vector.">getInterpolated</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& other, <a class="code" href="namespaceirr.html#1325b02603ad449f92c68fc640af9b28" title="64 bit floating point variable.">f64</a> d)<span class="keyword"> const</span> <a name="l00254"></a>00254 <span class="keyword"> </span>{ <a name="l00255"></a>00255 <a class="code" href="namespaceirr.html#1325b02603ad449f92c68fc640af9b28" title="64 bit floating point variable.">f64</a> inv = 1.0f - d; <a name="l00256"></a>00256 <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>((T)(other.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>*inv + <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>*d), (T)(other.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>*inv + <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>*d)); <a name="l00257"></a>00257 } <a name="l00258"></a>00258 <a name="l00260"></a>00260 <a name="l00265"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#4d1636973532da5ee0c3c42f96f19ef9">00265</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a> <a class="code" href="classirr_1_1core_1_1vector2d.html#4d1636973532da5ee0c3c42f96f19ef9" title="Creates a quadratically interpolated vector between this and two other vectors.">getInterpolated_quadratic</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& v2, <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& v3, <a class="code" href="namespaceirr.html#1325b02603ad449f92c68fc640af9b28" title="64 bit floating point variable.">f64</a> d)<span class="keyword"> const</span> <a name="l00266"></a>00266 <span class="keyword"> </span>{ <a name="l00267"></a>00267 <span class="comment">// this*(1-d)*(1-d) + 2 * v2 * (1-d) + v3 * d * d;</span> <a name="l00268"></a>00268 <span class="keyword">const</span> <a class="code" href="namespaceirr.html#1325b02603ad449f92c68fc640af9b28" title="64 bit floating point variable.">f64</a> inv = 1.0f - d; <a name="l00269"></a>00269 <span class="keyword">const</span> <a class="code" href="namespaceirr.html#1325b02603ad449f92c68fc640af9b28" title="64 bit floating point variable.">f64</a> mul0 = inv * inv; <a name="l00270"></a>00270 <span class="keyword">const</span> <a class="code" href="namespaceirr.html#1325b02603ad449f92c68fc640af9b28" title="64 bit floating point variable.">f64</a> mul1 = 2.0f * d * inv; <a name="l00271"></a>00271 <span class="keyword">const</span> <a class="code" href="namespaceirr.html#1325b02603ad449f92c68fc640af9b28" title="64 bit floating point variable.">f64</a> mul2 = d * d; <a name="l00272"></a>00272 <a name="l00273"></a>00273 <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a> ( (T)(<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> * mul0 + v2.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> * mul1 + v3.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> * mul2), <a name="l00274"></a>00274 (T)(<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> * mul0 + v2.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> * mul1 + v3.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> * mul2)); <a name="l00275"></a>00275 } <a name="l00276"></a>00276 <a name="l00278"></a>00278 <a name="l00283"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#85bc48f5c313764fd56b51c730a62210">00283</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& <a class="code" href="classirr_1_1core_1_1vector2d.html#85bc48f5c313764fd56b51c730a62210" title="Sets this vector to the linearly interpolated vector between a and b.">interpolate</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& a, <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& b, <a class="code" href="namespaceirr.html#1325b02603ad449f92c68fc640af9b28" title="64 bit floating point variable.">f64</a> d) <a name="l00284"></a>00284 { <a name="l00285"></a>00285 <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> = (T)((<a class="code" href="namespaceirr.html#1325b02603ad449f92c68fc640af9b28" title="64 bit floating point variable.">f64</a>)b.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> + ( ( a.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> - b.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> ) * d )); <a name="l00286"></a>00286 <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> = (T)((<a class="code" href="namespaceirr.html#1325b02603ad449f92c68fc640af9b28" title="64 bit floating point variable.">f64</a>)b.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> + ( ( a.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> - b.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a> ) * d )); <a name="l00287"></a>00287 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00288"></a>00288 } <a name="l00289"></a>00289 <a name="l00291"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d">00291</a> T <a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a>; <a name="l00292"></a>00292 <a name="l00294"></a><a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c">00294</a> T <a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>; <a name="l00295"></a>00295 }; <a name="l00296"></a>00296 <a name="l00298"></a><a class="code" href="namespaceirr_1_1core.html#2cf08556d77f6f5a792973a6e27ed11b">00298</a> <span class="keyword">typedef</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<f32></a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2df</a>; <a name="l00299"></a>00299 <a name="l00301"></a><a class="code" href="namespaceirr_1_1core.html#990c071a8518ad2b142744b300d0d63c">00301</a> <span class="keyword">typedef</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<s32></a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2di</a>; <a name="l00302"></a>00302 <a name="l00303"></a>00303 <span class="keyword">template</span><<span class="keyword">class</span> S, <span class="keyword">class</span> T> <a name="l00304"></a><a class="code" href="namespaceirr_1_1core.html#addb05facd36ea080bae3aaef0ec6afc">00304</a> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a> <a class="code" href="namespaceirr_1_1core.html#98c1475c8138a0493aa3db13c80a1252">operator*</a>(<span class="keyword">const</span> S scalar, <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& vector) { <span class="keywordflow">return</span> vector*scalar; } <a name="l00305"></a>00305 <a name="l00306"></a>00306 <span class="comment">// These methods are declared in dimension2d, but need definitions of vector2d</span> <a name="l00307"></a>00307 <span class="keyword">template</span><<span class="keyword">class</span> T> <a name="l00308"></a><a class="code" href="classirr_1_1core_1_1dimension2d.html#96f90d1d96392bf736a01f8def8aa7db">00308</a> <a class="code" href="classirr_1_1core_1_1dimension2d.html" title="Specifies a 2 dimensional size.">dimension2d<T>::dimension2d</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& other) : Width(other.X), Height(other.Y) { } <a name="l00309"></a>00309 <a name="l00310"></a>00310 <span class="keyword">template</span><<span class="keyword">class</span> T> <a name="l00311"></a><a class="code" href="classirr_1_1core_1_1dimension2d.html#34c99e1d9d11c1e20dde2ab6a3a0bfb9">00311</a> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1dimension2d.html" title="Specifies a 2 dimensional size.">dimension2d<T>::operator==</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1vector2d.html" title="2d vector template class with lots of operators and methods.">vector2d<T></a>& other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classirr_1_1core_1_1dimension2d.html#0399dcc023c19d381d1a192596107db4" title="Width of the dimension.">Width</a> == other.<a class="code" href="classirr_1_1core_1_1vector2d.html#8fabb0d10a3dd33b407b63bb3539be4d" title="X coordinate of vector.">X</a> && <a class="code" href="classirr_1_1core_1_1dimension2d.html#89b253523d31336c6b2a6a56dfd48a6b" title="Height of the dimension.">Height</a> == other.<a class="code" href="classirr_1_1core_1_1vector2d.html#a4d36f518d3fc35a7aafcea33a31f76c" title="Y coordinate of vector.">Y</a>; } <a name="l00312"></a>00312 <a name="l00313"></a>00313 } <span class="comment">// end namespace core</span> <a name="l00314"></a>00314 } <span class="comment">// end namespace irr</span> <a name="l00315"></a>00315 <a name="l00316"></a>00316 <span class="preprocessor">#endif</span> <a name="l00317"></a>00317 <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-2009 by Nikolaus Gebhardt. Generated on Sun Jan 10 09:24:05 2010 by <a href="http://www.doxygen.org" target="_blank">Doxygen</a> (1.5.6)</font></em></small></div></td> </tr> </table> <address style="align: right;"> </address> </body> </html>