File: GetAllSegments.html

package info (click to toggle)
openlayer 2.1-2.1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 3,392 kB
  • ctags: 2,317
  • sloc: ansic: 10,433; cpp: 9,890; xml: 109; makefile: 90; sh: 36
file content (17 lines) | stat: -rw-r--r-- 4,649 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transistional//EN"><html><head><title>OpenLayer Offline Manual</title><style type="text/css" media="all">@import "../CrystalStyle.css";</style><body bgcolor="FFFFFF" ><div align="center" style="pagestyle"><table width="60%"><tr><td><div class="parentLinks"><a href="../index.html">OpenLayer</a> | <a href="../Collision.html">Collision</a> | <a href="../Collision/GetAllSegments.html">GetAllSegments</a></div><br><div class="BigHeader">GetAllSegments</div><br><div class=""><div class="Surrounded"><table><tr valign="top"><td align="right"><div class="FuncDef"><strong><font color="#777733">const</font> std::vector&lt; std::pair&lt; <a href="../Shape/Line.html"><font color="#0000CC">Line</font></a>, <a href="../Shape/Line.html"><font color="#0000CC">Line</font></a> &gt; *&gt; &amp;<a href="../Collision/GetAllSegments.html"><font color="#0000CC">GetAllSegments</font></a>()
<br></strong></div></td></tr></table>
<br>Returns all pairs of colliding segments. The first line of each pair is colliding with the second line of the pair.
<br></div>
<br>There might be more than one collision point in some cases, if several parts of the objects collide at the same time.</div><br><div class="MediumHeader">Examples</div><br><div class="Code"><a href="../Collision.html"><font color="#0000CC">Collision</font></a>&nbsp;collision&nbsp;=&nbsp;...;
<br>
<br><font color="#999922">//&nbsp;Get&nbsp;all&nbsp;colliding&nbsp;segments&nbsp;//</font>
<br><font color="#777733">const</font>&nbsp;std::vector<&nbsp;std::pair<&nbsp;<a href="../Shape/Line.html"><font color="#0000CC">Line</font></a>,&nbsp;<a href="../Shape/Line.html"><font color="#0000CC">Line</font></a>&nbsp;>&nbsp;*>&nbsp;&segments&nbsp;=&nbsp;collision.<a href="../Collision/GetAllSegments.html"><font color="#0000CC">GetAllSegments</font></a>();
<br>
<br><font color="#999922">//&nbsp;Draw&nbsp;the&nbsp;colliding&nbsp;segments&nbsp;//</font>
<br><font color="#999922">//&nbsp;(Object&nbsp;A's&nbsp;colliding&nbsp;segments&nbsp;will&nbsp;be&nbsp;green&nbsp;and&nbsp;Object&nbsp;B's&nbsp;red)&nbsp;//</font>
<br>
<br>for(&nbsp;std::vector<&nbsp;std::pair<&nbsp;<a href="../Shape/Line.html"><font color="#0000CC">Line</font></a>,&nbsp;<a href="../Shape/Line.html"><font color="#0000CC">Line</font></a>&nbsp;>&nbsp;*>&nbsp;::<font color="#777733">const</font>_iterator&nbsp;iter&nbsp;=&nbsp;segments.begin();&nbsp;iter&nbsp;!=&nbsp;segments.end();&nbsp;iter++&nbsp;)&nbsp;{
<br>&nbsp;&nbsp;(*iter)->first.<a href="../Poly/Draw.html"><font color="#0000CC">Draw</font></a>(&nbsp;<a href="../Rgba.html"><font color="#0000CC">Rgba</font></a>::GREEN&nbsp;);
<br>&nbsp;&nbsp;(*iter)->second.<a href="../Poly/Draw.html"><font color="#0000CC">Draw</font></a>(&nbsp;<a href="../Rgba.html"><font color="#0000CC">Rgba</font></a>::RED&nbsp;);
<br>}
<br></div><div class=""><br><br><div class="MediumHeader">Other functions of the class <a href="../Collision.html"><font color="#0000CC">Collision</font></a></div><div class="Surrounded"><table size="100%" cellpadding="0" cellspacing="0"><tr><td halign="center" class="funclist"><a href="../Collision/GetPoint.html">GetPoint</a></td><td width="65%" halign="center"><div class="smalltext">Returns the exact point of the collision</div></td></tr><tr><td halign="center" class="funclist"><a href="../Collision/GetSegment.html">GetSegment</a></td><td width="65%" halign="center"><div class="smalltext">Returns the specified colliding line segment</div></td></tr><tr><td halign="center" class="funclist"><a href="../Collision/IsCollision.html">IsCollision</a></td><td width="65%" halign="center"><div class="smalltext">Returns true if a collision has really happened</div></td></tr><tr><td halign="center" class="funclist"><a href="../Collision/GetNormal.html">GetNormal</a></td><td width="65%" halign="center"><div class="smalltext">Returns the normal of a colliding object at the collision point</div></td></tr><tr><td halign="center" class="funclist"><a href="../Collision/GetAllPoints.html">GetAllPoints</a></td><td width="65%" halign="center"><div class="smalltext">Returns all collision points</div></td></tr><tr><td halign="center" class="funclist"><a href="../Collision/GetAllSegments.html">GetAllSegments</a></td><td width="65%" halign="center"><div class="smalltext">Returns all pairs of colliding segments</div></td></tr></table></div><br><div class=""><a href="../index.html">Back to the main page of the manual</a></div><br>Questions about GetAllSegments? Click <a href="http://crystalstorm.ath.cx/index.php?lan=en&page=CreateFeedback&subject=GetAllSegments">here.</a></div></td></tr></table></body></html>