summaryrefslogblamecommitdiff
path: root/doc/sims/collision/GridDetector.html
blob: 6cdaad7e480a440febc867fd23ff1278d6f08d79 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12

                                                                                                 
      








                                                                                        
    

                           
      
                                                                                               
 



                                             
 








                                                                                                                                                                     
      












                                                                                                                                                                          
        
        
        

















































































































































































































































                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
        



















                                                                                                                                                                                                 
        


            
            
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
        <head>
          <title>Scaladoc for sims.collision.GridDetector</title>
          <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
		      <script type="text/javascript" src="../../lib/jquery.js"></script>
          
		  <style type="text/css">
		    @import url(../../lib/template.css) screen;
		  </style>
		  <script type="text/javascript" src="../../lib/template.js"></script>
    
        </head>
        <body class="type">
      
      <p id="owner"><a href="../package.html">sims</a>.<a href="package.html">collision</a></p>

      <div id="definition">
        <img src="../../lib/class_big.png" />
        <h1>GridDetector</h1>
      </div>

      <h4 class="signature">
      <span class="kind">class</span>
      <span class="symbol">
        <span class="name">GridDetector</span><span class="result"> extends <a href="Detector.html" class="extype" name="sims.collision.Detector">Detector</a></span>
      </span>
      </h4>
      <div class="fullcomment" id="comment">
      <div class="comment cmt"><p>A conrete implementation of <code>Detector</code>. <code>GridDetector</code> divides the world into a grid
