mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-24 13:53:35 +08:00
Documentation for 8b1eab204b
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
<!-- HTML header for doxygen 1.12.0-->
|
||||
<!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" lang="en-US">
|
||||
<head>
|
||||
@@ -5,10 +6,15 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.12.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: SegmentIntersection Struct Reference</title>
|
||||
<title>TheAlgorithms/C++: SegmentIntersection Struct Reference</title>
|
||||
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
|
||||
<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>
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@xpack-3rd-party/doxygen-awesome-css@2.2.0-1/doxygen-awesome-darkmode-toggle.js"></script>
|
||||
<script type="text/javascript">
|
||||
DoxygenAwesomeDarkModeToggle.init()
|
||||
</script>
|
||||
<script type="text/javascript" src="../../clipboard.js"></script>
|
||||
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="../../navtreedata.js"></script>
|
||||
@@ -18,14 +24,24 @@
|
||||
<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 type="text/javascript">
|
||||
window.MathJax = {
|
||||
options: {
|
||||
ignoreHtmlClass: 'tex2jax_ignore',
|
||||
processHtmlClass: 'tex2jax_process'
|
||||
},
|
||||
loader: {
|
||||
load: ['[tex]/ams']
|
||||
},
|
||||
tex: {
|
||||
macros: {},
|
||||
packages: ['base','configmacros','ams']
|
||||
}
|
||||
};
|
||||
</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>
|
||||
<script type="text/javascript" id="MathJax-script" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
|
||||
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
|
||||
<link href="../../doxygen-awesome.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
@@ -33,10 +49,11 @@ MathJax.Hub.Config({
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectlogo"><img alt="Logo" src="../../project_logo.png"/></td>
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
<div id="projectname">TheAlgorithms/C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
<div id="projectbrief">All the algorithms implemented in C++</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -122,6 +139,8 @@ Public Member Functions</h2></td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p>intersect returns true if segments of two line intersects and false if they do not. It calls the subroutines direction which computes the orientation. </p>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../d8/d6c/line__segment__intersection_8cpp_source.html#l00022">22</a> of file <a class="el" href="../../d8/d6c/line__segment__intersection_8cpp_source.html">line_segment_intersection.cpp</a>.</p>
|
||||
</div><h2 class="groupheader">Member Function Documentation</h2>
|
||||
<a id="a3beb2ac1b35d67354f1dbaf9a971e655" name="a3beb2ac1b35d67354f1dbaf9a971e655"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a3beb2ac1b35d67354f1dbaf9a971e655">◆ </a></span>direction()</h2>
|
||||
@@ -155,13 +174,15 @@ Public Member Functions</h2></td></tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>We will find direction of line here respect to @first_point. Here @second_point and @third_point is first and second points of the line respectively. we want a method to determine which way a given angle these three points turns. If returned number is negative, then the angle is counter-clockwise. That means the line is going to right to left. We will fount angle as clockwise if the method returns positive number. </p>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../d8/d6c/line__segment__intersection_8cpp_source.html#l00063">63</a> of file <a class="el" href="../../d8/d6c/line__segment__intersection_8cpp_source.html">line_segment_intersection.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 64</span> {</div>
|
||||
<div class="line"><span class="lineno"> 65</span> <span class="keywordflow">return</span> ((third_point.x - first_point.x) *</div>
|
||||
<div class="line"><span class="lineno"> 66</span> (second_point.<a class="code hl_variable" href="../../d8/dc8/struct_point.html#a2e1b5fb2b2a83571f5c0bc0f66a73cf7">y</a> - first_point.<a class="code hl_variable" href="../../d8/dc8/struct_point.html#a2e1b5fb2b2a83571f5c0bc0f66a73cf7">y</a>)) -</div>
|
||||
<div class="line"><span class="lineno"> 67</span> ((second_point.x - first_point.x) *</div>
|
||||
<div class="line"><span class="lineno"> 68</span> (third_point.<a class="code hl_variable" href="../../d8/dc8/struct_point.html#a2e1b5fb2b2a83571f5c0bc0f66a73cf7">y</a> - first_point.<a class="code hl_variable" href="../../d8/dc8/struct_point.html#a2e1b5fb2b2a83571f5c0bc0f66a73cf7">y</a>));</div>
|
||||
<div class="line"><span class="lineno"> 69</span> }</div>
|
||||
<div class="ttc" id="astruct_point_html_a2e1b5fb2b2a83571f5c0bc0f66a73cf7"><div class="ttname"><a href="../../d8/dc8/struct_point.html#a2e1b5fb2b2a83571f5c0bc0f66a73cf7">Point::y</a></div><div class="ttdeci">int y</div><div class="ttdoc">Point respect to x coordinate.</div><div class="ttdef"><b>Definition</b> line_segment_intersection.cpp:14</div></div>
|
||||
<div class="ttc" id="astruct_point_html_a2e1b5fb2b2a83571f5c0bc0f66a73cf7"><div class="ttname"><a href="../../d8/dc8/struct_point.html#a2e1b5fb2b2a83571f5c0bc0f66a73cf7">Point::y</a></div><div class="ttdeci">int y</div><div class="ttdoc">Point respect to x coordinate.</div><div class="ttdef"><b>Definition</b> <a href="../../d8/d6c/line__segment__intersection_8cpp_source.html#l00014">line_segment_intersection.cpp:14</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -201,6 +222,8 @@ Public Member Functions</h2></td></tr>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../d8/d6c/line__segment__intersection_8cpp_source.html#l00023">23</a> of file <a class="el" href="../../d8/d6c/line__segment__intersection_8cpp_source.html">line_segment_intersection.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 24</span> {</div>
|
||||
<div class="line"><span class="lineno"> 25</span> <span class="keywordtype">int</span> direction1 = <a class="code hl_function" href="#a3beb2ac1b35d67354f1dbaf9a971e655">direction</a>(third_point, forth_point, first_point);</div>
|
||||
<div class="line"><span class="lineno"> 26</span> <span class="keywordtype">int</span> direction2 = <a class="code hl_function" href="#a3beb2ac1b35d67354f1dbaf9a971e655">direction</a>(third_point, forth_point, second_point);</div>
|
||||
@@ -230,8 +253,8 @@ Public Member Functions</h2></td></tr>
|
||||
<div class="line"><span class="lineno"> 50</span> <span class="keywordflow">else</span></div>
|
||||
<div class="line"><span class="lineno"> 51</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
|
||||
<div class="line"><span class="lineno"> 52</span> }</div>
|
||||
<div class="ttc" id="astruct_segment_intersection_html_a008941b2272866c64cdaf959afa939bf"><div class="ttname"><a href="#a008941b2272866c64cdaf959afa939bf">SegmentIntersection::on_segment</a></div><div class="ttdeci">bool on_segment(Point first_point, Point second_point, Point third_point)</div><div class="ttdef"><b>Definition</b> line_segment_intersection.cpp:75</div></div>
|
||||
<div class="ttc" id="astruct_segment_intersection_html_a3beb2ac1b35d67354f1dbaf9a971e655"><div class="ttname"><a href="#a3beb2ac1b35d67354f1dbaf9a971e655">SegmentIntersection::direction</a></div><div class="ttdeci">int direction(Point first_point, Point second_point, Point third_point)</div><div class="ttdef"><b>Definition</b> line_segment_intersection.cpp:63</div></div>
|
||||
<div class="ttc" id="astruct_segment_intersection_html_a008941b2272866c64cdaf959afa939bf"><div class="ttname"><a href="#a008941b2272866c64cdaf959afa939bf">SegmentIntersection::on_segment</a></div><div class="ttdeci">bool on_segment(Point first_point, Point second_point, Point third_point)</div><div class="ttdef"><b>Definition</b> <a href="../../d8/d6c/line__segment__intersection_8cpp_source.html#l00075">line_segment_intersection.cpp:75</a></div></div>
|
||||
<div class="ttc" id="astruct_segment_intersection_html_a3beb2ac1b35d67354f1dbaf9a971e655"><div class="ttname"><a href="#a3beb2ac1b35d67354f1dbaf9a971e655">SegmentIntersection::direction</a></div><div class="ttdeci">int direction(Point first_point, Point second_point, Point third_point)</div><div class="ttdef"><b>Definition</b> <a href="../../d8/d6c/line__segment__intersection_8cpp_source.html#l00063">line_segment_intersection.cpp:63</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -267,28 +290,23 @@ Public Member Functions</h2></td></tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>This method determines whether a point known to be colinear with a segment lies on that segment. </p>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../d8/d6c/line__segment__intersection_8cpp_source.html#l00075">75</a> of file <a class="el" href="../../d8/d6c/line__segment__intersection_8cpp_source.html">line_segment_intersection.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 76</span> {</div>
|
||||
<div class="line"><span class="lineno"> 77</span> <span class="keywordflow">if</span> (<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/min.html">std::min</a>(first_point.x, second_point.x) <= third_point.x &&</div>
|
||||
<div class="line"><span class="lineno"> 78</span> third_point.x <= <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/max.html">std::max</a>(first_point.x, second_point.x) &&</div>
|
||||
<div class="line"><span class="lineno"> 79</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/min.html">std::min</a>(first_point.<a class="code hl_variable" href="../../d8/dc8/struct_point.html#a2e1b5fb2b2a83571f5c0bc0f66a73cf7">y</a>, second_point.<a class="code hl_variable" href="../../d8/dc8/struct_point.html#a2e1b5fb2b2a83571f5c0bc0f66a73cf7">y</a>) <= third_point.<a class="code hl_variable" href="../../d8/dc8/struct_point.html#a2e1b5fb2b2a83571f5c0bc0f66a73cf7">y</a> &&</div>
|
||||
<div class="line"><span class="lineno"> 80</span> third_point.<a class="code hl_variable" href="../../d8/dc8/struct_point.html#a2e1b5fb2b2a83571f5c0bc0f66a73cf7">y</a> <= <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/max.html">std::max</a>(first_point.<a class="code hl_variable" href="../../d8/dc8/struct_point.html#a2e1b5fb2b2a83571f5c0bc0f66a73cf7">y</a>, second_point.<a class="code hl_variable" href="../../d8/dc8/struct_point.html#a2e1b5fb2b2a83571f5c0bc0f66a73cf7">y</a>))</div>
|
||||
<div class="line"><span class="lineno"> 77</span> <span class="keywordflow">if</span> (std::min(first_point.x, second_point.x) <= third_point.x &&</div>
|
||||
<div class="line"><span class="lineno"> 78</span> third_point.x <= std::max(first_point.x, second_point.x) &&</div>
|
||||
<div class="line"><span class="lineno"> 79</span> std::min(first_point.<a class="code hl_variable" href="../../d8/dc8/struct_point.html#a2e1b5fb2b2a83571f5c0bc0f66a73cf7">y</a>, second_point.<a class="code hl_variable" href="../../d8/dc8/struct_point.html#a2e1b5fb2b2a83571f5c0bc0f66a73cf7">y</a>) <= third_point.<a class="code hl_variable" href="../../d8/dc8/struct_point.html#a2e1b5fb2b2a83571f5c0bc0f66a73cf7">y</a> &&</div>
|
||||
<div class="line"><span class="lineno"> 80</span> third_point.<a class="code hl_variable" href="../../d8/dc8/struct_point.html#a2e1b5fb2b2a83571f5c0bc0f66a73cf7">y</a> <= std::max(first_point.<a class="code hl_variable" href="../../d8/dc8/struct_point.html#a2e1b5fb2b2a83571f5c0bc0f66a73cf7">y</a>, second_point.<a class="code hl_variable" href="../../d8/dc8/struct_point.html#a2e1b5fb2b2a83571f5c0bc0f66a73cf7">y</a>))</div>
|
||||
<div class="line"><span class="lineno"> 81</span> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
|
||||
<div class="line"><span class="lineno"> 82</span> </div>
|
||||
<div class="line"><span class="lineno"> 83</span> <span class="keywordflow">else</span></div>
|
||||
<div class="line"><span class="lineno"> 84</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
|
||||
<div class="line"><span class="lineno"> 85</span> }</div>
|
||||
<div class="ttc" id="amax_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/algorithm/max.html">std::max</a></div><div class="ttdeci">T max(T... args)</div></div>
|
||||
<div class="ttc" id="amin_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/algorithm/min.html">std::min</a></div><div class="ttdeci">T min(T... args)</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="../../d4/db4/struct_segment_intersection_a008941b2272866c64cdaf959afa939bf_cgraph.svg" width="272" height="86"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
|
||||
</div>
|
||||
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<hr/>The documentation for this struct was generated from the following file:<ul>
|
||||
<li>geometry/<a class="el" href="../../d8/d6c/line__segment__intersection_8cpp.html">line_segment_intersection.cpp</a></li>
|
||||
<li>geometry/<a class="el" href="../../d8/d6c/line__segment__intersection_8cpp_source.html">line_segment_intersection.cpp</a></li>
|
||||
</ul>
|
||||
</div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
|
||||
Reference in New Issue
Block a user