TheAlgorithms-C/d5/db8/vectors__3d_8c.html
2021-12-09 17:57:52 +00:00

266 lines
24 KiB
HTML

<!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=11"/>
<meta name="generator" content="Doxygen 1.9.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Algorithms_in_C: geometry/vectors_3d.c File Reference</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="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtreedata.js"></script>
<script type="text/javascript" src="../../navtree.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>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.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">Algorithms_in_C<span id="projectnumber">&#160;1.0.0</span>
</div>
<div id="projectbrief">Set of algorithms implemented in C.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
/* @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:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('d5/db8/vectors__3d_8c.html','../../'); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- 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 class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle"><div class="title">vectors_3d.c File Reference</div></div>
</div><!--header-->
<div class="contents">
<p>Functions related to 3D vector operations.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;stdio.h&gt;</code><br />
<code>#include &lt;math.h&gt;</code><br />
<code>#include &lt;assert.h&gt;</code><br />
<code>#include &quot;<a class="el" href="../../d0/dc7/geometry__datatypes_8h_source.html">geometry_datatypes.h</a>&quot;</code><br />
</div><div class="textblock"><div class="dynheader">
Include dependency graph for vectors_3d.c:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d7/daf/vectors__3d_8c__incl.svg" width="430" height="112"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga97da356cb7d5da73a0ac9bad09a435cc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../de/d7b/group__vec__3d.html#gaf9ee870d4922e488bdd3e7262485c270">vec_3d</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../de/d7b/group__vec__3d.html#ga97da356cb7d5da73a0ac9bad09a435cc">vector_sub</a> (const <a class="el" href="../../de/d7b/group__vec__3d.html#gaf9ee870d4922e488bdd3e7262485c270">vec_3d</a> *a, const <a class="el" href="../../de/d7b/group__vec__3d.html#gaf9ee870d4922e488bdd3e7262485c270">vec_3d</a> *b)</td></tr>
<tr class="memdesc:ga97da356cb7d5da73a0ac9bad09a435cc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Subtract one vector from another. <a href="../../de/d7b/group__vec__3d.html#ga97da356cb7d5da73a0ac9bad09a435cc">More...</a><br /></td></tr>
<tr class="separator:ga97da356cb7d5da73a0ac9bad09a435cc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa6b5ac18429ffb0131dc8593d31c25a4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../de/d7b/group__vec__3d.html#gaf9ee870d4922e488bdd3e7262485c270">vec_3d</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../de/d7b/group__vec__3d.html#gaa6b5ac18429ffb0131dc8593d31c25a4">vector_add</a> (const <a class="el" href="../../de/d7b/group__vec__3d.html#gaf9ee870d4922e488bdd3e7262485c270">vec_3d</a> *a, const <a class="el" href="../../de/d7b/group__vec__3d.html#gaf9ee870d4922e488bdd3e7262485c270">vec_3d</a> *b)</td></tr>
<tr class="memdesc:gaa6b5ac18429ffb0131dc8593d31c25a4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add one vector to another. <a href="../../de/d7b/group__vec__3d.html#gaa6b5ac18429ffb0131dc8593d31c25a4">More...</a><br /></td></tr>
<tr class="separator:gaa6b5ac18429ffb0131dc8593d31c25a4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga243e74d542d0d4d14fa3ae0bc2170d84"><td class="memItemLeft" align="right" valign="top">float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../de/d7b/group__vec__3d.html#ga243e74d542d0d4d14fa3ae0bc2170d84">dot_prod</a> (const <a class="el" href="../../de/d7b/group__vec__3d.html#gaf9ee870d4922e488bdd3e7262485c270">vec_3d</a> *a, const <a class="el" href="../../de/d7b/group__vec__3d.html#gaf9ee870d4922e488bdd3e7262485c270">vec_3d</a> *b)</td></tr>
<tr class="memdesc:ga243e74d542d0d4d14fa3ae0bc2170d84"><td class="mdescLeft">&#160;</td><td class="mdescRight">Obtain the dot product of two 3D vectors. <a href="../../de/d7b/group__vec__3d.html#ga243e74d542d0d4d14fa3ae0bc2170d84">More...</a><br /></td></tr>
<tr class="separator:ga243e74d542d0d4d14fa3ae0bc2170d84"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae4a49e6bdf13df949e8b23c7925bb5f5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../de/d7b/group__vec__3d.html#gaf9ee870d4922e488bdd3e7262485c270">vec_3d</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../de/d7b/group__vec__3d.html#gae4a49e6bdf13df949e8b23c7925bb5f5">vector_prod</a> (const <a class="el" href="../../de/d7b/group__vec__3d.html#gaf9ee870d4922e488bdd3e7262485c270">vec_3d</a> *a, const <a class="el" href="../../de/d7b/group__vec__3d.html#gaf9ee870d4922e488bdd3e7262485c270">vec_3d</a> *b)</td></tr>
<tr class="memdesc:gae4a49e6bdf13df949e8b23c7925bb5f5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute the vector product of two 3d vectors. <a href="../../de/d7b/group__vec__3d.html#gae4a49e6bdf13df949e8b23c7925bb5f5">More...</a><br /></td></tr>
<tr class="separator:gae4a49e6bdf13df949e8b23c7925bb5f5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae25e1f2e973933bef65838601e2de0af"><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../de/d7b/group__vec__3d.html#gae25e1f2e973933bef65838601e2de0af">print_vector</a> (const <a class="el" href="../../de/d7b/group__vec__3d.html#gaf9ee870d4922e488bdd3e7262485c270">vec_3d</a> *a, const char *name)</td></tr>
<tr class="memdesc:gae25e1f2e973933bef65838601e2de0af"><td class="mdescLeft">&#160;</td><td class="mdescRight">Print formatted vector on stdout. <a href="../../de/d7b/group__vec__3d.html#gae25e1f2e973933bef65838601e2de0af">More...</a><br /></td></tr>
<tr class="separator:gae25e1f2e973933bef65838601e2de0af"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga94805165d037d111d7d7c0df99e3a5de"><td class="memItemLeft" align="right" valign="top">float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../de/d7b/group__vec__3d.html#ga94805165d037d111d7d7c0df99e3a5de">vector_norm</a> (const <a class="el" href="../../de/d7b/group__vec__3d.html#gaf9ee870d4922e488bdd3e7262485c270">vec_3d</a> *a)</td></tr>
<tr class="memdesc:ga94805165d037d111d7d7c0df99e3a5de"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute the norm a vector. <a href="../../de/d7b/group__vec__3d.html#ga94805165d037d111d7d7c0df99e3a5de">More...</a><br /></td></tr>
<tr class="separator:ga94805165d037d111d7d7c0df99e3a5de"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3cdfd8378a0b115563ea6c561bb46b7e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../de/d7b/group__vec__3d.html#gaf9ee870d4922e488bdd3e7262485c270">vec_3d</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../de/d7b/group__vec__3d.html#ga3cdfd8378a0b115563ea6c561bb46b7e">unit_vec</a> (const <a class="el" href="../../de/d7b/group__vec__3d.html#gaf9ee870d4922e488bdd3e7262485c270">vec_3d</a> *a)</td></tr>
<tr class="memdesc:ga3cdfd8378a0b115563ea6c561bb46b7e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Obtain unit vector in the same direction as given vector. <a href="../../de/d7b/group__vec__3d.html#ga3cdfd8378a0b115563ea6c561bb46b7e">More...</a><br /></td></tr>
<tr class="separator:ga3cdfd8378a0b115563ea6c561bb46b7e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5082b0720c2cc51ae84bf19bd76dc849"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../dd/d7a/group__matrix.html#ga9f844010cb96591fa94c9d533a500ab7">mat_3x3</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../de/d7b/group__vec__3d.html#ga5082b0720c2cc51ae84bf19bd76dc849">get_cross_matrix</a> (const <a class="el" href="../../de/d7b/group__vec__3d.html#gaf9ee870d4922e488bdd3e7262485c270">vec_3d</a> *a)</td></tr>
<tr class="memdesc:ga5082b0720c2cc51ae84bf19bd76dc849"><td class="mdescLeft">&#160;</td><td class="mdescRight">The cross product of vectors can be represented as a matrix multiplication operation. <a href="../../de/d7b/group__vec__3d.html#ga5082b0720c2cc51ae84bf19bd76dc849">More...</a><br /></td></tr>
<tr class="separator:ga5082b0720c2cc51ae84bf19bd76dc849"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga55be1d766c8a824b35d97e79744834d8"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../de/d7b/group__vec__3d.html#ga55be1d766c8a824b35d97e79744834d8">get_angle</a> (const <a class="el" href="../../de/d7b/group__vec__3d.html#gaf9ee870d4922e488bdd3e7262485c270">vec_3d</a> *a, const <a class="el" href="../../de/d7b/group__vec__3d.html#gaf9ee870d4922e488bdd3e7262485c270">vec_3d</a> *b)</td></tr>
<tr class="memdesc:ga55be1d766c8a824b35d97e79744834d8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Obtain the angle between two given vectors. <a href="../../de/d7b/group__vec__3d.html#ga55be1d766c8a824b35d97e79744834d8">More...</a><br /></td></tr>
<tr class="separator:ga55be1d766c8a824b35d97e79744834d8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa8dca7b867074164d5f45b0f3851269d"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/db8/vectors__3d_8c.html#aa8dca7b867074164d5f45b0f3851269d">test</a> ()</td></tr>
<tr class="memdesc:aa8dca7b867074164d5f45b0f3851269d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Testing function. <a href="../../d5/db8/vectors__3d_8c.html#aa8dca7b867074164d5f45b0f3851269d">More...</a><br /></td></tr>
<tr class="separator:aa8dca7b867074164d5f45b0f3851269d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/db8/vectors__3d_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr class="memdesc:a840291bc02cba5474a4cb46a9b9566fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function. <a href="../../d5/db8/vectors__3d_8c.html#a840291bc02cba5474a4cb46a9b9566fe">More...</a><br /></td></tr>
<tr class="separator:a840291bc02cba5474a4cb46a9b9566fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p >Functions related to 3D vector operations. </p>
<dl class="section author"><dt>Author</dt><dd>Krishna Vedala </dd></dl>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a840291bc02cba5474a4cb46a9b9566fe" name="a840291bc02cba5474a4cb46a9b9566fe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a840291bc02cba5474a4cb46a9b9566fe">&#9670;&nbsp;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int main </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Main function. </p>
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
<div class="fragment"><div class="line"><a id="l00261" name="l00261"></a><span class="lineno"> 261</span>{</div>
<div class="line"><a id="l00262" name="l00262"></a><span class="lineno"> 262</span> <a class="code hl_function" href="../../d5/db8/vectors__3d_8c.html#aa8dca7b867074164d5f45b0f3851269d">test</a>();</div>
<div class="line"><a id="l00263" name="l00263"></a><span class="lineno"> 263</span> </div>
<div class="line"><a id="l00264" name="l00264"></a><span class="lineno"> 264</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00265" name="l00265"></a><span class="lineno"> 265</span>}</div>
<div class="ttc" id="avectors__3d_8c_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="../../d5/db8/vectors__3d_8c.html#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Testing function.</div><div class="ttdef"><b>Definition:</b> vectors_3d.c:223</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d5/db8/vectors__3d_8c_a840291bc02cba5474a4cb46a9b9566fe_cgraph.svg" width="555" height="167"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
<a id="aa8dca7b867074164d5f45b0f3851269d" name="aa8dca7b867074164d5f45b0f3851269d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa8dca7b867074164d5f45b0f3851269d">&#9670;&nbsp;</a></span>test()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static void test </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Testing function. </p>
<dl class="section return"><dt>Returns</dt><dd><code>void</code> </dd></dl>
<div class="fragment"><div class="line"><a id="l00224" name="l00224"></a><span class="lineno"> 224</span>{</div>
<div class="line"><a id="l00225" name="l00225"></a><span class="lineno"> 225</span> <a class="code hl_struct" href="../../d5/db4/structvec__3d__.html">vec_3d</a> a = {1., 2., 3.};</div>
<div class="line"><a id="l00226" name="l00226"></a><span class="lineno"> 226</span> <a class="code hl_struct" href="../../d5/db4/structvec__3d__.html">vec_3d</a> b = {1., 1., 1.};</div>
<div class="line"><a id="l00227" name="l00227"></a><span class="lineno"> 227</span> <span class="keywordtype">float</span> d;</div>
<div class="line"><a id="l00228" name="l00228"></a><span class="lineno"> 228</span> </div>
<div class="line"><a id="l00229" name="l00229"></a><span class="lineno"> 229</span> <span class="comment">// printf(&quot;%s&quot;, print_vector(&amp;a, &quot;a&quot;));</span></div>
<div class="line"><a id="l00230" name="l00230"></a><span class="lineno"> 230</span> <span class="comment">// printf(&quot;%s&quot;, print_vector(&amp;b, &quot;b&quot;));</span></div>
<div class="line"><a id="l00231" name="l00231"></a><span class="lineno"> 231</span> </div>
<div class="line"><a id="l00232" name="l00232"></a><span class="lineno"> 232</span> d = <a class="code hl_function" href="../../de/d7b/group__vec__3d.html#ga94805165d037d111d7d7c0df99e3a5de">vector_norm</a>(&amp;a);</div>
<div class="line"><a id="l00233" name="l00233"></a><span class="lineno"> 233</span> <span class="comment">// printf(&quot;|a| = %.4g\n&quot;, d);</span></div>
<div class="line"><a id="l00234" name="l00234"></a><span class="lineno"> 234</span> assert(fabsf(d - 3.742f) &lt; 0.01);</div>
<div class="line"><a id="l00235" name="l00235"></a><span class="lineno"> 235</span> d = <a class="code hl_function" href="../../de/d7b/group__vec__3d.html#ga94805165d037d111d7d7c0df99e3a5de">vector_norm</a>(&amp;b);</div>
<div class="line"><a id="l00236" name="l00236"></a><span class="lineno"> 236</span> <span class="comment">// printf(&quot;|b| = %.4g\n&quot;, d);</span></div>
<div class="line"><a id="l00237" name="l00237"></a><span class="lineno"> 237</span> assert(fabsf(d - 1.732f) &lt; 0.01);</div>
<div class="line"><a id="l00238" name="l00238"></a><span class="lineno"> 238</span> </div>
<div class="line"><a id="l00239" name="l00239"></a><span class="lineno"> 239</span> d = <a class="code hl_function" href="../../de/d7b/group__vec__3d.html#ga243e74d542d0d4d14fa3ae0bc2170d84">dot_prod</a>(&amp;a, &amp;b);</div>
<div class="line"><a id="l00240" name="l00240"></a><span class="lineno"> 240</span> <span class="comment">// printf(&quot;Dot product: %f\n&quot;, d);</span></div>
<div class="line"><a id="l00241" name="l00241"></a><span class="lineno"> 241</span> assert(fabsf(d - 6.f) &lt; 0.01);</div>
<div class="line"><a id="l00242" name="l00242"></a><span class="lineno"> 242</span> </div>
<div class="line"><a id="l00243" name="l00243"></a><span class="lineno"> 243</span> <a class="code hl_struct" href="../../d5/db4/structvec__3d__.html">vec_3d</a> c = <a class="code hl_function" href="../../de/d7b/group__vec__3d.html#gae4a49e6bdf13df949e8b23c7925bb5f5">vector_prod</a>(&amp;a, &amp;b);</div>
<div class="line"><a id="l00244" name="l00244"></a><span class="lineno"> 244</span> <span class="comment">// printf(&quot;Vector product &quot;);</span></div>
<div class="line"><a id="l00245" name="l00245"></a><span class="lineno"> 245</span> <span class="comment">// printf(&quot;%s&quot;, print_vector(&amp;c, &quot;c&quot;));</span></div>
<div class="line"><a id="l00246" name="l00246"></a><span class="lineno"> 246</span> assert(fabsf(c.x - (-1.f)) &lt; 0.01);</div>
<div class="line"><a id="l00247" name="l00247"></a><span class="lineno"> 247</span> assert(fabsf(c.y - (2.f)) &lt; 0.01);</div>
<div class="line"><a id="l00248" name="l00248"></a><span class="lineno"> 248</span> assert(fabsf(c.z - (-1.f)) &lt; 0.01);</div>
<div class="line"><a id="l00249" name="l00249"></a><span class="lineno"> 249</span> </div>
<div class="line"><a id="l00250" name="l00250"></a><span class="lineno"> 250</span> <span class="keywordtype">double</span> alpha = <a class="code hl_function" href="../../de/d7b/group__vec__3d.html#ga55be1d766c8a824b35d97e79744834d8">get_angle</a>(&amp;a, &amp;b);</div>
<div class="line"><a id="l00251" name="l00251"></a><span class="lineno"> 251</span> <span class="comment">// printf(&quot;The angle is %f\n&quot;, alpha);</span></div>
<div class="line"><a id="l00252" name="l00252"></a><span class="lineno"> 252</span> assert(fabsf(alpha - 0.387597) &lt; 0.01);</div>
<div class="line"><a id="l00253" name="l00253"></a><span class="lineno"> 253</span>}</div>
<div class="ttc" id="agroup__vec__3d_html_ga243e74d542d0d4d14fa3ae0bc2170d84"><div class="ttname"><a href="../../de/d7b/group__vec__3d.html#ga243e74d542d0d4d14fa3ae0bc2170d84">dot_prod</a></div><div class="ttdeci">float dot_prod(const vec_3d *a, const vec_3d *b)</div><div class="ttdoc">Obtain the dot product of two 3D vectors.</div><div class="ttdef"><b>Definition:</b> vectors_3d.c:76</div></div>
<div class="ttc" id="agroup__vec__3d_html_ga55be1d766c8a824b35d97e79744834d8"><div class="ttname"><a href="../../de/d7b/group__vec__3d.html#ga55be1d766c8a824b35d97e79744834d8">get_angle</a></div><div class="ttdeci">double get_angle(const vec_3d *a, const vec_3d *b)</div><div class="ttdoc">Obtain the angle between two given vectors.</div><div class="ttdef"><b>Definition:</b> vectors_3d.c:202</div></div>
<div class="ttc" id="agroup__vec__3d_html_ga94805165d037d111d7d7c0df99e3a5de"><div class="ttname"><a href="../../de/d7b/group__vec__3d.html#ga94805165d037d111d7d7c0df99e3a5de">vector_norm</a></div><div class="ttdeci">float vector_norm(const vec_3d *a)</div><div class="ttdoc">Compute the norm a vector.</div><div class="ttdef"><b>Definition:</b> vectors_3d.c:138</div></div>
<div class="ttc" id="agroup__vec__3d_html_gae4a49e6bdf13df949e8b23c7925bb5f5"><div class="ttname"><a href="../../de/d7b/group__vec__3d.html#gae4a49e6bdf13df949e8b23c7925bb5f5">vector_prod</a></div><div class="ttdeci">vec_3d vector_prod(const vec_3d *a, const vec_3d *b)</div><div class="ttdoc">Compute the vector product of two 3d vectors.</div><div class="ttdef"><b>Definition:</b> vectors_3d.c:105</div></div>
<div class="ttc" id="astructvec__3d___html"><div class="ttname"><a href="../../d5/db4/structvec__3d__.html">vec_3d_</a></div><div class="ttdoc">3D vector type</div><div class="ttdef"><b>Definition:</b> geometry_datatypes.h:22</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d5/db8/vectors__3d_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg" width="456" height="167"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="../../dir_e3380d2178455503f266746fb14246a5.html">geometry</a></li><li class="navelem"><a class="el" href="../../d5/db8/vectors__3d_8c.html">vectors_3d.c</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.2 </li>
</ul>
</div>
</body>
</html>