|
Emini Physics Engine 1.3.5a API Documentation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.emini.physics2D.Landscape
public class Landscape
The Landscape class represents a collection of static bodies.
The bodies are represented as lines and do not have to be closed shapes.
They form a landscape for the physical simulation.
Using a landscape, large worlds can be created without shape overhead.
This is an efficient alternative to static bodies.
Each line segment consists of a starting point, an end point and a face.
The face of each segment can be right, left or none. This Indicates how the segment works.
FACE_NONE
: the segment is considered a line from both sidesFACE_LEFT
: the segment is considered to be the left border of a solid, always assuming colliding objects to come from left.FACE_RIGHT
: the segment is considered to be the right border of a solid, always assuming colliding objects to come from right.
Field Summary | |
---|---|
static short |
FACE_LEFT
Face type left. |
static short |
FACE_NONE
Face type none. |
static short |
FACE_RIGHT
Face type right. |
protected FXVector[] |
mEndpoints
End points of the segments. |
protected short[] |
mFaces
Faces of the segments. |
protected int |
mSegmentCount
Number of landscape segments. |
protected FXVector[] |
mStartpoints
Start points of the segments. |
Constructor Summary | |
---|---|
Landscape()
Default Constructor. |
|
Landscape(Landscape other)
Copy constructor. |
Method Summary | |
---|---|
protected void |
addContact(Contact c)
Adds a new contact. |
void |
addSegment(FXVector start,
FXVector end,
short face)
Adds a segment to the landscape. |
void |
collideParticles(ParticleEmitter particles)
|
protected void |
collisionCheckBody(World world,
Body body)
Checks collision of the landscape and a body. |
Landscape |
copy()
Copy method. |
FXVector[] |
elementEndPoints()
Gets the end points of the segments. |
FXVector[] |
elementStartPoints()
Gets the starting points of the segments. |
FXVector |
endPoint(int index)
Gets the end vector of a segment. |
void |
fillVertices(FXVector[] vertices,
Contact c,
int idx)
|
Body |
getBody()
Gets the dummy body. |
protected Contact |
getContact(Body body,
int bodyIndex,
int index)
Finds a contact of a segment with a body. |
Contact[] |
getContacts()
Gets all current contacts. |
Shape |
getShape()
Gets the shape. |
protected void |
initCollision()
Initializes the collision process. |
static Landscape |
loadLandscape(PhysicsFileReader reader)
Load a landscape from a stream. |
void |
removeSegment(int index)
Removes a segment from the landscape. |
protected void |
resetContacts()
Clears all contacts from the previous step. |
int |
segmentCount()
Gets the number of landscape segments. |
protected void |
sortArrays()
Sorts the segment arrays. |
FXVector |
startPoint(int index)
Gets the start vector of a segment. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int mSegmentCount
protected FXVector[] mStartpoints
protected FXVector[] mEndpoints
protected short[] mFaces
public static final short FACE_NONE
public static final short FACE_LEFT
public static final short FACE_RIGHT
Constructor Detail |
---|
public Landscape()
public Landscape(Landscape other)
other
- copy sourceMethod Detail |
---|
public static Landscape loadLandscape(PhysicsFileReader reader)
reader
- the physics reader
public Landscape copy()
public void addSegment(FXVector start, FXVector end, short face)
start
- start point of the segment lineend
- end point of the segment lineface
- the face directionpublic void removeSegment(int index)
index
- index of teh segmentprotected final void sortArrays()
protected final void initCollision()
protected final void collisionCheckBody(World world, Body body)
initCollision()
method should be called first.
body
- the body to check for collision with landscapeprotected void resetContacts()
protected void addContact(Contact c)
c
- the determined contact.public Contact[] getContacts()
public final void fillVertices(FXVector[] vertices, Contact c, int idx)
protected Contact getContact(Body body, int bodyIndex, int index)
body
- the body.index
- the index of the involved body segment.
public void collideParticles(ParticleEmitter particles)
public Body getBody()
public Shape getShape()
public int segmentCount()
public FXVector[] elementStartPoints()
segmentCount()
).
public FXVector[] elementEndPoints()
segmentCount()
public FXVector startPoint(int index)
index
- the index of the segment.
public FXVector endPoint(int index)
index
- the index of the segment.
|
Emini Physics Engine 1.3.5a API Documentation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |