blob: 858116a061fd6914a83529d68431fa2da30d2b60 (
plain) (
tree)
|
|
<?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.dynamics.Body</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">dynamics</a></p>
<div id="definition">
<img src="../../lib/class_big.png" />
<h1>Body</h1>
</div>
<h4 class="signature">
<span class="kind">class</span>
<span class="symbol">
<span class="name">Body</span><span class="result"> extends AnyRef</span>
</span>
</h4>
<div class="fullcomment" id="comment">
<div class="comment cmt"><p>A two dimensional rigid body is made out of shapes.</p></div>
</div>
<div id="template">
<div id="mbrsel">
<div id="ancestors">
<h3>Inherits</h3>
<ol><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.dynamics.Body#I">
<h4 class="signature">
<span class="kind">def</span>
<span class="symbol">
<span class="name">I</span><span class="result">: <span class="extype" name="scala.Double">Double</span></span>
</span>
</h4>
<p class="shortcomment cmt">Returns the moment of inertia for rotations about the COM of this body</p><div class="fullcomment">
<div class="comment cmt"><p>Returns the moment of inertia for rotations about the COM of this body.
It is calculated using the moments of inertia of this body's shapes and the parallel axis theorem.
If the body is fixed, its moment of inertia is infinite (<code>Double.PositiveInfinity</code>).</p></div>
</div>
</li><li name="sims.dynamics.Body#angularVelocity">
<h4 class="signature">
<span class="kind">var</span>
<span class="symbol">
<span class="name">angularVelocity</span><span class="result">: <span class="extype" name="scala.Double">Double</span></span>
</span>
</h4>
<p class="shortcomment cmt">Angular velocity of this body</p><div class="fullcomment">
<div class="comment cmt"><p>Angular velocity of this body.</p></div>
</div>
</li><li name="sims.dynamics.Body#applyForce">
<h4 class="signature">
<span class="kind">def</span>
<span class="symbol">
<span class="name">applyForce</span><span class="params">(<span name="force">force: <a href="../geometry/Vector2D.html" class="extype" name="sims.geometry.Vector2D">Vector2D</a></span>, <span name="point">point: <a href="../geometry/Vector2D.html" class="extype" name="sims.geometry.Vector2D">Vector2D</a></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<p class="shortcomment cmt">Applies a force to a point on this body</p><div class="fullcomment">
<div class="comment cmt"><p>Applies a force to a point on this body. Warning: the point is considered to be contained within this body.</p></div>
<dl class="paramcmts block"><dt class="param">force</dt><dd class="cmt"><p>applied force</p></dd><dt class="param">point</dt><dd class="cmt"><p>position vector of the point (in world coordinates)</p></dd></dl>
</div>
</li><li name="sims.dynamics.Body#applyForce">
<h4 class="signature">
<span class="kind">def</span>
<span class="symbol">
<span class="name">applyForce</span><span class="params">(<span name="force">force: <a href="../geometry/Vector2D.html" class="extype" name="sims.geometry.Vector2D">Vector2D</a></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<p class="shortcomment cmt">Applies a force to the COM of this body</p><div class="fullcomment">
<div class="comment cmt"><p>Applies a force to the COM of this body.</p></div>
<dl class="paramcmts block"><dt class="param">force</dt><dd class="cmt"><p>applied force</p></dd></dl>
</div>
</li><li name="sims.dynamics.Body#applyImpulse">
<h4 class="signature">
<span class="kind">def</span>
<span class="symbol">
<span class="name">applyImpulse</span><span class="params">(<span name="impulse">impulse: <a href="../geometry/Vector2D.html" class="extype" name="sims.geometry.Vector2D">Vector2D</a></span>, <span name="point">point: <a href="../geometry/Vector2D.html" class="extype" name="sims.geometry.Vector2D">Vector2D</a></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<p class="shortcomment cmt">Applies an impulse to a point on this body</p><div class="fullcomment">
<div class="comment cmt"><p>Applies an impulse to a point on this body. Warning: the point is considered to be contained within this body.</p></div>
<dl class="paramcmts block"><dt class="param">impulse</dt><dd class="cmt"><p>applied impulse</p></dd><dt class="param">point</dt><dd class="cmt"><p>position vector of the point (in world coordinates)</p></dd></dl>
</div>
</li><li name="sims.dynamics.Body#applyImpulse">
<h4 class="signature">
<span class="kind">def</span>
<span class="symbol">
<span class="name">applyImpulse</span><span class="params">(<span name="impulse">impulse: <a href="../geometry/Vector2D.html" class="extype" name="sims.geometry.Vector2D">Vector2D</a></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<p class="shortcomment cmt">Applies an impulse to the COM of this body</p><div class="fullcomment">
<div class="comment cmt"><p>Applies an impulse to the COM of this body.</p></div>
<dl class="paramcmts block"><dt class="param">impulse</dt><dd class="cmt"><p>applied impulse</p></dd></dl>
</div>
</li><li name="sims.dynamics.Body#contains">
<h4 class="signature">
<span class="kind">def</span>
<span class="symbol">
<span class="name">contains</span><span class="params">(<span name="point">point: <a href="../geometry/Vector2D.html" class="extype" name="sims.geometry.Vector2D">Vector2D</a></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<p class="shortcomment cmt">Checks if the point <code>point</code> is contained in this body</p><div class="fullcomment">
<div class="comment cmt"><p>Checks if the point <code>point</code> is contained in this body.</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.dynamics.Body#fixed">
<h4 class="signature">
<span class="kind">def</span>
<span class="symbol">
<span class="name">fixed</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<p class="shortcomment cmt">Returns whether this body is fixed or not</p><div class="fullcomment">
<div class="comment cmt"><p>Returns whether this body is fixed or not.</p></div>
</div>
</li><li name="sims.dynamics.Body#fixed_=">
<h4 class="signature">
<span class="kind">def</span>
<span class="symbol">
<span class="name">fixed_=</span><span class="params">(<span name="value">value: <span class="extype" name="scala.Boolean">Boolean</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<p class="shortcomment cmt">Fixes or frees this body</p><div class="fullcomment">
<div class="comment cmt"><p>Fixes or frees this body. By fixing, linear and angular velocities are set to zero.</p></div>
</div>
</li><li name="sims.dynamics.Body#force">
<h4 class="signature">
<span class="kind">var</span>
<span class="symbol">
<span class="name">force</span><span class="result">: <a href="../geometry/Vector2D.html" class="extype" name="sims.geometry.Vector2D">Vector2D</a></span>
</span>
</h4>
<p class="shortcomment cmt">Resulting force on the COM of this body</p><div class="fullcomment">
<div class="comment cmt"><p>Resulting force on the COM of this body.</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.dynamics.Body#linearVelocity">
<h4 class="signature">
<span class="kind">var</span>
<span class="symbol">
<span class="name">linearVelocity</span><span class="result">: <a href="../geometry/Vector2D.html" class="extype" name="sims.geometry.Vector2D">Vector2D</a></span>
</span>
</h4>
<p class="shortcomment cmt">Linear velocity of this body</p><div class="fullcomment">
<div class="comment cmt"><p>Linear velocity of this body.</p></div>
</div>
</li><li name="sims.dynamics.Body#mass">
<h4 class="signature">
<span class="kind">def</span>
<span class="symbol">
<span class="name">mass</span><span class="result">: <span class="extype" name="scala.Double">Double</span></span>
</span>
</h4>
<p class="shortcomment cmt">Returns the mass of this body</p><div class="fullcomment">
<div class="comment cmt"><p>Returns the mass of this body. If the body is free, its mass is the sum of the masses of its shapes.
If the body is fixed, its mass is infinite (<code>Double.PositiveInfinity</code>).</p></div>
</div>
</li><li name="sims.dynamics.Body#monitor">
<h4 class="signature">
<span class="kind">var</span>
<span class="symbol">
<span class="name">monitor</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<p class="shortcomment cmt">Flag for a world to monitor the properties of this body</p><div class="fullcomment">
<div class="comment cmt"><p>Flag for a world to monitor the properties of this body.</p></div>
</div>
</li><li name="sims.dynamics.Body#pos">
<h4 class="signature">
<span class="kind">def</span>
<span class="symbol">
<span class="name">pos</span><span class="result">: <a href="../geometry/Vector2D.html" class="extype" name="sims.geometry.Vector2D">Vector2D</a></span>
</span>
</h4>
<p class="shortcomment cmt">Returns the position of this body</p><div class="fullcomment">
<div class="comment cmt"><p>Returns the position of this body. The position is equivalent to the center of mass.</p></div>
</div>
</li><li name="sims.dynamics.Body#pos_=">
<h4 class="signature">
<span class="kind">def</span>
<span class="symbol">
<span class="name">pos_=</span><span class="params">(<span name="newPos">newPos: <a href="../geometry/Vector2D.html" class="extype" name="sims.geometry.Vector2D">Vector2D</a></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<p class="shortcomment cmt">Sets the position of this body</p><div class="fullcomment">
<div class="comment cmt"><p>Sets the position of this body. By doing so all its shapes are translated.</p></div>
<dl class="paramcmts block"><dt class="param">newPos</dt><dd class="cmt"><p>new position</p></dd></dl>
</div>
</li><li name="sims.dynamics.Body#rotation">
<h4 class="signature">
<span class="kind">def</span>
<span class="symbol">
<span class="name">rotation</span><span class="result">: <span class="extype" name="scala.Double">Double</span></span>
</span>
</h4>
<p class="shortcomment cmt">Returns the current rotation of this body</p><div class="fullcomment">
<div class="comment cmt"><p>Returns the current rotation of this body.</p></div>
</div>
</li><li name="sims.dynamics.Body#rotation_=">
<h4 class="signature">
<span class="kind">def</span>
<span class="symbol">
<span class="name">rotation_=</span><span class="params">(<span name="newRotation">newRotation: <span class="extype" name="scala.Double">Double</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<p class="shortcomment cmt">Sets the rotation of this body</p><div class="fullcomment">
<div class="comment cmt"><p>Sets the rotation of this body. Position and rotation of shapes are modified accordingly.</p></div>
</div>
</li><li name="sims.dynamics.Body#shapes">
<h4 class="signature">
<span class="kind">val</span>
<span class="symbol">
<span class="name">shapes</span><span class="result">: <span class="extype" name="scala.collection.immutable.List">List</span>[<a href="Shape.html" class="extype" name="sims.dynamics.Shape">Shape</a>]</span>
</span>
</h4>
<p class="shortcomment cmt">Shapes that belong to this body</p><div class="fullcomment">
<div class="comment cmt"><p>Shapes that belong to this body.</p></div>
</div>
</li><li name="sims.dynamics.Body#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>
</li><li name="sims.dynamics.Body#torque">
<h4 class="signature">
<span class="kind">var</span>
<span class="symbol">
<span class="name">torque</span><span class="result">: <span class="extype" name="scala.Double">Double</span></span>
</span>
</h4>
<p class="shortcomment cmt">Resulting torque on this body</p><div class="fullcomment">
<div class="comment cmt"><p>Resulting torque on this body.</p></div>
</div>
</li><li name="sims.dynamics.Body#uid">
<h4 class="signature">
<span class="kind">val</span>
<span class="symbol">
<span class="name">uid</span><span class="result">: <span class="extype" name="scala.Int">Int</span></span>
</span>
</h4>
<p class="shortcomment cmt">Unique identification number</p><div class="fullcomment">
<div class="comment cmt"><p>Unique identification number.</p></div>
</div>
</li><li name="sims.dynamics.Body#velocityOfPoint">
<h4 class="signature">
<span class="kind">def</span>
<span class="symbol">
<span class="name">velocityOfPoint</span><span class="params">(<span name="point">point: <a href="../geometry/Vector2D.html" class="extype" name="sims.geometry.Vector2D">Vector2D</a></span>)</span><span class="result">: <a href="../geometry/Vector2D.html" class="extype" name="sims.geometry.Vector2D">Vector2D</a></span>
</span>
</h4>
<p class="shortcomment cmt">Linear velocity of the given point on this body (in world coordinates)</p><div class="fullcomment">
<div class="comment cmt"><p>Linear velocity of the given point on this body (in world coordinates).</p></div>
</div>
</li><li name="sims.dynamics.Body#~">
<h4 class="signature">
<span class="kind">def</span>
<span class="symbol">
<span class="name">~</span><span class="params">(<span name="b">b: <a href="" class="extype" name="sims.dynamics.Body">Body</a></span>)</span><span class="result">: <a href="" class="extype" name="sims.dynamics.Body">Body</a></span>
</span>
</h4>
<p class="shortcomment cmt">Creates a new body containing this body's shapes and the shapes of another body <code>b</code></p><div class="fullcomment">
<div class="comment cmt"><p>Creates a new body containing this body's shapes and the shapes of another body <code>b</code>.</p></div>
<dl class="paramcmts block"><dt class="param">b</dt><dd class="cmt"><p>body with extra shapes</p></dd><dt>returns</dt><dd class="cmt"><p>new body</p></dd></dl>
</div>
</li><li name="sims.dynamics.Body#~">
<h4 class="signature">
<span class="kind">def</span>
<span class="symbol">
<span class="name">~</span><span class="params">(<span name="s">s: <a href="Shape.html" class="extype" name="sims.dynamics.Shape">Shape</a></span>)</span><span class="result">: <a href="" class="extype" name="sims.dynamics.Body">Body</a></span>
</span>
</h4>
<p class="shortcomment cmt">Creates a new body containing this body's shapes and the shape <code>s</code></p><div class="fullcomment">
<div class="comment cmt"><p>Creates a new body containing this body's shapes and the shape <code>s</code>.</p></div>
<dl class="paramcmts block"><dt class="param">s</dt><dd class="cmt"><p>new shape</p></dd><dt>returns</dt><dd class="cmt"><p>new body</p></dd></dl>
</div>
</li></ol>
</div>
<div class="members" id="constructors">
<h3>Instance constructors</h3>
<ol><li name="sims.dynamics.Body#this">
<h4 class="signature">
<span class="kind">new</span>
<span class="symbol">
<span class="name">Body</span><span class="params">(<span name="shps">shps: <a href="Shape.html" class="extype" name="sims.dynamics.Shape">Shape</a>*</span>)</span>
</span>
</h4>
</li><li name="scala.AnyRef#this">
<h4 class="signature">
<span class="kind">new</span>
<span class="symbol">
<span class="name">Body</span><span class="params">()</span>
</span>
</h4>
</li></ol>
</div>
</div>
</body>
</html>
|