sim.physics2D.shape
Class Rectangle
java.lang.Object
sim.physics2D.shape.Shape
sim.physics2D.shape.Polygon
sim.physics2D.shape.Rectangle
public class Rectangle
- extends Polygon
Rectangle implementation of Polygon
Constructor Summary |
Rectangle(double width,
double height,
java.awt.Paint paint)
|
Rectangle(double width,
double height,
java.awt.Paint paint,
boolean stationary)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Rectangle
public Rectangle(double width,
double height,
java.awt.Paint paint)
Rectangle
public Rectangle(double width,
double height,
java.awt.Paint paint,
boolean stationary)
initVertices
public void initVertices()
- Set up the vertices matrix in homogenous coordinates
- Specified by:
initVertices
in class Polygon
initEdges
public void initEdges()
- Set up the edges matrix
- Specified by:
initEdges
in class Polygon
initNormals
public void initNormals()
- Set up the normals matrix
- Specified by:
initNormals
in class Polygon
getWidth
public double getWidth()
getHeight
public double getHeight()
calcMaxDistances
public void calcMaxDistances(boolean mobile)
- Calculate the max distance a point can be from the center of the object.
If the object is stationary, we can give more exact values. Remember
that stationary objects can have orientation, though, so it can be more
complicated than width / 2 and height / 2
- Specified by:
calcMaxDistances
in class Shape
getMassMomentOfInertia
public double getMassMomentOfInertia(double mass)
- Calculate the mass moment of intertia of the object.
This can be done through integration, or by finding a precomputed
equation for the polygon being defined
- Specified by:
getMassMomentOfInertia
in class Shape