|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object hermes.hshape.HShape hermes.hshape.HCircle
public class HCircle
Represents a circle.
Field Summary |
---|
Fields inherited from class hermes.hshape.HShape |
---|
_position |
Constructor Summary | |
---|---|
HCircle(PVector position,
float radius)
Constructor defining center of circle as position of object. |
|
HCircle(PVector position,
PVector center,
float radius)
Constructor defining center of circle to be a certain distance away from the position. |
Method Summary | |
---|---|
boolean |
contains(float x,
float y)
|
boolean |
contains(PVector point)
Whether the Shape contains the given point coordinates (boundary is inclusive). |
void |
draw()
Shortcut method for drawing the shape on screen |
HRectangle |
getBoundingBox()
Finds the smallest Rectangle that encloses the shape. |
PVector |
getCenter()
Getter for center |
float |
getRadius()
Getter for radius |
PVector |
projectionVector(HCircle other)
|
PVector |
projectionVector(HPolygon other)
|
PVector |
projectionVector(HRectangle other)
|
PVector |
projectionVector(HShape other)
Finds the projection vector for a collision with another shape. |
java.lang.String |
toString()
|
Methods inherited from class hermes.hshape.HShape |
---|
collide, getPosition |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public HCircle(PVector position, float radius)
position
- radius
- public HCircle(PVector position, PVector center, float radius)
position
- center
- radius
- Method Detail |
---|
public PVector getCenter()
public float getRadius()
public boolean contains(PVector point)
HShape
contains
in class HShape
point
- the point vector
public boolean contains(float x, float y)
contains
in class HShape
x
- the x coordinatey
- the y coordinate
public PVector projectionVector(HShape other)
HShape
The projection vector is the vector by which one body could be displaced such that it no longer intersects the other body, by the shortest possible distance.
Each shape must contain methods for collision with all other types of HShapes. If you create your own type of shape, you will have to modify HShape (as well as its subclasses) to contain methods colliding it with the new type.
projectionVector
in class HShape
other
- the shape to collide with
public PVector projectionVector(HPolygon other)
projectionVector
in class HShape
public PVector projectionVector(HCircle other)
projectionVector
in class HShape
public PVector projectionVector(HRectangle other)
projectionVector
in class HShape
public HRectangle getBoundingBox()
HShape
getBoundingBox
in class HShape
public void draw()
HShape
draw
in class HShape
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |