Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92965586
Vector_8hpp_source.html
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Nov 25, 05:16
Size
45 KB
Mime Type
text/html
Expires
Wed, Nov 27, 05:16 (2 d)
Engine
blob
Format
Raw Data
Handle
22548999
Attached To
R8982 phpc_submit_nbody
Vector_8hpp_source.html
View Options
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.16"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>PHPC - nBody project: /media/lmunier/Data/EPFL/Master/2eme_annee/Semestre_2/Parallel_and_High_Performance_Computing/phpc_submit_nbody/src/Vector.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">PHPC - nBody project
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.16 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Vector.hpp</div> </div>
</div><!--header-->
<div class="contents">
<a href="Vector_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>  </div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="preprocessor">#ifndef PROJECT_VECTOR_HPP</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="preprocessor">#define PROJECT_VECTOR_HPP</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span>  </div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="preprocessor">#include "<a class="code" href="constants_8hpp.html">constants.hpp</a>"</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span>  </div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  <span class="keyword">using namespace </span><a class="code" href="namespacestd.html">std</a>;</div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  </div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="keyword">template</span><<span class="keyword">typename</span> Type></div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="classVector2.html"> 30</a></span> <span class="keyword">class </span><a class="code" href="classVector2.html">Vector2</a> {</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="keyword">public</span>:</div><div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1"> 35</a></span>  Type <a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a>;</div><div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="classVector2.html#a7a268ae24da74876262c3eb48887d982"> 36</a></span>  Type <a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a>;</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  </div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="classVector2.html#af1b03d760d86acd30816150da0ffc896"> 43</a></span>  <span class="keyword">explicit</span> <a class="code" href="classVector2.html#af1b03d760d86acd30816150da0ffc896">Vector2</a>(Type val = 0.0f) : x(val), y(val) {}</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  </div><div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="classVector2.html#a5941d07aab86b8f13f2e09c4bc83745a"> 51</a></span>  <a class="code" href="classVector2.html#a5941d07aab86b8f13f2e09c4bc83745a">Vector2</a>(Type x_val, Type y_val) :</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  x(x_val),</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  y(y_val) {}</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  </div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span> <span class="preprocessor">#ifdef PRINT</span></div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  </div><div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="classVector2.html#a90deadccae56e3ee80212ad2b2c1c607"> 59</a></span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classVector2.html#a90deadccae56e3ee80212ad2b2c1c607">print</a>() {</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  printf(<span class="stringliteral">"Vector2f : %f \t %f\n"</span>, this->x, this->y);</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  }</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  </div><div class="line"><a name="l00068"></a><span class="lineno"><a class="line" href="classVector2.html#a7977eff6704ce24663db7d873496717e"> 68</a></span>  <span class="keyword">virtual</span> <span class="keywordtype">string</span> <a class="code" href="classVector2.html#a7977eff6704ce24663db7d873496717e">to_file</a>() {</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  <span class="keywordtype">string</span> coord;</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  coord = to_string(this->x) + <span class="stringliteral">","</span> + to_string(this->y) + <span class="stringliteral">"\n"</span>;</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  </div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  <span class="keywordflow">return</span> coord;</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  }</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  </div><div class="line"><a name="l00081"></a><span class="lineno"><a class="line" href="classVector2.html#a3f3cbea608c5ff5d846db9f814ab7219"> 81</a></span>  <span class="keyword">virtual</span> Type <a class="code" href="classVector2.html#a3f3cbea608c5ff5d846db9f814ab7219">norm</a>() {</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="keywordflow">return</span> sqrtf(this->x*this->x + this->y*this->y);</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  }</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  </div><div class="line"><a name="l00085"></a><span class="lineno"><a class="line" href="classVector2.html#a970178743faf0cb0bdb5e9a3efad9d18"> 85</a></span>  <a class="code" href="classVector2.html">Vector2<Type></a> <a class="code" href="classVector2.html#a970178743faf0cb0bdb5e9a3efad9d18">pow</a>(Type power) {</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  <a class="code" href="classVector2.html">Vector2<Type></a> tmp = <a class="code" href="classVector2.html">Vector2<Type></a>();</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  </div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  tmp.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a> = powf(this->x, power);</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  tmp.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a> = powf(this->y, power);</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  </div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <span class="keywordflow">return</span> tmp;</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  }</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  </div><div class="line"><a name="l00100"></a><span class="lineno"><a class="line" href="classVector2.html#ab08cd52c0b1f7f4fa03b5ebaad3a1e15"> 100</a></span>  <a class="code" href="classVector2.html">Vector2<Type></a> operator- (<a class="code" href="classVector2.html">Vector2<Type></a> vec) {</div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  <a class="code" href="classVector2.html">Vector2<Type></a> tmp = <a class="code" href="classVector2.html">Vector2<Type></a>();</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  </div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  tmp.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a> = this->x - vec.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a>;</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  <span class="keywordflow">if</span> (abs(tmp.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a>) < <a class="code" href="constants_8hpp.html#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a>)</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  tmp.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a> = 0.0f;</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  </div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  tmp.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a> = this->y - vec.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a>;</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  <span class="keywordflow">if</span> (abs(tmp.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a>) < <a class="code" href="constants_8hpp.html#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a>)</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  tmp.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a> = 0.0f;</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  </div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <span class="keywordflow">return</span> tmp;</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  }</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  </div><div class="line"><a name="l00120"></a><span class="lineno"><a class="line" href="classVector2.html#ad7e3f65715c8b3679537912ec8316545"> 120</a></span>  <a class="code" href="classVector2.html">Vector2<Type></a> operator+ (<a class="code" href="classVector2.html">Vector2<Type></a> vec) {</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  <a class="code" href="classVector2.html">Vector2<Type></a> tmp = <a class="code" href="classVector2.html">Vector2<Type></a>();</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  </div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  tmp.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a> = this->x + vec.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a>;</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  tmp.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a> = this->y + vec.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a>;</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  </div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <span class="keywordflow">return</span> tmp;</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  }</div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  </div><div class="line"><a name="l00135"></a><span class="lineno"><a class="line" href="classVector2.html#a4dc0e05c139dbc50157470bf44d0672f"> 135</a></span>  <a class="code" href="classVector2.html">Vector2<Type></a> operator+ (Type scalar) {</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  <a class="code" href="classVector2.html">Vector2<Type></a> tmp = <a class="code" href="classVector2.html">Vector2<Type></a>();</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  </div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  tmp.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a> = this->x + scalar;</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  tmp.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a> = this->y + scalar;</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  </div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  <span class="keywordflow">return</span> tmp;</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  }</div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  </div><div class="line"><a name="l00150"></a><span class="lineno"><a class="line" href="classVector2.html#ad1f540401c9045b395843a63adeee697"> 150</a></span>  <a class="code" href="classVector2.html">Vector2<Type></a> operator* (Type scalar) {</div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  <a class="code" href="classVector2.html">Vector2<Type></a> tmp = <a class="code" href="classVector2.html">Vector2<Type></a>();</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  </div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  tmp.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a> = scalar * this->x;</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  tmp.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a> = scalar * this->y;</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  </div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  <span class="keywordflow">return</span> tmp;</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  }</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  </div><div class="line"><a name="l00165"></a><span class="lineno"><a class="line" href="classVector2.html#ac45a42b2af019f19d55281c0744d9d39"> 165</a></span>  <a class="code" href="classVector2.html">Vector2<Type></a> operator/ (Type scalar) {</div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  <a class="code" href="classVector2.html">Vector2<Type></a> tmp = <a class="code" href="classVector2.html">Vector2<Type></a>();</div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span>  </div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  tmp.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a> = this->x / scalar;</div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span>  tmp.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a> = this->y / scalar;</div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span>  </div><div class="line"><a name="l00171"></a><span class="lineno"> 171</span>  <span class="keywordflow">return</span> tmp;</div><div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  }</div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  </div><div class="line"><a name="l00180"></a><span class="lineno"><a class="line" href="classVector2.html#a50779344df37e5e57aa6e4d19524b1af"> 180</a></span>  <a class="code" href="classVector2.html">Vector2<Type></a> operator/ (<a class="code" href="classVector2.html">Vector2<Type></a> vec) {</div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span>  <a class="code" href="classVector2.html">Vector2<Type></a> tmp = <a class="code" href="classVector2.html">Vector2<Type></a>();</div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span>  </div><div class="line"><a name="l00183"></a><span class="lineno"> 183</span>  tmp.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a> = this->x / vec.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a>;</div><div class="line"><a name="l00184"></a><span class="lineno"> 184</span>  tmp.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a> = this->y / vec.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a>;</div><div class="line"><a name="l00185"></a><span class="lineno"> 185</span>  </div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span>  <span class="keywordflow">return</span> tmp;</div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span>  }</div><div class="line"><a name="l00188"></a><span class="lineno"> 188</span> };</div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span>  </div><div class="line"><a name="l00193"></a><span class="lineno"><a class="line" href="Vector_8hpp.html#a9f3739462b0605dcb64299fa289b6afe"> 193</a></span> <span class="keyword">typedef</span> <a class="code" href="classVector2.html">Vector2<float></a> <a class="code" href="Vector_8hpp.html#a9f3739462b0605dcb64299fa289b6afe">Vector2f</a>;</div><div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  </div><div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  </div><div class="line"><a name="l00202"></a><span class="lineno"> 202</span> <span class="keyword">template</span><<span class="keyword">typename</span> Type></div><div class="line"><a name="l00203"></a><span class="lineno"><a class="line" href="classVector3.html"> 203</a></span> <span class="keyword">class </span><a class="code" href="classVector3.html">Vector3</a> : <span class="keyword">public</span> <a class="code" href="classVector2.html">Vector2</a><Type> {</div><div class="line"><a name="l00204"></a><span class="lineno"> 204</span> <span class="keyword">public</span>:</div><div class="line"><a name="l00208"></a><span class="lineno"><a class="line" href="classVector3.html#afce2813445b5f03f013bba7e8dc96622"> 208</a></span>  Type <a class="code" href="classVector3.html#afce2813445b5f03f013bba7e8dc96622">z</a>;</div><div class="line"><a name="l00209"></a><span class="lineno"> 209</span>  </div><div class="line"><a name="l00215"></a><span class="lineno"><a class="line" href="classVector3.html#a8a742dbf2d58667e6851fae2767210c3"> 215</a></span>  <span class="keyword">explicit</span> <a class="code" href="classVector3.html#a8a742dbf2d58667e6851fae2767210c3">Vector3</a>(Type val = 0.0f) :</div><div class="line"><a name="l00216"></a><span class="lineno"> 216</span>  <a class="code" href="classVector2.html">Vector2f</a>(val, val),</div><div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  z(val) {}</div><div class="line"><a name="l00218"></a><span class="lineno"> 218</span>  </div><div class="line"><a name="l00226"></a><span class="lineno"><a class="line" href="classVector3.html#a1a7104ae58a55184def0fdee28b5d454"> 226</a></span>  <a class="code" href="classVector3.html#a1a7104ae58a55184def0fdee28b5d454">Vector3</a>(Type x_val, Type y_val, Type z_val) :</div><div class="line"><a name="l00227"></a><span class="lineno"> 227</span>  <a class="code" href="classVector2.html">Vector2f</a>(x_val, y_val),</div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  z(z_val) {}</div><div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  </div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span> <span class="preprocessor">#ifdef PRINT</span></div><div class="line"><a name="l00231"></a><span class="lineno"> 231</span>  </div><div class="line"><a name="l00234"></a><span class="lineno"><a class="line" href="classVector3.html#a62a092fbd267d2717604b6d310e4ddb1"> 234</a></span>  <span class="keywordtype">void</span> <a class="code" href="classVector3.html#a62a092fbd267d2717604b6d310e4ddb1">print</a>()<span class="keyword"> override </span>{</div><div class="line"><a name="l00235"></a><span class="lineno"> 235</span>  printf(<span class="stringliteral">"Vector3f : %f \t %f \t %f\n"</span>, this->x, this->y, this->z);</div><div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  }</div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  </div><div class="line"><a name="l00243"></a><span class="lineno"><a class="line" href="classVector3.html#a8ca89b12c2d8b93d9758c8f339168464"> 243</a></span>  <span class="keywordtype">string</span> <a class="code" href="classVector3.html#a8ca89b12c2d8b93d9758c8f339168464">to_file</a>()<span class="keyword"> override </span>{</div><div class="line"><a name="l00244"></a><span class="lineno"> 244</span>  <span class="keywordtype">string</span> coord;</div><div class="line"><a name="l00245"></a><span class="lineno"> 245</span>  coord = to_string(this->x) + <span class="stringliteral">","</span> + to_string(this->y) + <span class="stringliteral">","</span> + to_string(this->z) + <span class="stringliteral">"\n"</span>;</div><div class="line"><a name="l00246"></a><span class="lineno"> 246</span>  </div><div class="line"><a name="l00247"></a><span class="lineno"> 247</span>  <span class="keywordflow">return</span> coord;</div><div class="line"><a name="l00248"></a><span class="lineno"> 248</span>  }</div><div class="line"><a name="l00249"></a><span class="lineno"> 249</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00250"></a><span class="lineno"> 250</span>  </div><div class="line"><a name="l00255"></a><span class="lineno"><a class="line" href="classVector3.html#a7cc1dd16f85a1b6381082b4b64d9672f"> 255</a></span>  Type <a class="code" href="classVector3.html#a7cc1dd16f85a1b6381082b4b64d9672f">norm</a>()<span class="keyword"> override </span>{</div><div class="line"><a name="l00256"></a><span class="lineno"> 256</span>  <span class="keywordflow">return</span> sqrtf(this->x*this->x + this->y*this->y + this->z*this->z);</div><div class="line"><a name="l00257"></a><span class="lineno"> 257</span>  }</div><div class="line"><a name="l00258"></a><span class="lineno"> 258</span>  </div><div class="line"><a name="l00259"></a><span class="lineno"><a class="line" href="classVector3.html#ab898be9de3aeebf6a0483cdc031269d8"> 259</a></span>  <a class="code" href="classVector3.html">Vector3<Type></a> <a class="code" href="classVector3.html#ab898be9de3aeebf6a0483cdc031269d8">pow</a>(Type power) {</div><div class="line"><a name="l00260"></a><span class="lineno"> 260</span>  <a class="code" href="classVector3.html">Vector3<Type></a> tmp = <a class="code" href="classVector3.html">Vector3<Type></a>();</div><div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  </div><div class="line"><a name="l00262"></a><span class="lineno"> 262</span>  tmp.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a> = powf(this->x, power);</div><div class="line"><a name="l00263"></a><span class="lineno"> 263</span>  tmp.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a> = powf(this->y, power);</div><div class="line"><a name="l00264"></a><span class="lineno"> 264</span>  tmp.<a class="code" href="classVector3.html#afce2813445b5f03f013bba7e8dc96622">z</a> = powf(this->z, power);</div><div class="line"><a name="l00265"></a><span class="lineno"> 265</span>  </div><div class="line"><a name="l00266"></a><span class="lineno"> 266</span>  <span class="keywordflow">return</span> tmp;</div><div class="line"><a name="l00267"></a><span class="lineno"> 267</span>  }</div><div class="line"><a name="l00268"></a><span class="lineno"> 268</span>  </div><div class="line"><a name="l00275"></a><span class="lineno"><a class="line" href="classVector3.html#a910b1b4c5e627d2e2cc4ada0de06ef1d"> 275</a></span>  <a class="code" href="classVector3.html">Vector3<Type></a> operator- (<a class="code" href="classVector3.html">Vector3<Type></a> vec) {</div><div class="line"><a name="l00276"></a><span class="lineno"> 276</span>  <a class="code" href="classVector3.html">Vector3<Type></a> tmp = <a class="code" href="classVector3.html">Vector3<Type></a>();</div><div class="line"><a name="l00277"></a><span class="lineno"> 277</span>  </div><div class="line"><a name="l00278"></a><span class="lineno"> 278</span>  tmp.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a> = this->x - vec.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a>;</div><div class="line"><a name="l00279"></a><span class="lineno"> 279</span>  <span class="keywordflow">if</span> (abs(tmp.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a>) < <a class="code" href="constants_8hpp.html#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a>)</div><div class="line"><a name="l00280"></a><span class="lineno"> 280</span>  tmp.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a> = 0.0f;</div><div class="line"><a name="l00281"></a><span class="lineno"> 281</span>  </div><div class="line"><a name="l00282"></a><span class="lineno"> 282</span>  tmp.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a> = this->y - vec.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a>;</div><div class="line"><a name="l00283"></a><span class="lineno"> 283</span>  <span class="keywordflow">if</span> (abs(tmp.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a>) < <a class="code" href="constants_8hpp.html#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a>)</div><div class="line"><a name="l00284"></a><span class="lineno"> 284</span>  tmp.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a> = 0.0f;</div><div class="line"><a name="l00285"></a><span class="lineno"> 285</span>  </div><div class="line"><a name="l00286"></a><span class="lineno"> 286</span>  tmp.<a class="code" href="classVector3.html#afce2813445b5f03f013bba7e8dc96622">z</a> = this->z - vec.<a class="code" href="classVector3.html#afce2813445b5f03f013bba7e8dc96622">z</a>;</div><div class="line"><a name="l00287"></a><span class="lineno"> 287</span>  <span class="keywordflow">if</span> (abs(tmp.<a class="code" href="classVector3.html#afce2813445b5f03f013bba7e8dc96622">z</a>) < <a class="code" href="constants_8hpp.html#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a>)</div><div class="line"><a name="l00288"></a><span class="lineno"> 288</span>  tmp.<a class="code" href="classVector3.html#afce2813445b5f03f013bba7e8dc96622">z</a> = 0.0f;</div><div class="line"><a name="l00289"></a><span class="lineno"> 289</span>  </div><div class="line"><a name="l00290"></a><span class="lineno"> 290</span>  <span class="keywordflow">return</span> tmp;</div><div class="line"><a name="l00291"></a><span class="lineno"> 291</span>  }</div><div class="line"><a name="l00292"></a><span class="lineno"> 292</span>  </div><div class="line"><a name="l00299"></a><span class="lineno"><a class="line" href="classVector3.html#a1b18a9d2c95af3f96f2b6e9a8649c7d4"> 299</a></span>  <a class="code" href="classVector3.html">Vector3<Type></a> operator+ (<a class="code" href="classVector3.html">Vector3<Type></a> vec) {</div><div class="line"><a name="l00300"></a><span class="lineno"> 300</span>  <a class="code" href="classVector3.html">Vector3<Type></a> tmp = <a class="code" href="classVector3.html">Vector3<Type></a>();</div><div class="line"><a name="l00301"></a><span class="lineno"> 301</span>  </div><div class="line"><a name="l00302"></a><span class="lineno"> 302</span>  tmp.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a> = this->x + vec.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a>;</div><div class="line"><a name="l00303"></a><span class="lineno"> 303</span>  tmp.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a> = this->y + vec.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a>;</div><div class="line"><a name="l00304"></a><span class="lineno"> 304</span>  tmp.<a class="code" href="classVector3.html#afce2813445b5f03f013bba7e8dc96622">z</a> = this->z + vec.<a class="code" href="classVector3.html#afce2813445b5f03f013bba7e8dc96622">z</a>;</div><div class="line"><a name="l00305"></a><span class="lineno"> 305</span>  </div><div class="line"><a name="l00306"></a><span class="lineno"> 306</span>  <span class="keywordflow">return</span> tmp;</div><div class="line"><a name="l00307"></a><span class="lineno"> 307</span>  }</div><div class="line"><a name="l00308"></a><span class="lineno"> 308</span>  </div><div class="line"><a name="l00315"></a><span class="lineno"><a class="line" href="classVector3.html#a467342d455d3768a443068eab10cdb2b"> 315</a></span>  <a class="code" href="classVector3.html">Vector3<Type></a> operator+ (Type scalar) {</div><div class="line"><a name="l00316"></a><span class="lineno"> 316</span>  <a class="code" href="classVector3.html">Vector3<Type></a> tmp = <a class="code" href="classVector3.html">Vector3<Type></a>();</div><div class="line"><a name="l00317"></a><span class="lineno"> 317</span>  </div><div class="line"><a name="l00318"></a><span class="lineno"> 318</span>  tmp.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a> = this->x + scalar;</div><div class="line"><a name="l00319"></a><span class="lineno"> 319</span>  tmp.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a> = this->y + scalar;</div><div class="line"><a name="l00320"></a><span class="lineno"> 320</span>  tmp.<a class="code" href="classVector3.html#afce2813445b5f03f013bba7e8dc96622">z</a> = this->z + scalar;</div><div class="line"><a name="l00321"></a><span class="lineno"> 321</span>  </div><div class="line"><a name="l00322"></a><span class="lineno"> 322</span>  <span class="keywordflow">return</span> tmp;</div><div class="line"><a name="l00323"></a><span class="lineno"> 323</span>  }</div><div class="line"><a name="l00324"></a><span class="lineno"> 324</span>  </div><div class="line"><a name="l00331"></a><span class="lineno"><a class="line" href="classVector3.html#a4e821480dfbb1763d5e7d4d6ca1cb587"> 331</a></span>  <a class="code" href="classVector3.html">Vector3<Type></a> operator* (Type scalar) {</div><div class="line"><a name="l00332"></a><span class="lineno"> 332</span>  <a class="code" href="classVector3.html">Vector3<Type></a> tmp = <a class="code" href="classVector3.html">Vector3<Type></a>();</div><div class="line"><a name="l00333"></a><span class="lineno"> 333</span>  </div><div class="line"><a name="l00334"></a><span class="lineno"> 334</span>  tmp.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a> = scalar * this->x;</div><div class="line"><a name="l00335"></a><span class="lineno"> 335</span>  tmp.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a> = scalar * this->y;</div><div class="line"><a name="l00336"></a><span class="lineno"> 336</span>  tmp.<a class="code" href="classVector3.html#afce2813445b5f03f013bba7e8dc96622">z</a> = scalar * this->z;</div><div class="line"><a name="l00337"></a><span class="lineno"> 337</span>  </div><div class="line"><a name="l00338"></a><span class="lineno"> 338</span>  <span class="keywordflow">return</span> tmp;</div><div class="line"><a name="l00339"></a><span class="lineno"> 339</span>  }</div><div class="line"><a name="l00340"></a><span class="lineno"> 340</span>  </div><div class="line"><a name="l00347"></a><span class="lineno"><a class="line" href="classVector3.html#a211e07a10b4e3c78a1f175e4a5cb1679"> 347</a></span>  <a class="code" href="classVector3.html">Vector3<Type></a> operator/ (Type scalar) {</div><div class="line"><a name="l00348"></a><span class="lineno"> 348</span>  <a class="code" href="classVector3.html">Vector3<Type></a> tmp = <a class="code" href="classVector3.html">Vector3<Type></a>();</div><div class="line"><a name="l00349"></a><span class="lineno"> 349</span>  </div><div class="line"><a name="l00350"></a><span class="lineno"> 350</span>  tmp.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a> = this->x / scalar;</div><div class="line"><a name="l00351"></a><span class="lineno"> 351</span>  tmp.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a> = this->y / scalar;</div><div class="line"><a name="l00352"></a><span class="lineno"> 352</span>  tmp.<a class="code" href="classVector3.html#afce2813445b5f03f013bba7e8dc96622">z</a> = this->z / scalar;</div><div class="line"><a name="l00353"></a><span class="lineno"> 353</span>  </div><div class="line"><a name="l00354"></a><span class="lineno"> 354</span>  <span class="keywordflow">return</span> tmp;</div><div class="line"><a name="l00355"></a><span class="lineno"> 355</span>  }</div><div class="line"><a name="l00356"></a><span class="lineno"> 356</span>  </div><div class="line"><a name="l00363"></a><span class="lineno"><a class="line" href="classVector3.html#a51c91b0c588e113384e5d765b5ff704b"> 363</a></span>  <a class="code" href="classVector3.html">Vector3<Type></a> operator/ (<a class="code" href="classVector3.html">Vector3<Type></a> vec) {</div><div class="line"><a name="l00364"></a><span class="lineno"> 364</span>  <a class="code" href="classVector3.html">Vector3<Type></a> tmp = <a class="code" href="classVector3.html">Vector3<Type></a>();</div><div class="line"><a name="l00365"></a><span class="lineno"> 365</span>  </div><div class="line"><a name="l00366"></a><span class="lineno"> 366</span>  tmp.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a> = this->x / vec.<a class="code" href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">x</a>;</div><div class="line"><a name="l00367"></a><span class="lineno"> 367</span>  tmp.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a> = this->y / vec.<a class="code" href="classVector2.html#a7a268ae24da74876262c3eb48887d982">y</a>;</div><div class="line"><a name="l00368"></a><span class="lineno"> 368</span>  tmp.<a class="code" href="classVector3.html#afce2813445b5f03f013bba7e8dc96622">z</a> = this->z / vec.<a class="code" href="classVector3.html#afce2813445b5f03f013bba7e8dc96622">z</a>;</div><div class="line"><a name="l00369"></a><span class="lineno"> 369</span>  </div><div class="line"><a name="l00370"></a><span class="lineno"> 370</span>  <span class="keywordflow">return</span> tmp;</div><div class="line"><a name="l00371"></a><span class="lineno"> 371</span>  }</div><div class="line"><a name="l00372"></a><span class="lineno"> 372</span> };</div><div class="line"><a name="l00373"></a><span class="lineno"> 373</span>  </div><div class="line"><a name="l00377"></a><span class="lineno"><a class="line" href="Vector_8hpp.html#af345ad77ba5e240c7ab72b4b2077e754"> 377</a></span> <span class="keyword">typedef</span> <a class="code" href="classVector3.html">Vector3<float></a> <a class="code" href="Vector_8hpp.html#af345ad77ba5e240c7ab72b4b2077e754">Vector3f</a>;</div><div class="line"><a name="l00378"></a><span class="lineno"> 378</span>  </div><div class="line"><a name="l00379"></a><span class="lineno"> 379</span> <span class="preprocessor">#endif //PROJECT_VECTOR_HPP</span></div></div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclassVector3_html_a8a742dbf2d58667e6851fae2767210c3"><div class="ttname"><a href="classVector3.html#a8a742dbf2d58667e6851fae2767210c3">Vector3::Vector3</a></div><div class="ttdeci">Vector3(Type val=0.0f)</div><div class="ttdef"><b>Definition:</b> Vector.hpp:215</div></div>
<div class="ttc" id="aclassVector2_html_a970178743faf0cb0bdb5e9a3efad9d18"><div class="ttname"><a href="classVector2.html#a970178743faf0cb0bdb5e9a3efad9d18">Vector2::pow</a></div><div class="ttdeci">Vector2< Type > pow(Type power)</div><div class="ttdef"><b>Definition:</b> Vector.hpp:85</div></div>
<div class="ttc" id="aclassVector3_html_afce2813445b5f03f013bba7e8dc96622"><div class="ttname"><a href="classVector3.html#afce2813445b5f03f013bba7e8dc96622">Vector3::z</a></div><div class="ttdeci">Type z</div><div class="ttdef"><b>Definition:</b> Vector.hpp:208</div></div>
<div class="ttc" id="aclassVector2_html_a7977eff6704ce24663db7d873496717e"><div class="ttname"><a href="classVector2.html#a7977eff6704ce24663db7d873496717e">Vector2::to_file</a></div><div class="ttdeci">virtual string to_file()</div><div class="ttdef"><b>Definition:</b> Vector.hpp:68</div></div>
<div class="ttc" id="aclassVector2_html_a90deadccae56e3ee80212ad2b2c1c607"><div class="ttname"><a href="classVector2.html#a90deadccae56e3ee80212ad2b2c1c607">Vector2::print</a></div><div class="ttdeci">virtual void print()</div><div class="ttdef"><b>Definition:</b> Vector.hpp:59</div></div>
<div class="ttc" id="aclassVector2_html_a7a268ae24da74876262c3eb48887d982"><div class="ttname"><a href="classVector2.html#a7a268ae24da74876262c3eb48887d982">Vector2::y</a></div><div class="ttdeci">Type y</div><div class="ttdef"><b>Definition:</b> Vector.hpp:36</div></div>
<div class="ttc" id="aVector_8hpp_html_a9f3739462b0605dcb64299fa289b6afe"><div class="ttname"><a href="Vector_8hpp.html#a9f3739462b0605dcb64299fa289b6afe">Vector2f</a></div><div class="ttdeci">Vector2< float > Vector2f</div><div class="ttdef"><b>Definition:</b> Vector.hpp:193</div></div>
<div class="ttc" id="aclassVector3_html_a7cc1dd16f85a1b6381082b4b64d9672f"><div class="ttname"><a href="classVector3.html#a7cc1dd16f85a1b6381082b4b64d9672f">Vector3::norm</a></div><div class="ttdeci">Type norm() override</div><div class="ttdef"><b>Definition:</b> Vector.hpp:255</div></div>
<div class="ttc" id="aclassVector3_html"><div class="ttname"><a href="classVector3.html">Vector3</a></div><div class="ttdef"><b>Definition:</b> Vector.hpp:203</div></div>
<div class="ttc" id="aclassVector3_html_a8ca89b12c2d8b93d9758c8f339168464"><div class="ttname"><a href="classVector3.html#a8ca89b12c2d8b93d9758c8f339168464">Vector3::to_file</a></div><div class="ttdeci">string to_file() override</div><div class="ttdef"><b>Definition:</b> Vector.hpp:243</div></div>
<div class="ttc" id="aclassVector2_html"><div class="ttname"><a href="classVector2.html">Vector2</a></div><div class="ttdef"><b>Definition:</b> Vector.hpp:30</div></div>
<div class="ttc" id="aVector_8hpp_html_af345ad77ba5e240c7ab72b4b2077e754"><div class="ttname"><a href="Vector_8hpp.html#af345ad77ba5e240c7ab72b4b2077e754">Vector3f</a></div><div class="ttdeci">Vector3< float > Vector3f</div><div class="ttdef"><b>Definition:</b> Vector.hpp:377</div></div>
<div class="ttc" id="aconstants_8hpp_html"><div class="ttname"><a href="constants_8hpp.html">constants.hpp</a></div></div>
<div class="ttc" id="aclassVector3_html_a1a7104ae58a55184def0fdee28b5d454"><div class="ttname"><a href="classVector3.html#a1a7104ae58a55184def0fdee28b5d454">Vector3::Vector3</a></div><div class="ttdeci">Vector3(Type x_val, Type y_val, Type z_val)</div><div class="ttdef"><b>Definition:</b> Vector.hpp:226</div></div>
<div class="ttc" id="aclassVector2_html_a5941d07aab86b8f13f2e09c4bc83745a"><div class="ttname"><a href="classVector2.html#a5941d07aab86b8f13f2e09c4bc83745a">Vector2::Vector2</a></div><div class="ttdeci">Vector2(Type x_val, Type y_val)</div><div class="ttdef"><b>Definition:</b> Vector.hpp:51</div></div>
<div class="ttc" id="aclassVector3_html_a62a092fbd267d2717604b6d310e4ddb1"><div class="ttname"><a href="classVector3.html#a62a092fbd267d2717604b6d310e4ddb1">Vector3::print</a></div><div class="ttdeci">void print() override</div><div class="ttdef"><b>Definition:</b> Vector.hpp:234</div></div>
<div class="ttc" id="aconstants_8hpp_html_a002b2f4894492820fe708b1b7e7c5e70"><div class="ttname"><a href="constants_8hpp.html#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a></div><div class="ttdeci">#define EPSILON</div><div class="ttdef"><b>Definition:</b> constants.hpp:32</div></div>
<div class="ttc" id="anamespacestd_html"><div class="ttname"><a href="namespacestd.html">std</a></div></div>
<div class="ttc" id="aclassVector3_html_ab898be9de3aeebf6a0483cdc031269d8"><div class="ttname"><a href="classVector3.html#ab898be9de3aeebf6a0483cdc031269d8">Vector3::pow</a></div><div class="ttdeci">Vector3< Type > pow(Type power)</div><div class="ttdef"><b>Definition:</b> Vector.hpp:259</div></div>
<div class="ttc" id="aclassVector2_html_a719fb98acee6f3034e1a90310230bdb1"><div class="ttname"><a href="classVector2.html#a719fb98acee6f3034e1a90310230bdb1">Vector2::x</a></div><div class="ttdeci">Type x</div><div class="ttdef"><b>Definition:</b> Vector.hpp:35</div></div>
<div class="ttc" id="aclassVector2_html_af1b03d760d86acd30816150da0ffc896"><div class="ttname"><a href="classVector2.html#af1b03d760d86acd30816150da0ffc896">Vector2::Vector2</a></div><div class="ttdeci">Vector2(Type val=0.0f)</div><div class="ttdef"><b>Definition:</b> Vector.hpp:43</div></div>
<div class="ttc" id="aclassVector2_html_a3f3cbea608c5ff5d846db9f814ab7219"><div class="ttname"><a href="classVector2.html#a3f3cbea608c5ff5d846db9f814ab7219">Vector2::norm</a></div><div class="ttdeci">virtual Type norm()</div><div class="ttdef"><b>Definition:</b> Vector.hpp:81</div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.16
</small></address>
</body>
</html>
Event Timeline
Log In to Comment