public class AABBi extends Object implements Externalizable, AABBic
| Modifier and Type | Field and Description |
|---|---|
int |
maxX
The x coordinate of the maximum corner.
|
int |
maxY
The y coordinate of the maximum corner.
|
int |
maxZ
The z coordinate of the maximum corner.
|
int |
minX
The x coordinate of the minimum corner.
|
int |
minY
The y coordinate of the minimum corner.
|
int |
minZ
The z coordinate of the minimum corner.
|
| Constructor and Description |
|---|
AABBi()
Create a new
AABBi representing the box with
(minX, minY, minZ)=(+inf, +inf, +inf) and (maxX, maxY, maxZ)=(-inf, -inf, -inf). |
AABBi(AABBic source)
Create a new
AABBi as a copy of the given source. |
AABBi(int minX,
int minY,
int minZ,
int maxX,
int maxY,
int maxZ)
Create a new
AABBi with the given minimum and maximum corner coordinates. |
AABBi(org.joml.Vector3ic min,
org.joml.Vector3ic max)
Create a new
AABBi with the given minimum and maximum corner coordinates. |
| Modifier and Type | Method and Description |
|---|---|
org.joml.Vector3d |
center(org.joml.Vector3d dest)
Return the center of the aabb
|
org.joml.Vector3f |
center(org.joml.Vector3f dest)
Return the center of the aabb
|
boolean |
containsAABB(AABBdc aabb)
Check if this AABB contains the given
AABB. |
boolean |
containsAABB(AABBfc aabb)
Check if this AABB contains the given
AABB. |
boolean |
containsAABB(AABBic aabb)
Check if this AABB contains the given
AABB. |
boolean |
containsPoint(float x,
float y,
float z)
Test whether the point
(x, y, z) lies inside this AABB. |
boolean |
containsPoint(int x,
int y,
int z)
Test whether the point
(x, y, z) lies inside this AABB. |
boolean |
containsPoint(org.joml.Vector3fc point)
Test whether the given point lies inside this AABB.
|
boolean |
containsPoint(org.joml.Vector3ic point)
Test whether the given point lies inside this AABB.
|
AABBi |
correctBounds()
Ensure that the minimum coordinates are strictly less than or equal to the maximum coordinates by swapping
them if necessary.
|
boolean |
equals(Object obj) |
org.joml.Vector3d |
extent(org.joml.Vector3d dest)
Extent of the aabb (max - min) / 2.0.
|
org.joml.Vector3f |
extent(org.joml.Vector3f dest)
Extent of the aabb (max - min) / 2.0.
|
int |
getMax(int component)
Get the maximum corner coordinate of the given component.
|
int |
getMin(int component)
Get the minimum corner coordinate of the given component.
|
org.joml.Vector3d |
getSize(org.joml.Vector3d dest)
Get the size of the aabb.
|
org.joml.Vector3f |
getSize(org.joml.Vector3f dest)
Get the size of the aabb.
|
org.joml.Vector3i |
getSize(org.joml.Vector3i dest)
Get the size of the aabb.
|
int |
hashCode() |
AABBi |
intersection(AABBic other)
Compute the AABB of intersection between
this and the given AABB. |
AABBi |
intersection(AABBic other,
AABBi dest)
Compute the AABB of intersection between
this and the given AABB. |
int |
intersectLineSegment(float p0X,
float p0Y,
float p0Z,
float p1X,
float p1Y,
float p1Z,
org.joml.Vector2f result)
Determine whether the undirected line segment with the end points
(p0X, p0Y, p0Z) and (p1X, p1Y, p1Z)
intersects this AABB, and return the values of the parameter t in the ray equation
p(t) = origin + p0 * (p1 - p0) of the near and far point of intersection. |
int |
intersectLineSegment(LineSegmentf lineSegment,
org.joml.Vector2f result)
Determine whether the given undirected line segment intersects this AABB, and return the values of the parameter t in the ray equation
p(t) = origin + p0 * (p1 - p0) of the near and far point of intersection.
|
boolean |
intersectsAABB(AABBfc other)
Test whether
this and other intersect. |
boolean |
intersectsAABB(AABBic other)
Test whether
this and other intersect. |
boolean |
intersectsPlane(float a,
float b,
float c,
float d)
Test whether the plane given via its plane equation
a*x + b*y + c*z + d = 0 intersects this AABB. |
boolean |
intersectsPlane(Planef plane)
Test whether the given plane intersects this AABB.
|
boolean |
intersectsRay(float originX,
float originY,
float originZ,
float dirX,
float dirY,
float dirZ)
Test whether the given ray with the origin
(originX, originY, originZ) and direction (dirX, dirY, dirZ)
intersects this AABB. |
boolean |
intersectsRay(float originX,
float originY,
float originZ,
float dirX,
float dirY,
float dirZ,
org.joml.Vector2f result)
Determine whether the given ray with the origin
(originX, originY, originZ) and direction (dirX, dirY, dirZ)
intersects this AABB, and return the values of the parameter t in the ray equation
p(t) = origin + t * dir of the near and far point of intersection. |
boolean |
intersectsRay(Rayf ray)
Test whether the given ray intersects this AABB.
|
boolean |
intersectsRay(Rayf ray,
org.joml.Vector2f result)
Determine whether the given ray intersects this AABB, and return the values of the parameter t in the ray equation
p(t) = origin + t * dir of the near and far point of intersection.
|
boolean |
intersectsSphere(float centerX,
float centerY,
float centerZ,
float radiusSquared)
Test whether this AABB intersects the given sphere with equation
(x - centerX)^2 + (y - centerY)^2 + (z - centerZ)^2 - radiusSquared = 0. |
boolean |
intersectsSphere(Spheref sphere)
Test whether this AABB intersects the given sphere.
|
boolean |
isValid()
Check whether
this AABB represents a valid AABB. |
int |
lengthX()
Return the length along the x component
|
int |
lengthY()
Return the length along the y component
|
int |
lengthZ()
Return the length along the z component.
|
int |
maxX() |
int |
maxY() |
int |
maxZ() |
int |
minX() |
int |
minY() |
int |
minZ() |
void |
readExternal(ObjectInput in) |
AABBi |
set(AABBic source)
Set this
AABBi to be a clone of source. |
AABBi |
setMax(int maxX,
int maxY,
int maxZ)
Set the maximum corner coordinates.
|
AABBi |
setMax(org.joml.Vector3ic max)
Set the maximum corner coordinates.
|
AABBi |
setMin(int minX,
int minY,
int minZ)
Set the minimum corner coordinates.
|
AABBi |
setMin(org.joml.Vector3ic min)
Set the minimum corner coordinates.
|
String |
toString() |
AABBi |
transform(org.joml.Matrix4fc m)
Apply the given
affine transformation to this AABBi. |
AABBi |
transform(org.joml.Matrix4fc m,
AABBi dest)
|
AABBi |
translate(int x,
int y,
int z)
Translate
this by the vector (x, y, z). |
AABBi |
translate(int x,
int y,
int z,
AABBi dest)
Translate
this by the vector (x, y, z) and store the result in dest. |
AABBi |
translate(org.joml.Vector3ic xyz)
Translate
this by the given vector xyz. |
AABBi |
translate(org.joml.Vector3ic xyz,
AABBi dest)
Translate
this by the given vector xyz and store the result in dest. |
AABBi |
union(AABBic other)
Set
this to the union of this and other. |
AABBi |
union(AABBic other,
AABBi dest)
Compute the union of
this and other and store the result in dest. |
AABBi |
union(int x,
int y,
int z)
Set
this to the union of this and the given point (x, y, z). |
AABBi |
union(int x,
int y,
int z,
AABBi dest)
Compute the union of
this and the given point (x, y, z) and store the result in dest. |
AABBi |
union(org.joml.Vector3ic p)
Set
this to the union of this and the given point p. |
AABBi |
union(org.joml.Vector3ic p,
AABBi dest)
Compute the union of
this and the given point p and store the result in dest. |
void |
writeExternal(ObjectOutput out) |
public int minX
public int minY
public int minZ
public int maxX
public int maxY
public int maxZ
public AABBi()
AABBi representing the box with
(minX, minY, minZ)=(+inf, +inf, +inf) and (maxX, maxY, maxZ)=(-inf, -inf, -inf).public AABBi(AABBic source)
AABBi as a copy of the given source.source - the AABBi to copy frompublic AABBi(org.joml.Vector3ic min,
org.joml.Vector3ic max)
AABBi with the given minimum and maximum corner coordinates.min - the minimum coordinatesmax - the maximum coordinatespublic AABBi(int minX,
int minY,
int minZ,
int maxX,
int maxY,
int maxZ)
AABBi with the given minimum and maximum corner coordinates.minX - the x coordinate of the minimum cornerminY - the y coordinate of the minimum cornerminZ - the z coordinate of the minimum cornermaxX - the x coordinate of the maximum cornermaxY - the y coordinate of the maximum cornermaxZ - the z coordinate of the maximum cornerpublic int minX()
public int minY()
public int minZ()
public int maxX()
public int maxY()
public int maxZ()
public AABBi setMin(int minX, int minY, int minZ)
minX - the x coordinate of the minimum cornerminY - the y coordinate of the minimum cornerminZ - the z coordinate of the minimum cornerpublic AABBi setMax(int maxX, int maxY, int maxZ)
maxX - the x coordinate of the maximum cornermaxY - the y coordinate of the maximum cornermaxZ - the z coordinate of the maximum cornerpublic AABBi set(AABBic source)
AABBi to be a clone of source.source - the AABBi to copy frompublic boolean isValid()
AABBicthis AABB represents a valid AABB.public AABBi setMin(org.joml.Vector3ic min)
min - the minimum coordinatespublic AABBi setMax(org.joml.Vector3ic max)
max - the maximum coordinatespublic int getMax(int component)
throws IllegalArgumentException
AABBicgetMax in interface AABBiccomponent - the component, within [0..2]IllegalArgumentException - if component is not within [0..2]public int getMin(int component)
throws IllegalArgumentException
AABBicgetMin in interface AABBiccomponent - the component, within [0..2]IllegalArgumentException - if component is not within [0..2]public org.joml.Vector3f center(org.joml.Vector3f dest)
AABBicpublic org.joml.Vector3d center(org.joml.Vector3d dest)
AABBicpublic org.joml.Vector3d extent(org.joml.Vector3d dest)
AABBicpublic org.joml.Vector3f extent(org.joml.Vector3f dest)
AABBicpublic int lengthX()
public int lengthY()
public int lengthZ()
public org.joml.Vector3i getSize(org.joml.Vector3i dest)
dest - will hold the resultpublic org.joml.Vector3f getSize(org.joml.Vector3f dest)
dest - will hold the resultpublic org.joml.Vector3d getSize(org.joml.Vector3d dest)
dest - will hold the resultpublic AABBi union(int x, int y, int z)
this to the union of this and the given point (x, y, z).x - the x coordinate of the pointy - the y coordinate of the pointz - the z coordinate of the pointpublic AABBi union(org.joml.Vector3ic p)
this to the union of this and the given point p.p - the pointpublic AABBi union(int x, int y, int z, AABBi dest)
AABBicthis and the given point (x, y, z) and store the result in dest.public AABBi union(org.joml.Vector3ic p, AABBi dest)
AABBicthis and the given point p and store the result in dest.public AABBi union(AABBic other)
this to the union of this and other.other - the other AABBipublic AABBi union(AABBic other, AABBi dest)
AABBicthis and other and store the result in dest.public AABBi correctBounds()
public AABBi translate(org.joml.Vector3ic xyz)
this by the given vector xyz.xyz - the vector to translate bypublic AABBi translate(org.joml.Vector3ic xyz, AABBi dest)
this by the given vector xyz and store the result in dest.xyz - the vector to translate bydest - will hold the resultpublic AABBi translate(int x, int y, int z)
this by the vector (x, y, z).x - the x coordinate to translate byy - the y coordinate to translate byz - the z coordinate to translate bypublic AABBi translate(int x, int y, int z, AABBi dest)
AABBicthis by the vector (x, y, z) and store the result in dest.public AABBi intersection(AABBic other, AABBi dest)
AABBicthis and the given AABB.
If the two AABBs do not intersect, then the minimum coordinates of this
will have a value of Integer.MAX_VALUE and the maximum coordinates will have a value of
Integer.MIN_VALUE.
intersection in interface AABBicother - the other AABBdest - will hold the resultpublic AABBi intersection(AABBic other)
this and the given AABB.
If the two AABBs do not intersect, then the minimum coordinates of this
will have a value of Integer.MAX_VALUE and the maximum coordinates will have a value of
Integer.MIN_VALUE.
other - the other AABBpublic boolean containsAABB(AABBdc aabb)
AABBicAABB.containsAABB in interface AABBicaabb - the AABB to testtrue iff this AABB contains the AABB; false otherwisepublic boolean containsAABB(AABBfc aabb)
AABBicAABB.containsAABB in interface AABBicaabb - the AABB to testtrue iff this AABB contains the AABB; false otherwisepublic boolean containsAABB(AABBic aabb)
AABBicAABB.containsAABB in interface AABBicaabb - the AABB to testtrue iff this AABB contains the AABB; false otherwisepublic boolean containsPoint(int x,
int y,
int z)
AABBic(x, y, z) lies inside this AABB.containsPoint in interface AABBicx - the x coordinate of the pointy - the y coordinate of the pointz - the z coordinate of the pointtrue iff the given point lies inside this AABB; false otherwisepublic boolean containsPoint(float x,
float y,
float z)
AABBic(x, y, z) lies inside this AABB.containsPoint in interface AABBicx - the x coordinate of the pointy - the y coordinate of the pointz - the z coordinate of the pointtrue iff the given point lies inside this AABB; false otherwisepublic boolean containsPoint(org.joml.Vector3ic point)
AABBiccontainsPoint in interface AABBicpoint - the coordinates of the pointtrue iff the given point lies inside this AABB; false otherwisepublic boolean containsPoint(org.joml.Vector3fc point)
AABBiccontainsPoint in interface AABBicpoint - the coordinates of the pointtrue iff the given point lies inside this AABB; false otherwisepublic boolean intersectsPlane(float a,
float b,
float c,
float d)
AABBica*x + b*y + c*z + d = 0 intersects this AABB.
Reference: http://www.lighthouse3d.com ("Geometric Approach - Testing Boxes II")
intersectsPlane in interface AABBica - the x factor in the plane equationb - the y factor in the plane equationc - the z factor in the plane equationd - the constant in the plane equationtrue iff the plane intersects this AABB; false otherwisepublic boolean intersectsPlane(Planef plane)
AABBicReference: http://www.lighthouse3d.com ("Geometric Approach - Testing Boxes II")
intersectsPlane in interface AABBicplane - the planetrue iff the plane intersects this AABB; false otherwisepublic boolean intersectsAABB(AABBic other)
AABBicthis and other intersect.intersectsAABB in interface AABBicother - the other AABBtrue iff both AABBs intersect; false otherwisepublic boolean intersectsAABB(AABBfc other)
AABBicthis and other intersect.intersectsAABB in interface AABBicother - the other AABBtrue iff both AABBs intersect; false otherwisepublic boolean intersectsSphere(float centerX,
float centerY,
float centerZ,
float radiusSquared)
AABBic(x - centerX)^2 + (y - centerY)^2 + (z - centerZ)^2 - radiusSquared = 0.
Reference: http://stackoverflow.com
intersectsSphere in interface AABBiccenterX - the x coordinate of the center of the spherecenterY - the y coordinate of the center of the spherecenterZ - the z coordinate of the center of the sphereradiusSquared - the square radius of the spheretrue iff this AABB and the sphere intersect; false otherwisepublic boolean intersectsSphere(Spheref sphere)
AABBicReference: http://stackoverflow.com
intersectsSphere in interface AABBicsphere - the spheretrue iff this AABB and the sphere intersect; false otherwisepublic boolean intersectsRay(float originX,
float originY,
float originZ,
float dirX,
float dirY,
float dirZ)
AABBic(originX, originY, originZ) and direction (dirX, dirY, dirZ)
intersects this AABB.
This method returns true for a ray whose origin lies inside this AABB.
Reference: An Efficient and Robust Ray–Box Intersection
intersectsRay in interface AABBicoriginX - the x coordinate of the ray's originoriginY - the y coordinate of the ray's originoriginZ - the z coordinate of the ray's origindirX - the x coordinate of the ray's directiondirY - the y coordinate of the ray's directiondirZ - the z coordinate of the ray's directiontrue if this AABB and the ray intersect; false otherwisepublic boolean intersectsRay(Rayf ray)
AABBic
This method returns true for a ray whose origin lies inside this AABB.
Reference: An Efficient and Robust Ray–Box Intersection
intersectsRay in interface AABBicray - the raytrue if this AABB and the ray intersect; false otherwisepublic boolean intersectsRay(float originX,
float originY,
float originZ,
float dirX,
float dirY,
float dirZ,
org.joml.Vector2f result)
AABBic(originX, originY, originZ) and direction (dirX, dirY, dirZ)
intersects this AABB, and return the values of the parameter t in the ray equation
p(t) = origin + t * dir of the near and far point of intersection.
This method returns true for a ray whose origin lies inside this AABB.
Reference: An Efficient and Robust Ray–Box Intersection
intersectsRay in interface AABBicoriginX - the x coordinate of the ray's originoriginY - the y coordinate of the ray's originoriginZ - the z coordinate of the ray's origindirX - the x coordinate of the ray's directiondirY - the y coordinate of the ray's directiondirZ - the z coordinate of the ray's directionresult - a vector which will hold the resulting values of the parameter
t in the ray equation p(t) = origin + t * dir of the near and far point of intersection
iff the ray intersects this AABBtrue if the given ray intersects this AABB; false otherwisepublic boolean intersectsRay(Rayf ray, org.joml.Vector2f result)
AABBic
This method returns true for a ray whose origin lies inside this AABB.
Reference: An Efficient and Robust Ray–Box Intersection
intersectsRay in interface AABBicray - the rayresult - a vector which will hold the resulting values of the parameter
t in the ray equation p(t) = origin + t * dir of the near and far point of intersection
iff the ray intersects this AABBtrue if the given ray intersects this AABB; false otherwisepublic int intersectLineSegment(float p0X,
float p0Y,
float p0Z,
float p1X,
float p1Y,
float p1Z,
org.joml.Vector2f result)
AABBic(p0X, p0Y, p0Z) and (p1X, p1Y, p1Z)
intersects this AABB, and return the values of the parameter t in the ray equation
p(t) = origin + p0 * (p1 - p0) of the near and far point of intersection.
This method returns true for a line segment whose either end point lies inside this AABB.
Reference: An Efficient and Robust Ray–Box Intersection
intersectLineSegment in interface AABBicp0X - the x coordinate of the line segment's first end pointp0Y - the y coordinate of the line segment's first end pointp0Z - the z coordinate of the line segment's first end pointp1X - the x coordinate of the line segment's second end pointp1Y - the y coordinate of the line segment's second end pointp1Z - the z coordinate of the line segment's second end pointresult - a vector which will hold the resulting values of the parameter
t in the ray equation p(t) = p0 + t * (p1 - p0) of the near and far point of intersection
iff the line segment intersects this AABBIntersectionf.INSIDE if the line segment lies completely inside of this AABB; or
Intersectionf.OUTSIDE if the line segment lies completely outside of this AABB; or
Intersectionf.ONE_INTERSECTION if one of the end points of the line segment lies inside of this AABB; or
Intersectionf.TWO_INTERSECTION if the line segment intersects two sides of this AABB or lies on an edge or a side of this AABBpublic int intersectLineSegment(LineSegmentf lineSegment, org.joml.Vector2f result)
AABBic
This method returns true for a line segment whose either end point lies inside this AABB.
Reference: An Efficient and Robust Ray–Box Intersection
intersectLineSegment in interface AABBiclineSegment - the line segmentresult - a vector which will hold the resulting values of the parameter
t in the ray equation p(t) = p0 + t * (p1 - p0) of the near and far point of intersection
iff the line segment intersects this AABBIntersectionf.INSIDE if the line segment lies completely inside of this AABB; or
Intersectionf.OUTSIDE if the line segment lies completely outside of this AABB; or
Intersectionf.ONE_INTERSECTION if one of the end points of the line segment lies inside of this AABB; or
Intersectionf.TWO_INTERSECTION if the line segment intersects two sides of this AABB or lies on an edge or a side of this AABBpublic AABBi transform(org.joml.Matrix4fc m)
m - the affine transformation matrixpublic AABBi transform(org.joml.Matrix4fc m, AABBi dest)
AABBicaffine transformation to this
AABBi and store the resulting AABB into dest.
The matrix in m must be affine.
public void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionCopyright © 2020 JOML. All rights reserved.