sim.physics2D.shape
Class Shape

java.lang.Object
  extended by sim.physics2D.shape.Shape
Direct Known Subclasses:
Circle, Polygon

public abstract class Shape
extends java.lang.Object

Each physical object has an associated shape. The type of shape associated with the object determines how it is displayed, when it is colliding with another object, and how its mass moment of inertia is calculated. Shape is an abstract class representing any shape that can be associated with a physical object


Field Summary
protected  int index
           
protected  java.awt.Paint paint
           
protected  boolean stationary
           
 
Constructor Summary
Shape()
           
Shape(boolean stationary)
           
 
Method Summary
abstract  void calcMaxDistances(boolean mobile)
          Calculate the max distance a point can be from the center of the object.
abstract  void draw(java.lang.Object object, java.awt.Graphics2D graphics, DrawInfo2D info)
           
abstract  double getMassMomentOfInertia(double mass)
          Return the mass moment of inertia of this shape
abstract  double getMaxXDistanceFromCenter()
           
abstract  double getMaxYDistanceFromCenter()
           
protected  Angle getOrientation()
           
 java.awt.Paint getPaint()
           
protected  Double2D getPosition()
           
 void setIndex(int index)
          Tells the shape the index of its associated physical object.
 void setPaint(java.awt.Paint paint)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

paint

protected java.awt.Paint paint

stationary

protected boolean stationary

index

protected int index
Constructor Detail

Shape

public Shape(boolean stationary)

Shape

public Shape()
Method Detail

draw

public abstract void draw(java.lang.Object object,
                          java.awt.Graphics2D graphics,
                          DrawInfo2D info)

getPosition

protected Double2D getPosition()

setIndex

public void setIndex(int index)
Tells the shape the index of its associated physical object. Used by shapes to get the object's pose from the state vector.


setPaint

public void setPaint(java.awt.Paint paint)

getPaint

public java.awt.Paint getPaint()

getOrientation

protected Angle getOrientation()

getMassMomentOfInertia

public abstract double getMassMomentOfInertia(double mass)
Return the mass moment of inertia of this shape


calcMaxDistances

public abstract void calcMaxDistances(boolean mobile)
Calculate the max distance a point can be from the center of the object. For polygons, this can be different if the object is moving (rotating). For circles, this is alway the same.


getMaxXDistanceFromCenter

public abstract double getMaxXDistanceFromCenter()

getMaxYDistanceFromCenter

public abstract double getMaxYDistanceFromCenter()