for faster collision detection.</p></div>
      
      
      
      
    </div>
      
      <div id="template">
      
        <div id="mbrsel">
              <div id="ancestors">
                <h3>Inherits</h3>
                <ol><li class="in" name="sims.collision.Detector">Detector</li><li class="in" name="scala.AnyRef">AnyRef</li><li class="in" name="scala.Any">Any</li></ol>
              </div>
            </div>
        
        
        
        <div class="members" id="values">
              <h3>Value Members</h3>
              <ol><li name="sims.collision.GridDetector#colliding">
      <h4 class="signature">
      <span class="kind">def</span>
      <span class="symbol">
        <span class="name">colliding</span><span class="params">(<span name="p">p: <a href="Pair.html" class="extype" name="sims.collision.Pair">Pair</a></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
      </span>
      </h4>
      <p class="shortcomment cmt">Checks the pair of shapes <code>p</code> for collision</p><div class="fullcomment">
      <div class="comment cmt"><p>Checks the pair of shapes <code>p</code> for collision.</p></div>
      <dl class="paramcmts block"><dt class="param">p</dt><dd class="cmt"><p>Pair of shapes.</p></dd></dl>
      
      
      
    </div>
    </li><li name="sims.collision.GridDetector#collidingPairs">
      <h4 class="signature">
      <span class="kind">def</span>
      <span class="symbol">
        <span class="name">collidingPairs</span><span class="result">: <span class="extype" name="scala.collection.Seq">Seq</span>[<a href="Pair.html" class="extype" name="sims.collision.Pair">Pair</a>]</span>
      </span>
      </h4>
      <p class="shortcomment cmt">Returns all colliding pairs</p><div class="fullcomment">
      <div class="comment cmt"><p>Returns all colliding pairs.</p></div>
      
      
      
      
    </div>
    </li><li name="sims.collision.GridDetector#collision">
      <h4 class="signature">
      <span class="kind">def</span>
      <span class="symbol">
        <span class="name">collision</span><span class="params">(<span name="p">p: <a href="Pair.html" class="extype" name="sims.collision.Pair">Pair</a></span>)</span><span class="result">: <a href="Collision.html" class="extype" name="sims.collision.Collision">Collision</a></span>
      </span>
      </h4>
      <p class="shortcomment cmt">Returns the collision between both shapes of the pair <code>p</code></p><div class="fullcomment">
      <div class="comment cmt"><p>Returns the collision between both shapes of the pair <code>p</code>.</p></div>
      <dl class="paramcmts block"><dt class="param">p</dt><dd class="cmt"><p>Pair of shapes.</p></dd></dl>
      
      
      
    </div>
    </li><li name="sims.collision.GridDetector#collisionMethods">
      <h4 class="signature">
      <span class="kind">val</span>
      <span class="symbol">
        <span class="name">collisionMethods</span><span class="result">: <span class="extype" name="scala.collection.mutable.ArrayBuffer">ArrayBuffer</span>[<span class="extype" name="scala.PartialFunction">PartialFunction</span>[(<a href="../dynamics/Shape.html" class="extype" name="sims.dynamics.Shape">Shape</a>, <a href="../dynamics/Shape.html" class="extype" name="sims.dynamics.Shape">Shape</a>), <a href="Collision.html" class="extype" name="sims.collision.Collision">Collision</a>]]</span>
      </span>
      </h4>
      <p class="shortcomment cmt">Array of methods returning collisions</p><div class="fullcomment">
      <div class="comment cmt"><p>Array of methods returning collisions. It is assumed that both shapes are colliding.</p></div>
      
      
      
      
    </div>
    </li><li name="sims.collision.GridDetector#collisions">
      <h4 class="signature">
      <span class="kind">def</span>
      <span class="symbol">
        <span class="name">collisions</span><span class="result">: <span class="extype" name="scala.collection.Seq">Seq</span>[<a href="Collision.html" class="extype" name="sims.collision.Collision">Collision</a>]</span>
      </span>
      </h4>
      <p class="shortcomment cmt">Returns all collisions</p><div class="fullcomment">
      <div class="comment cmt"><p>Returns all collisions.</p></div>
      
      
      
      
    </div>
    </li><li name="sims.collision.GridDetector#detectionMethods">
      <h4 class="signature">
      <span class="kind">val</span>
      <span class="symbol">
        <span class="name">detectionMethods</span><span class="result">: <span class="extype" name="scala.collection.mutable.ArrayBuffer">ArrayBuffer</span>[<span class="extype" name="scala.PartialFunction">PartialFunction</span>[(<a href="../dynamics/Shape.html" class="extype" name="sims.dynamics.Shape">Shape</a>, <a href="../dynamics/Shape.html" class="extype" name="sims.dynamics.Shape">Shape</a>), <span class="extype" name="scala.Boolean">Boolean</span>]]</span>
      </span>
      </h4>
      <p class="shortcomment cmt">Array of collision detection methods</p><div class="fullcomment">
      <div class="comment cmt"><p>Array of collision detection methods. These methods return <code>true</code> if two shapes are colliding.</p></div>
      
      
      
      
    </div>
    </li><li name="scala.AnyRef#equals">
      <h4 class="signature">
      <span class="kind">def</span>
      <span class="symbol">
        <span class="name">equals</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
      </span>
      </h4>
      <p class="shortcomment cmt">This method is used to compare the receiver object (<code>this</code>)
with the argument object (<code>arg0</code>) for equivalence</p><div class="fullcomment">
      <div class="comment cmt"><p>This method is used to compare the receiver object (<code>this</code>)
with the argument object (<code>arg0</code>) for equivalence.</p><p><p>
The default implementations of this method is an <a
href="http://en.wikipedia.org/wiki/Equivalence_relation">equivalence
relation</a>:
  <ul>
 <li>It is reflexive: for any instance <code>x</code> of type <code>Any</code>,
 <code>x.equals(x)</code> should return <code>true</code>.</li>
 <li>It is symmetric: for any instances <code>x</code> and <code>y</code> of type
 <code>Any</code>, <code>x.equals(y)</code> should return <code>true</code> if and only
 if <code>y.equals(x)</code> returns <code>true</code>.</li>
 <li>It is transitive: for any instances
 <code>x</code>, <code>y</code>, and <code>z</code> of type <code>AnyRef</code>
 if <code>x.equals(y)</code> returns <code>true</code> and
 <code>y.equals(z)</code> returns
 <code>true</code>, then <code>x.equals(z)</code> should return <code>true</code>.</li>
</ul>
</p></p><p><p>
If you override this method, you should verify that
your implementation remains an equivalence relation.
Additionally, when overriding this method it is often necessary to
override <code>hashCode</code> to ensure that objects that are
"equal" (<code>o1.equals(o2)</code> returns <code>true</code>)
hash to the same <a href="Int.html"><code>Int</code></a>
(<code>o1.hashCode.equals(o2.hashCode)</code>).
</p></div>
      <dl class="paramcmts block"><dt class="param">arg0</dt><dd class="cmt"><p>the object to compare against this object for equality.</p></dd><dt>returns</dt><dd class="cmt"><p><code>true</code> if the receiver object is equivalent to the argument; <code>false</code> otherwise.
</p></p></dd></dl>
      
      <div class="block">
            definition classes: AnyRef ⇐ Any
          </div>
      
    </div>
    </li><li name="sims.collision.GridDetector#getPairs">
      <h4 class="signature">
      <span class="kind">def</span>
      <span class="symbol">
        <span class="name">getPairs</span><span class="result">: <span class="extype" name="scala.collection.Seq">Seq</span>[<a href="Pair.html" class="extype" name="sims.collision.Pair">Pair</a>]</span>
      </span>
      </h4>
      <p class="shortcomment cmt">Returns potential colliding pairs of shapes of the world <code>world</code></p><div class="fullcomment">
      <div class="comment cmt"><p>Returns potential colliding pairs of shapes of the world <code>world</code>.
<p>
A potential colliding pair is a pair of two shapes that comply with the following criteria:
<ul>
<li>The shapes are situated in the same grid cell.</li>
<li>Their AABBs overlap.</li>
<li>The shapes do not belong to the same body.</li>
<li>At least one shape is not fixed.</li>
<li>Both shapes are {@link dynamics.Shape#collidable}.</li>
</ul></p></div>
      
      
      
      
    </div>
    </li><li name="sims.collision.GridDetector#gridSide">
      <h4 class="signature">
      <span class="kind">var</span>
      <span class="symbol">
        <span class="name">gridSide</span><span class="result">: <span class="extype" name="scala.Double">Double</span></span>
      </span>
      </h4>
      <p class="shortcomment cmt">Width and height of a grid cell</p><div class="fullcomment">
      <div class="comment cmt"><p>Width and height of a grid cell.</p></div>
      
      
      
      
    </div>
    </li><li name="scala.AnyRef#hashCode">
      <h4 class="signature">
      <span class="kind">def</span>
      <span class="symbol">
        <span class="name">hashCode</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Int">Int</span></span>
      </span>
      </h4>
      <p class="shortcomment cmt">Returns a hash code value for the object</p><div class="fullcomment">
      <div class="comment cmt"><p>Returns a hash code value for the object.</p><p><p>
The default hashing algorithm is platform dependent.</p><p>Note that it is allowed for two objects to have identical hash
codes (<code>o1.hashCode.equals(o2.hashCode)</code>) yet not be
equal (<code>o1.equals(o2)</code> returns <code>false</code>).  A
degenerate implementation could always return <code>0</code>.
However, it is required that if two objects are equal
(<code>o1.equals(o2)</code> returns <code>true</code>) that they
have identical hash codes
(<code>o1.hashCode.equals(o2.hashCode)</code>).  Therefore, when
overriding this method, be sure to verify that the behavior is
consistent with the <code>equals</code> method.
</p></p><p><p></p></div>
      
      
      <div class="block">
            definition classes: AnyRef ⇐ Any
          </div>
      
    </div>
    </li><li name="sims.collision.GridDetector#pairs">
      <h4 class="signature">
      <span class="kind">def</span>
      <span class="symbol">
        <span class="name">pairs</span><span class="result">: <span class="extype" name="scala.collection.Seq">Seq</span>[<a href="Pair.html" class="extype" name="sims.collision.Pair">Pair</a>]</span>
      </span>
      </h4>
      <p class="shortcomment cmt">All potential colliding pairs of the world</p><div class="fullcomment">
      <div class="comment cmt"><p>All potential colliding pairs of the world.</p></div>
      
      
      
      
    </div>
    </li><li name="scala.AnyRef#toString">
      <h4 class="signature">
      <span class="kind">def</span>
      <span class="symbol">
        <span class="name">toString</span><span class="params">()</span><span class="result">: <span class="extype" name="java.lang.String">String</span></span>
      </span>
      </h4>
      <p class="shortcomment cmt">Returns a string representation of the object</p><div class="fullcomment">
      <div class="comment cmt"><p>Returns a string representation of the object.
<p>
The default representation is platform dependent.
</p></div>
      
      
      <div class="block">
            definition classes: AnyRef ⇐ Any
          </div>
      
    </div>
    </li><li name="sims.collision.GridDetector#world">
      <h4 class="signature">
      <span class="kind">val</span>
      <span class="symbol">
        <span class="name">world</span><span class="result">: <a href="../dynamics/World.html" class="extype" name="sims.dynamics.World">World</a></span>
      </span>
      </h4>
      <p class="shortcomment cmt">The world whose shapes are to be checked for collisions</p><div class="fullcomment">
      <div class="comment cmt"><p>The world whose shapes are to be checked for collisions.</p></div>
      
      
      
      
    </div>
    </li></ol>
            </div>
        
        <div class="members" id="constructors">
              <h3>Instance constructors</h3>
              <ol><li name="sims.collision.GridDetector#this">
      <h4 class="signature">
      <span class="kind">new</span>
      <span class="symbol">
        <span class="name">GridDetector</span><span class="params">(<span name="world">world: <a href="../dynamics/World.html" class="extype" name="sims.dynamics.World">World</a></span>)</span>
      </span>
      </h4>
      
    </li><li name="sims.collision.Detector#this">
      <h4 class="signature">
      <span class="kind">new</span>
      <span class="symbol">
        <span class="name">GridDetector</span><span class="params">()</span>
      </span>
      </h4>
      
    </li></ol>
            </div>
        
      </div>
      
    </body>
      </html>