|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsim.physics2D.shape.Shape
sim.physics2D.shape.Polygon
public abstract class Polygon
Polygons represents any convex multi-sided object. Convex means that every angle measured between the insides of two edges must be less than 180 degrees. To create a new polygon, create a new class that inherits from polygon and implement the abstract functions based on the descriptions given below. Use rectangle as a reference.
Field Summary | |
---|---|
protected DenseMatrix |
edges
|
protected double |
maxXDistanceFromCenter
|
protected double |
maxYDistanceFromCenter
|
protected DenseMatrix |
normals
|
protected DenseMatrix |
scale
|
protected DenseMatrix |
vertices
|
Fields inherited from class sim.physics2D.shape.Shape |
---|
index, paint, stationary |
Constructor Summary | |
---|---|
Polygon()
|
|
Polygon(boolean stationary)
|
Method Summary | |
---|---|
void |
draw(java.lang.Object object,
java.awt.Graphics2D graphics,
DrawInfo2D info)
Display the polygon |
Double2D[] |
getEdges()
Returns a list of the normalized edges in a clockwise direction. |
double |
getMaxXDistanceFromCenter()
|
double |
getMaxYDistanceFromCenter()
|
Double2D[] |
getNormals()
Returns a list of the unit normals in a clockwise direction. |
static int[] |
getRow(int row,
DenseMatrix mat)
Returns a row of the DenseMatrix rounded to integers |
Double2D[] |
getVertices()
Returns a list of the vertexes in a clockwise direction with positive Y pointing up (vs. |
abstract void |
initEdges()
Set up the edges DenseMatrix. |
abstract void |
initNormals()
Set up the normals DenseMatrix. |
abstract void |
initVertices()
Set up the vertices DenseMatrix. |
static DenseMatrix |
rotationMatrix2D(double theta)
Returns a DenseMatrix in homogenous coordinates to rotate a 2 dimensional rigid body given the angle theta (in radians) |
static DenseMatrix |
rotationTranslationMatrix2D(double theta,
Double2D translation)
Returns a DenseMatrix in homogenous coordinates to rotate and translate a 2 dimensional rigid body given the angle theta (in radians) and a translation vector |
Methods inherited from class sim.physics2D.shape.Shape |
---|
calcMaxDistances, getMassMomentOfInertia, getOrientation, getPaint, getPosition, setIndex, setPaint |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected double maxXDistanceFromCenter
protected double maxYDistanceFromCenter
protected DenseMatrix vertices
protected DenseMatrix edges
protected DenseMatrix normals
protected DenseMatrix scale
Constructor Detail |
---|
public Polygon(boolean stationary)
public Polygon()
Method Detail |
---|
public Double2D[] getVertices()
public Double2D[] getEdges()
public Double2D[] getNormals()
public abstract void initVertices()
public abstract void initEdges()
public abstract void initNormals()
public void draw(java.lang.Object object, java.awt.Graphics2D graphics, DrawInfo2D info)
draw
in class Shape
public double getMaxXDistanceFromCenter()
getMaxXDistanceFromCenter
in class Shape
public double getMaxYDistanceFromCenter()
getMaxYDistanceFromCenter
in class Shape
public static DenseMatrix rotationMatrix2D(double theta)
public static DenseMatrix rotationTranslationMatrix2D(double theta, Double2D translation)
public static int[] getRow(int row, DenseMatrix mat)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |