mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-04-30 21:42:18 +08:00
Documentation for c26eea874d
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<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.12.0"/>
|
||||
<meta name="generator" content="Doxygen 1.13.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>TheAlgorithms/C++: physics/ground_to_ground_projectile_motion.cpp File Reference</title>
|
||||
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
|
||||
@@ -60,7 +60,7 @@ window.MathJax = {
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.12.0 -->
|
||||
<!-- Generated by Doxygen 1.13.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
|
||||
@@ -162,15 +162,15 @@ Functions</h2></td></tr>
|
||||
<tr class="memitem:ab00e9785fb2670f7af99d6f3d636f87c" id="r_ab00e9785fb2670f7af99d6f3d636f87c"><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="#ab00e9785fb2670f7af99d6f3d636f87c">physics::ground_to_ground_projectile_motion::degrees_to_radians</a> (double degrees)</td></tr>
|
||||
<tr class="memdesc:ab00e9785fb2670f7af99d6f3d636f87c"><td class="mdescLeft"> </td><td class="mdescRight">Convert radians to degrees. <br /></td></tr>
|
||||
<tr class="separator:ab00e9785fb2670f7af99d6f3d636f87c"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a563e066975fed1b84750a0a47c3cbb37" id="r_a563e066975fed1b84750a0a47c3cbb37"><td class="memTemplParams" colspan="2">template<typename T > </td></tr>
|
||||
<tr class="memitem:a563e066975fed1b84750a0a47c3cbb37" id="r_a563e066975fed1b84750a0a47c3cbb37"><td class="memTemplParams" colspan="2">template<typename T> </td></tr>
|
||||
<tr class="memitem:a563e066975fed1b84750a0a47c3cbb37"><td class="memTemplItemLeft" align="right" valign="top">T </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="#a563e066975fed1b84750a0a47c3cbb37">physics::ground_to_ground_projectile_motion::time_of_flight</a> (T initial_velocity, T angle, double gravity=9.81)</td></tr>
|
||||
<tr class="memdesc:a563e066975fed1b84750a0a47c3cbb37"><td class="mdescLeft"> </td><td class="mdescRight">Calculate the time of flight. <br /></td></tr>
|
||||
<tr class="separator:a563e066975fed1b84750a0a47c3cbb37"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a10362eb607d7882bac3a0688504b00ff" id="r_a10362eb607d7882bac3a0688504b00ff"><td class="memTemplParams" colspan="2">template<typename T > </td></tr>
|
||||
<tr class="memitem:a10362eb607d7882bac3a0688504b00ff" id="r_a10362eb607d7882bac3a0688504b00ff"><td class="memTemplParams" colspan="2">template<typename T> </td></tr>
|
||||
<tr class="memitem:a10362eb607d7882bac3a0688504b00ff"><td class="memTemplItemLeft" align="right" valign="top">T </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="#a10362eb607d7882bac3a0688504b00ff">physics::ground_to_ground_projectile_motion::horizontal_range</a> (T initial_velocity, T angle, T time)</td></tr>
|
||||
<tr class="memdesc:a10362eb607d7882bac3a0688504b00ff"><td class="mdescLeft"> </td><td class="mdescRight">Calculate the horizontal distance that the projectile travels. <br /></td></tr>
|
||||
<tr class="separator:a10362eb607d7882bac3a0688504b00ff"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:aa554429def63077ab7a550c0affbfefa" id="r_aa554429def63077ab7a550c0affbfefa"><td class="memTemplParams" colspan="2">template<typename T > </td></tr>
|
||||
<tr class="memitem:aa554429def63077ab7a550c0affbfefa" id="r_aa554429def63077ab7a550c0affbfefa"><td class="memTemplParams" colspan="2">template<typename T> </td></tr>
|
||||
<tr class="memitem:aa554429def63077ab7a550c0affbfefa"><td class="memTemplItemLeft" align="right" valign="top">T </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="#aa554429def63077ab7a550c0affbfefa">physics::ground_to_ground_projectile_motion::max_height</a> (T initial_velocity, T angle, double gravity=9.81)</td></tr>
|
||||
<tr class="memdesc:aa554429def63077ab7a550c0affbfefa"><td class="mdescLeft"> </td><td class="mdescRight">Calculate the max height of the projectile. <br /></td></tr>
|
||||
<tr class="separator:aa554429def63077ab7a550c0affbfefa"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
@@ -245,7 +245,7 @@ Functions</h2></td></tr>
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<div class="memtemplate">
|
||||
template<typename T > </div>
|
||||
template<typename T> </div>
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">T physics::ground_to_ground_projectile_motion::horizontal_range </td>
|
||||
@@ -317,7 +317,7 @@ template<typename T > </div>
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<div class="memtemplate">
|
||||
template<typename T > </div>
|
||||
template<typename T> </div>
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">T physics::ground_to_ground_projectile_motion::max_height </td>
|
||||
@@ -374,7 +374,7 @@ template<typename T > </div>
|
||||
</table>
|
||||
</td>
|
||||
<td class="mlabels-right">
|
||||
<span class="mlabels"><span class="mlabel">static</span></span> </td>
|
||||
<span class="mlabels"><span class="mlabel static">static</span></span> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
@@ -391,7 +391,7 @@ template<typename T > </div>
|
||||
<div class="line"><span class="lineno"> 88</span> <span class="comment">// 1st test</span></div>
|
||||
<div class="line"><span class="lineno"> 89</span> <span class="keywordtype">double</span> expected_time_of_flight = 0.655; <span class="comment">// expected time output</span></div>
|
||||
<div class="line"><span class="lineno"> 90</span> <span class="keywordtype">double</span> flight_time_output =</div>
|
||||
<div class="line"><span class="lineno"> 91</span> std::round(physics::ground_to_ground_projectile_motion::time_of_flight(initial_velocity, angle) * 1000.0) /</div>
|
||||
<div class="line"><span class="lineno"> 91</span> std::round(<a class="code hl_function" href="#a563e066975fed1b84750a0a47c3cbb37">physics::ground_to_ground_projectile_motion::time_of_flight</a>(initial_velocity, angle) * 1000.0) /</div>
|
||||
<div class="line"><span class="lineno"> 92</span> 1000.0; <span class="comment">// round output to 3 decimal places</span></div>
|
||||
<div class="line"><span class="lineno"> 93</span> </div>
|
||||
<div class="line"><span class="lineno"> 94</span> std::cout << <span class="stringliteral">"Projectile Flight Time (double)"</span> << std::endl;</div>
|
||||
@@ -405,7 +405,7 @@ template<typename T > </div>
|
||||
<div class="line"><span class="lineno"> 102</span> <span class="comment">// 2nd test</span></div>
|
||||
<div class="line"><span class="lineno"> 103</span> <span class="keywordtype">double</span> expected_horizontal_range = 2.51; <span class="comment">// expected range output</span></div>
|
||||
<div class="line"><span class="lineno"> 104</span> <span class="keywordtype">double</span> horizontal_range_output =</div>
|
||||
<div class="line"><span class="lineno"> 105</span> std::round(physics::ground_to_ground_projectile_motion::horizontal_range(initial_velocity, angle,</div>
|
||||
<div class="line"><span class="lineno"> 105</span> std::round(<a class="code hl_function" href="#a10362eb607d7882bac3a0688504b00ff">physics::ground_to_ground_projectile_motion::horizontal_range</a>(initial_velocity, angle,</div>
|
||||
<div class="line"><span class="lineno"> 106</span> flight_time_output) *</div>
|
||||
<div class="line"><span class="lineno"> 107</span> 100.0) /</div>
|
||||
<div class="line"><span class="lineno"> 108</span> 100.0; <span class="comment">// round output to 2 decimal places</span></div>
|
||||
@@ -422,7 +422,7 @@ template<typename T > </div>
|
||||
<div class="line"><span class="lineno"> 119</span> <span class="comment">// 3rd test</span></div>
|
||||
<div class="line"><span class="lineno"> 120</span> <span class="keywordtype">double</span> expected_max_height = 0.526; <span class="comment">// expected height output</span></div>
|
||||
<div class="line"><span class="lineno"> 121</span> <span class="keywordtype">double</span> max_height_output =</div>
|
||||
<div class="line"><span class="lineno"> 122</span> std::round(physics::ground_to_ground_projectile_motion::max_height(initial_velocity, angle) * 1000.0) /</div>
|
||||
<div class="line"><span class="lineno"> 122</span> std::round(<a class="code hl_function" href="#aa554429def63077ab7a550c0affbfefa">physics::ground_to_ground_projectile_motion::max_height</a>(initial_velocity, angle) * 1000.0) /</div>
|
||||
<div class="line"><span class="lineno"> 123</span> 1000.0; <span class="comment">// round output to 3 decimal places</span></div>
|
||||
<div class="line"><span class="lineno"> 124</span> </div>
|
||||
<div class="line"><span class="lineno"> 125</span> std::cout << <span class="stringliteral">"Projectile Max Height (double)"</span> << std::endl;</div>
|
||||
@@ -433,6 +433,9 @@ template<typename T > </div>
|
||||
<div class="line"><span class="lineno"> 130</span> assert(max_height_output == expected_max_height);</div>
|
||||
<div class="line"><span class="lineno"> 131</span> std::cout << <span class="stringliteral">"TEST PASSED"</span> << std::endl << std::endl;</div>
|
||||
<div class="line"><span class="lineno"> 132</span>}</div>
|
||||
<div class="ttc" id="aground__to__ground__projectile__motion_8cpp_html_a10362eb607d7882bac3a0688504b00ff"><div class="ttname"><a href="#a10362eb607d7882bac3a0688504b00ff">physics::ground_to_ground_projectile_motion::horizontal_range</a></div><div class="ttdeci">T horizontal_range(T initial_velocity, T angle, T time)</div><div class="ttdoc">Calculate the horizontal distance that the projectile travels.</div><div class="ttdef"><b>Definition</b> <a href="../../d9/d29/ground__to__ground__projectile__motion_8cpp_source.html#l00059">ground_to_ground_projectile_motion.cpp:59</a></div></div>
|
||||
<div class="ttc" id="aground__to__ground__projectile__motion_8cpp_html_a563e066975fed1b84750a0a47c3cbb37"><div class="ttname"><a href="#a563e066975fed1b84750a0a47c3cbb37">physics::ground_to_ground_projectile_motion::time_of_flight</a></div><div class="ttdeci">T time_of_flight(T initial_velocity, T angle, double gravity=9.81)</div><div class="ttdoc">Calculate the time of flight.</div><div class="ttdef"><b>Definition</b> <a href="../../d9/d29/ground__to__ground__projectile__motion_8cpp_source.html#l00047">ground_to_ground_projectile_motion.cpp:47</a></div></div>
|
||||
<div class="ttc" id="aground__to__ground__projectile__motion_8cpp_html_aa554429def63077ab7a550c0affbfefa"><div class="ttname"><a href="#aa554429def63077ab7a550c0affbfefa">physics::ground_to_ground_projectile_motion::max_height</a></div><div class="ttdeci">T max_height(T initial_velocity, T angle, double gravity=9.81)</div><div class="ttdoc">Calculate the max height of the projectile.</div><div class="ttdef"><b>Definition</b> <a href="../../d9/d29/ground__to__ground__projectile__motion_8cpp_source.html#l00072">ground_to_ground_projectile_motion.cpp:72</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -442,7 +445,7 @@ template<typename T > </div>
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<div class="memtemplate">
|
||||
template<typename T > </div>
|
||||
template<typename T> </div>
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">T physics::ground_to_ground_projectile_motion::time_of_flight </td>
|
||||
@@ -487,7 +490,7 @@ template<typename T > </div>
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="../../dir_59dc24c326e2a72d1164f014b22de83d.html">physics</a></li><li class="navelem"><a class="el" href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html">ground_to_ground_projectile_motion.cpp</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.12.0 </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.13.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
var ground__to__ground__projectile__motion_8cpp =
|
||||
[
|
||||
[ "_USE_MATH_DEFINES", "d9/d29/ground__to__ground__projectile__motion_8cpp.html#a525335710b53cb064ca56b936120431e", null ],
|
||||
[ "degrees_to_radians", "d9/d29/ground__to__ground__projectile__motion_8cpp.html#ab00e9785fb2670f7af99d6f3d636f87c", null ],
|
||||
[ "horizontal_range", "d9/d29/ground__to__ground__projectile__motion_8cpp.html#a10362eb607d7882bac3a0688504b00ff", null ],
|
||||
[ "physics::ground_to_ground_projectile_motion::degrees_to_radians", "d9/d29/ground__to__ground__projectile__motion_8cpp.html#ab00e9785fb2670f7af99d6f3d636f87c", null ],
|
||||
[ "physics::ground_to_ground_projectile_motion::horizontal_range", "d9/d29/ground__to__ground__projectile__motion_8cpp.html#a10362eb607d7882bac3a0688504b00ff", null ],
|
||||
[ "main", "d9/d29/ground__to__ground__projectile__motion_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ],
|
||||
[ "max_height", "d9/d29/ground__to__ground__projectile__motion_8cpp.html#aa554429def63077ab7a550c0affbfefa", null ],
|
||||
[ "physics::ground_to_ground_projectile_motion::max_height", "d9/d29/ground__to__ground__projectile__motion_8cpp.html#aa554429def63077ab7a550c0affbfefa", null ],
|
||||
[ "test", "d9/d29/ground__to__ground__projectile__motion_8cpp.html#aa8dca7b867074164d5f45b0f3851269d", null ],
|
||||
[ "time_of_flight", "d9/d29/ground__to__ground__projectile__motion_8cpp.html#a563e066975fed1b84750a0a47c3cbb37", null ]
|
||||
[ "physics::ground_to_ground_projectile_motion::time_of_flight", "d9/d29/ground__to__ground__projectile__motion_8cpp.html#a563e066975fed1b84750a0a47c3cbb37", null ]
|
||||
];
|
||||
@@ -4,7 +4,7 @@
|
||||
<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.12.0"/>
|
||||
<meta name="generator" content="Doxygen 1.13.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>TheAlgorithms/C++: physics/ground_to_ground_projectile_motion.cpp Source File</title>
|
||||
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
|
||||
@@ -60,7 +60,7 @@ window.MathJax = {
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.12.0 -->
|
||||
<!-- Generated by Doxygen 1.13.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
|
||||
@@ -124,21 +124,23 @@ $(function(){initNavTree('d9/d29/ground__to__ground__projectile__motion_8cpp_sou
|
||||
<div class="headertitle"><div class="title">ground_to_ground_projectile_motion.cpp</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<a href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
|
||||
<a href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span></div>
|
||||
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> </div>
|
||||
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><span class="preprocessor">#include <cassert></span> </div>
|
||||
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"><a class="line" href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html#a525335710b53cb064ca56b936120431e"> 13</a></span><span class="preprocessor">#define _USE_MATH_DEFINES</span></div>
|
||||
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="preprocessor">#include <cmath></span> </div>
|
||||
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="preprocessor">#include <iostream></span> </div>
|
||||
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> </div>
|
||||
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span></div>
|
||||
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span><span class="keyword">namespace </span><a class="code hl_namespace" href="../../d5/dd0/namespacephysics.html">physics</a> {</div>
|
||||
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span><span class="keyword">namespace </span><a class="code hl_namespace" href="../../d0/d20/namespaceground__to__ground__projectile__motion.html">ground_to_ground_projectile_motion</a> {</div>
|
||||
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> </div>
|
||||
<div class="foldopen" id="foldopen00034" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"><a class="line" href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html#ab00e9785fb2670f7af99d6f3d636f87c"> 34</a></span><span class="keywordtype">double</span> <a class="code hl_function" href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html#ab00e9785fb2670f7af99d6f3d636f87c">degrees_to_radians</a>(<span class="keywordtype">double</span> degrees){</div>
|
||||
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> <span class="keywordtype">double</span> radians = degrees * (M_PI / 180);</div>
|
||||
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <span class="keywordflow">return</span> radians;</div>
|
||||
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span>}</div>
|
||||
</div>
|
||||
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> </div>
|
||||
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span></div>
|
||||
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span><span class="keyword">template</span> <<span class="keyword">typename</span> T></div>
|
||||
<div class="foldopen" id="foldopen00047" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"><a class="line" href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html#a563e066975fed1b84750a0a47c3cbb37"> 47</a></span>T <a class="code hl_function" href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html#a563e066975fed1b84750a0a47c3cbb37">time_of_flight</a>(T initial_velocity, T angle, <span class="keywordtype">double</span> gravity = 9.81) {</div>
|
||||
@@ -146,7 +148,7 @@ $(function(){initNavTree('d9/d29/ground__to__ground__projectile__motion_8cpp_sou
|
||||
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <span class="keywordflow">return</span> 2.0 * Viy / gravity;</div>
|
||||
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span>}</div>
|
||||
</div>
|
||||
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> </div>
|
||||
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span></div>
|
||||
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span><span class="keyword">template</span> <<span class="keyword">typename</span> T></div>
|
||||
<div class="foldopen" id="foldopen00059" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"><a class="line" href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html#a10362eb607d7882bac3a0688504b00ff"> 59</a></span>T <a class="code hl_function" href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html#a10362eb607d7882bac3a0688504b00ff">horizontal_range</a>(T initial_velocity, T angle, T time) {</div>
|
||||
@@ -154,7 +156,7 @@ $(function(){initNavTree('d9/d29/ground__to__ground__projectile__motion_8cpp_sou
|
||||
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <span class="keywordflow">return</span> Vix * time;</div>
|
||||
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span>}</div>
|
||||
</div>
|
||||
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> </div>
|
||||
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span></div>
|
||||
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span><span class="keyword">template</span> <<span class="keyword">typename</span> T></div>
|
||||
<div class="foldopen" id="foldopen00072" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"><a class="line" href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html#aa554429def63077ab7a550c0affbfefa"> 72</a></span>T <a class="code hl_function" href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html#aa554429def63077ab7a550c0affbfefa">max_height</a>(T initial_velocity, T angle, <span class="keywordtype">double</span> gravity = 9.81) {</div>
|
||||
@@ -164,7 +166,7 @@ $(function(){initNavTree('d9/d29/ground__to__ground__projectile__motion_8cpp_sou
|
||||
</div>
|
||||
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span>} <span class="comment">// namespace ground_to_ground_projectile_motion</span></div>
|
||||
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span>} <span class="comment">// namespace physics</span></div>
|
||||
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> </div>
|
||||
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span></div>
|
||||
<div class="foldopen" id="foldopen00083" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"><a class="line" href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html#aa8dca7b867074164d5f45b0f3851269d"> 83</a></span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>() {</div>
|
||||
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> <span class="comment">// initial input variables</span></div>
|
||||
@@ -174,7 +176,7 @@ $(function(){initNavTree('d9/d29/ground__to__ground__projectile__motion_8cpp_sou
|
||||
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> <span class="comment">// 1st test</span></div>
|
||||
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> <span class="keywordtype">double</span> expected_time_of_flight = 0.655; <span class="comment">// expected time output</span></div>
|
||||
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> <span class="keywordtype">double</span> flight_time_output =</div>
|
||||
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> std::round(physics::ground_to_ground_projectile_motion::time_of_flight(initial_velocity, angle) * 1000.0) /</div>
|
||||
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> std::round(<a class="code hl_function" href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html#a563e066975fed1b84750a0a47c3cbb37">physics::ground_to_ground_projectile_motion::time_of_flight</a>(initial_velocity, angle) * 1000.0) /</div>
|
||||
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> 1000.0; <span class="comment">// round output to 3 decimal places</span></div>
|
||||
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> </div>
|
||||
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> std::cout << <span class="stringliteral">"Projectile Flight Time (double)"</span> << std::endl;</div>
|
||||
@@ -188,7 +190,7 @@ $(function(){initNavTree('d9/d29/ground__to__ground__projectile__motion_8cpp_sou
|
||||
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> <span class="comment">// 2nd test</span></div>
|
||||
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> <span class="keywordtype">double</span> expected_horizontal_range = 2.51; <span class="comment">// expected range output</span></div>
|
||||
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> <span class="keywordtype">double</span> horizontal_range_output =</div>
|
||||
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> std::round(physics::ground_to_ground_projectile_motion::horizontal_range(initial_velocity, angle,</div>
|
||||
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> std::round(<a class="code hl_function" href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html#a10362eb607d7882bac3a0688504b00ff">physics::ground_to_ground_projectile_motion::horizontal_range</a>(initial_velocity, angle,</div>
|
||||
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> flight_time_output) *</div>
|
||||
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> 100.0) /</div>
|
||||
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> 100.0; <span class="comment">// round output to 2 decimal places</span></div>
|
||||
@@ -205,7 +207,7 @@ $(function(){initNavTree('d9/d29/ground__to__ground__projectile__motion_8cpp_sou
|
||||
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> <span class="comment">// 3rd test</span></div>
|
||||
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> <span class="keywordtype">double</span> expected_max_height = 0.526; <span class="comment">// expected height output</span></div>
|
||||
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> <span class="keywordtype">double</span> max_height_output =</div>
|
||||
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> std::round(physics::ground_to_ground_projectile_motion::max_height(initial_velocity, angle) * 1000.0) /</div>
|
||||
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> std::round(<a class="code hl_function" href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html#aa554429def63077ab7a550c0affbfefa">physics::ground_to_ground_projectile_motion::max_height</a>(initial_velocity, angle) * 1000.0) /</div>
|
||||
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> 1000.0; <span class="comment">// round output to 3 decimal places</span></div>
|
||||
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> </div>
|
||||
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> std::cout << <span class="stringliteral">"Projectile Max Height (double)"</span> << std::endl;</div>
|
||||
@@ -217,7 +219,7 @@ $(function(){initNavTree('d9/d29/ground__to__ground__projectile__motion_8cpp_sou
|
||||
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> std::cout << <span class="stringliteral">"TEST PASSED"</span> << std::endl << std::endl;</div>
|
||||
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span>}</div>
|
||||
</div>
|
||||
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> </div>
|
||||
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span></div>
|
||||
<div class="foldopen" id="foldopen00138" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"><a class="line" href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4"> 138</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a>() {</div>
|
||||
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> <a class="code hl_function" href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
|
||||
@@ -238,7 +240,7 @@ $(function(){initNavTree('d9/d29/ground__to__ground__projectile__motion_8cpp_sou
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="../../dir_59dc24c326e2a72d1164f014b22de83d.html">physics</a></li><li class="navelem"><a class="el" href="../../d9/d29/ground__to__ground__projectile__motion_8cpp.html">ground_to_ground_projectile_motion.cpp</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.12.0 </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.13.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user