|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcrystalspace.jbind.impl.csNativeObject
crystalspace.jbind.impl.csgeom.poly2d.csPoly2D
The following class represents a general 2D polygon with a bounding box.
| Field Summary |
| Fields inherited from class crystalspace.jbind.impl.csNativeObject |
ImplFactory, nPointer |
| Constructor Summary | |
csPoly2D()
Make a new empty polygon. |
|
csPoly2D(csPoly2D copy)
Copy constructor. |
|
csPoly2D(int start_size)
Make a new empty polygon. |
|
csPoly2D(iPointer nPointer)
|
|
| Method Summary | |
int |
addVertex(csVector2 v)
Add a vertex (2D) to the polygon. |
int |
addVertex(float x,
float y)
Add a vertex (2D) to the polygon. |
boolean |
clipAgainst(iClipper2D view)
Clipping routines. |
void |
clipPlane(csPlane2 plane,
csPoly2D right)
This routine is similar to Intersect but it only returns the polygon on the 'right' (positive) side of the plane. |
void |
extendConvex(csPoly2D other,
int this_edge)
Extend this polygon with another polygon so that the resulting polygon is: (a) still convex, (b) fully contains this polygon, and (c) contains as much as possible of the other polgon. |
csBox2 |
getBoundingBox()
Get the bounding box (in 2D space) for this polygon. |
csVector2 |
getFirst()
Get the first vertex. |
csVector2 |
getLast()
Get the last vertex. |
float |
getSignedArea()
Calculate the signed area of this polygon. |
csVector2 |
getVertex(int i)
Get the specified vertex. |
int |
getVertexCount()
Get the number of vertices. |
csVector2Array |
getVertices()
Get the array with all vertices. |
boolean |
in(csVector2 v)
Test if this vector is inside the polygon. |
static boolean |
in(csVector2Array poly,
csVector2 v)
Test if a vector is inside the given polygon. |
void |
intersect(csPlane2 plane,
csPoly2D left,
csPoly2D right)
Intersect this polygon with a given plane and return the two resulting polygons in left and right. |
protected boolean |
isNativePointerValidSafe(long nPointer)
|
csVector2 |
item(int i)
Get the specified vertex. |
void |
makeEmpty()
Initialize the polygon to empty. |
void |
makeRoom(int new_max)
Make room for at least the specified number of vertices. |
protected void |
nDelete(long pointer)
|
void |
random(int num,
csBox2 max_bbox)
Generate a random convex polygon with the specified number of vertices. |
csPoly2D |
set(csPoly2D other)
Assignment operator. |
void |
setVertexCount(int n)
Set the number of vertices. |
void |
setVertices(csVector2Array v)
Set all polygon vertices at once. |
void |
updateBoundingBox()
Update the bounding box (useful after SetVertices). |
| Methods inherited from class crystalspace.jbind.impl.csNativeObject |
changePointer, equals, finalize, getPointer, getPointer, getPointerArray, hashCode, isMemoryOwner, isNativePointerValid, newNativeObject, setMemoryOwner, toString |
| Methods inherited from class java.lang.Object |
clone, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public csPoly2D(iPointer nPointer)
nPointer - public csPoly2D()
public csPoly2D(int start_size)
start_size - public csPoly2D(csPoly2D copy)
copy - | Method Detail |
protected void nDelete(long pointer)
nDelete in class csNativeObjectcsNativeObject.nDelete(long)protected boolean isNativePointerValidSafe(long nPointer)
isNativePointerValidSafe in class csNativeObjectcrystalspace.jbind.impl.csNativeObject#isNativePointerValidSafe()
public int addVertex(float x,
float y)
x - y -
public int addVertex(csVector2 v)
v -
public boolean clipAgainst(iClipper2D view)
view -
public void clipPlane(csPlane2 plane,
csPoly2D right)
plane - right -
public void extendConvex(csPoly2D other,
int this_edge)
other - this_edge - public csBox2 getBoundingBox()
public csVector2 getFirst()
public csVector2 getLast()
public float getSignedArea()
public csVector2 getVertex(int i)
i -
public int getVertexCount()
public csVector2Array getVertices()
public static boolean in(csVector2Array poly,
csVector2 v)
poly - v -
public boolean in(csVector2 v)
v -
public void intersect(csPlane2 plane,
csPoly2D left,
csPoly2D right)
plane - left - right - public void makeEmpty()
public void makeRoom(int new_max)
new_max - public csPoly2D set(csPoly2D other)
other -
public csVector2 item(int i)
i -
public void random(int num,
csBox2 max_bbox)
num - max_bbox - public void setVertexCount(int n)
n - public void setVertices(csVector2Array v)
v - public void updateBoundingBox()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||