sim.physics2D.shape
Class Shape
java.lang.Object
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
Constructor Summary |
Shape()
|
Shape(boolean stationary)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
paint
protected java.awt.Paint paint
stationary
protected boolean stationary
index
protected int index
Shape
public Shape(boolean stationary)
Shape
public Shape()
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()