|
|||||||||||
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.box.csBox2
A bounding box in 2D space. In order to operate correctly, this bounding box assumes that all values entered or compared against lie within the range (-CS_BOUNDINGBOX_MAXVALUE, CS_BOUNDINGBOX_MAXVALUE). It is not recommended to use points outside of this range.
Field Summary |
Fields inherited from class crystalspace.jbind.impl.csNativeObject |
ImplFactory, nPointer |
Constructor Summary | |
csBox2()
Initialize this box to empty. |
|
csBox2(csVector2 v)
Initialize this box with one point. |
|
csBox2(float x1,
float y1,
float x2,
float y2)
Initialize this box with the given values. |
|
csBox2(iPointer nPointer)
|
Method Summary | |
csBox2 |
add(csBox2 box)
Compute the union of two bounding boxes. |
static csBox2 |
add(csBox2 box1,
csBox2 box2)
Compute the union of two bounding boxes. |
static csBox2 |
add(csBox2 box,
csVector2 point)
Compute the union of a bounding box and a point. |
csBox2 |
add(csVector2 point)
Compute the union of a point with this bounding box. |
void |
addBoundingVertex(csVector2 v)
Add a new vertex and recalculate the bounding box. |
void |
addBoundingVertex(float x,
float y)
Add a new vertex and recalculate the bounding box. |
void |
addBoundingVertexSmart(csVector2 v)
Add a new vertex and recalculate the bounding box. |
void |
addBoundingVertexSmart(float x,
float y)
Add a new vertex and recalculate the bounding box. |
boolean |
contains(csBox2 box)
Test if this box contains the other box. |
boolean |
empty()
Test if this box is empty. |
static boolean |
equals(csBox2 box1,
csBox2 box2)
Tests if two bounding boxes are equal. |
csVector2 |
getCenter()
Get the center of this box. |
csVector2 |
getCorner(int corner)
Return every corner of this bounding box from 0 to 3. |
csSegment2 |
getEdge(int edge)
Return every edge (segment); of this bounding box from 0 to 7 (CS_BOX_EDGE_xy_Xy etc.);. |
void |
getEdge(int edge,
csSegment2 e)
Return every edge (segment); of this bounding box from 0 to 7 (CS_BOX_EDGE_xy_Xy etc.);. |
int[] |
getEdgeInfo(int edge)
Given an edge index (CS_BOX_EDGE_xy_Xy etc.); return the two vertices (index CS_BOX_CORNER_xy etc.);. |
static boolean |
greater(csBox2 box1,
csBox2 box2)
Tests if box1 is a superset of box2. |
boolean |
in(csVector2 v)
Test if the given coordinate is in this box. |
boolean |
in(float x,
float y)
Test if the given coordinate is in this box. |
boolean |
intersect(csVector2Array poly)
Test if a polygon if visible in the box. |
boolean |
intersect(csVector2 minbox,
csVector2 maxbox,
csVector2Array poly)
Test if a polygon if visible in the box. |
boolean |
intersect(float minx,
float miny,
float maxx,
float maxy,
csVector2Array poly)
Test if a polygon if visible in the box. |
protected boolean |
isNativePointerValidSafe(long nPointer)
|
static boolean |
less(csBox2 box1,
csBox2 box2)
Tests if box1 is a subset of box2. |
static boolean |
less(csVector2 point,
csBox2 box)
Tests if a point is contained in a box. |
csVector2 |
max()
Get the 2d vector of maximum (x, y); values. |
float |
max(int idx)
Get Max component for 0 (x); or 1 (y);. |
float |
maxX()
Get the maximum X value of the box. |
float |
maxY()
Get the maximum Y value of the box. |
csVector2 |
min()
Get the 2d vector of minimum (x, y); values. |
float |
min(int idx)
Get Min component for 0 (x); or 1 (y);. |
float |
minX()
Get the minimum X value of the box. |
float |
minY()
Get the minimum Y value of the box. |
csBox2 |
mul(csBox2 box)
Compute the intersection of two bounding boxes. |
static csBox2 |
mul(csBox2 box1,
csBox2 box2)
Compute the intersection of two bounding boxes. |
protected void |
nDelete(long pointer)
|
static boolean |
nEquals(csBox2 box1,
csBox2 box2)
Tests if two bounding boxes are unequal. |
boolean |
overlap(csBox2 box)
Test if this box overlaps with the given box. |
void |
set(csVector2 bmin,
csVector2 bmax)
Sets the bounds of the box with the given values. |
void |
set(float x1,
float y1,
float x2,
float y2)
Sets the bounds of the box with the given values. |
void |
setCenter(csVector2 c)
Set the center of this box. |
void |
setMax(int idx,
float val)
Set Max component for 0 (x); or 1 (y);. |
void |
setMin(int idx,
float val)
Set Min component for 0 (x); or 1 (y);. |
void |
setSize(csVector2 s)
Set the size of the box but keep the center intact. |
float |
squaredOriginDist()
Calculate the squared distance between (0,0); and the box This routine is extremely efficient. |
float |
squaredOriginMaxDist()
Calculate the squared distance between (0,0); and the point on the box which is furthest away from (0,0);. |
void |
startBoundingBox()
Initialize this box to empty. |
void |
startBoundingBox(csVector2 v)
Initialize this box to one vertex. |
void |
startBoundingBox(float x,
float y)
Same but given some coordinates. |
boolean |
testIntersect(csBox2 box)
Test if the two boxes have an intersection. |
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 csBox2(iPointer nPointer)
nPointer
- public csBox2()
public csBox2(csVector2 v)
v
- public csBox2(float x1, float y1, float x2, float y2)
x1
- y1
- x2
- y2
- Method Detail |
protected void nDelete(long pointer)
nDelete
in class csNativeObject
csNativeObject.nDelete(long)
protected boolean isNativePointerValidSafe(long nPointer)
isNativePointerValidSafe
in class csNativeObject
crystalspace.jbind.impl.csNativeObject#isNativePointerValidSafe()
public final void addBoundingVertex(csVector2 v)
v
- public final void addBoundingVertex(float x, float y)
x
- y
- public final void addBoundingVertexSmart(csVector2 v)
v
- public final void addBoundingVertexSmart(float x, float y)
x
- y
- public final boolean contains(csBox2 box)
box
-
public final boolean empty()
public final csVector2 getCenter()
public final csVector2 getCorner(int corner)
corner
-
public final void getEdge(int edge, csSegment2 e)
edge
- e
- public final csSegment2 getEdge(int edge)
edge
-
public final int[] getEdgeInfo(int edge)
edge
-
public final boolean in(csVector2 v)
v
-
public final boolean in(float x, float y)
x
- y
-
public final boolean intersect(csVector2Array poly)
poly
-
public final boolean intersect(csVector2 minbox, csVector2 maxbox, csVector2Array poly)
minbox
- maxbox
- poly
-
public final boolean intersect(float minx, float miny, float maxx, float maxy, csVector2Array poly)
minx
- miny
- maxx
- maxy
- poly
-
public final csVector2 max()
public final float max(int idx)
idx
-
public final float maxX()
public final float maxY()
public final csVector2 min()
public final float min(int idx)
idx
-
public final float minX()
public final float minY()
public final csBox2 mul(csBox2 box)
box
-
public final csBox2 add(csVector2 point)
point
-
public final csBox2 add(csBox2 box)
box
-
public final boolean overlap(csBox2 box)
box
-
public final void set(float x1, float y1, float x2, float y2)
x1
- y1
- x2
- y2
- public final void set(csVector2 bmin, csVector2 bmax)
bmin
- bmax
- public final void setCenter(csVector2 c)
c
- public final void setMax(int idx, float val)
idx
- val
- public final void setMin(int idx, float val)
idx
- val
- public final void setSize(csVector2 s)
s
- public final float squaredOriginDist()
public final float squaredOriginMaxDist()
public final void startBoundingBox(float x, float y)
x
- y
- public final void startBoundingBox(csVector2 v)
v
- public final void startBoundingBox()
public final boolean testIntersect(csBox2 box)
box
-
public static final csBox2 mul(csBox2 box1, csBox2 box2)
box1
- box2
-
public static final boolean nEquals(csBox2 box1, csBox2 box2)
box1
- box2
-
public static final csBox2 add(csBox2 box, csVector2 point)
box
- point
-
public static final csBox2 add(csBox2 box1, csBox2 box2)
box1
- box2
-
public static final boolean less(csVector2 point, csBox2 box)
point
- box
-
public static final boolean less(csBox2 box1, csBox2 box2)
box1
- box2
-
public static final boolean equals(csBox2 box1, csBox2 box2)
box1
- box2
-
public static final boolean greater(csBox2 box1, csBox2 box2)
box1
- box2
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |