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< std::pair< <a href="../Shape/Line.html"><font color="#0000CC">Line</font></a>, <a href="../Shape/Line.html"><font color="#0000CC">Line</font></a> > *> &<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> collision = ...;
<br>
<br><font color="#999922">// Get all colliding segments //</font>
<br><font color="#777733">const</font> std::vector< std::pair< <a href="../Shape/Line.html"><font color="#0000CC">Line</font></a>, <a href="../Shape/Line.html"><font color="#0000CC">Line</font></a> > *> &segments = collision.<a href="../Collision/GetAllSegments.html"><font color="#0000CC">GetAllSegments</font></a>();
<br>
<br><font color="#999922">// Draw the colliding segments //</font>
<br><font color="#999922">// (Object A's colliding segments will be green and Object B's red) //</font>
<br>
<br>for( std::vector< std::pair< <a href="../Shape/Line.html"><font color="#0000CC">Line</font></a>, <a href="../Shape/Line.html"><font color="#0000CC">Line</font></a> > *> ::<font color="#777733">const</font>_iterator iter = segments.begin(); iter != segments.end(); iter++ ) {
<br> (*iter)->first.<a href="../Poly/Draw.html"><font color="#0000CC">Draw</font></a>( <a href="../Rgba.html"><font color="#0000CC">Rgba</font></a>::GREEN );
<br> (*iter)->second.<a href="../Poly/Draw.html"><font color="#0000CC">Draw</font></a>( <a href="../Rgba.html"><font color="#0000CC">Rgba</font></a>::RED );
<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>
|