|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoxi.geom.Vec3D
toxi.geom.AABB
public class AABB
Axis-aligned bounding box with basic intersection features for Ray, AABB and Sphere classes.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class toxi.geom.Vec3D |
---|
Vec3D.Axis |
Field Summary |
---|
Fields inherited from class toxi.geom.Vec3D |
---|
MAX_VALUE, MIN_VALUE, x, X_AXIS, y, Y_AXIS, z, Z_AXIS, ZERO |
Constructor Summary | |
---|---|
AABB()
|
|
AABB(AABB box)
Creates an independent copy of the passed in box |
|
AABB(float extent)
Creates a new box of the given size at the world origin. |
|
AABB(ReadonlyVec3D pos,
float extent)
Creates a new instance from centre point and uniform extent in all directions. |
|
AABB(ReadonlyVec3D pos,
ReadonlyVec3D extent)
Creates a new instance from centre point and extent |
Method Summary | |
---|---|
boolean |
containsPoint(ReadonlyVec3D p)
Checks if the point is within the given shape/volume. |
AABB |
copy()
Copy. |
static AABB |
fromMinMax(Vec3D min,
Vec3D max)
Creates a new instance from two vectors specifying opposite corners of the box |
Vec3D |
getExtent()
Returns the current box size as new Vec3D instance (updating this vector will NOT update the box size! Use setExtent(ReadonlyVec3D) for
those purposes) |
Vec3D |
getMax()
|
Vec3D |
getMin()
|
Vec3D |
getNormalForPoint(ReadonlyVec3D p)
|
AABB |
includePoint(ReadonlyVec3D p)
Adjusts the box size and position such that it includes the given point. |
boolean |
intersectsBox(AABB box)
Checks if the box intersects the passed in one. |
Vec3D |
intersectsRay(Ray3D ray,
float minDist,
float maxDist)
Calculates intersection with the given ray between a certain distance interval. |
boolean |
intersectsSphere(Sphere s)
|
boolean |
intersectsSphere(Vec3D c,
float r)
|
boolean |
intersectsTriangle(Triangle3D tri)
|
AABB |
set(AABB box)
|
Vec3D |
set(float x,
float y,
float z)
Updates the position of the box in space and calls updateBounds() immediately |
AABB |
set(ReadonlyVec3D v)
Updates the position of the box in space and calls updateBounds() immediately |
AABB |
setExtent(ReadonlyVec3D extent)
Updates the size of the box and calls updateBounds() immediately |
Mesh3D |
toMesh()
|
Mesh3D |
toMesh(Mesh3D mesh)
|
java.lang.String |
toString()
|
AABB |
updateBounds()
Updates the min/max corner points of the box. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AABB()
public AABB(AABB box)
box
- public AABB(float extent)
extent
- public AABB(ReadonlyVec3D pos, float extent)
pos
- extent
- public AABB(ReadonlyVec3D pos, ReadonlyVec3D extent)
pos
- extent
- box dimensions (the box will be double the size in each
direction)Method Detail |
---|
public static final AABB fromMinMax(Vec3D min, Vec3D max)
min
- first corner pointmax
- second corner point
public boolean containsPoint(ReadonlyVec3D p)
Shape3D
containsPoint
in interface Shape3D
public AABB copy()
ReadonlyVec3D
copy
in interface ReadonlyVec3D
copy
in class Vec3D
public final Vec3D getExtent()
setExtent(ReadonlyVec3D)
for
those purposes)
public final Vec3D getMax()
public final Vec3D getMin()
public Vec3D getNormalForPoint(ReadonlyVec3D p)
public AABB includePoint(ReadonlyVec3D p)
p
- point to include
public boolean intersectsBox(AABB box)
box
- box to check
public Vec3D intersectsRay(Ray3D ray, float minDist, float maxDist)
ray
- incident rayminDist
- maxDist
-
public boolean intersectsSphere(Sphere s)
public boolean intersectsSphere(Vec3D c, float r)
c
- sphere centrer
- sphere radius
public boolean intersectsTriangle(Triangle3D tri)
public AABB set(AABB box)
public Vec3D set(float x, float y, float z)
updateBounds()
immediately
set
in class Vec3D
x
- the xy
- the yz
- the z
Vec3D.set(float, float, float)
public AABB set(ReadonlyVec3D v)
updateBounds()
immediately
set
in class Vec3D
Vec3D.set(toxi.geom.Vec3D)
public AABB setExtent(ReadonlyVec3D extent)
updateBounds()
immediately
extent
- new box size
public Mesh3D toMesh()
public Mesh3D toMesh(Mesh3D mesh)
public java.lang.String toString()
toString
in class Vec3D
public final AABB updateBounds()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |