public class AABBd extends Object implements Externalizable, AABBdc
| Modifier and Type | Field and Description |
|---|---|
double |
maxX
The x coordinate of the maximum corner.
|
double |
maxY
The y coordinate of the maximum corner.
|
double |
maxZ
The z coordinate of the maximum corner.
|
double |
minX
The x coordinate of the minimum corner.
|
double |
minY
The y coordinate of the minimum corner.
|
double |
minZ
The z coordinate of the minimum corner.
|
| Constructor and Description |
|---|
AABBd()
Create a new
AABBd representing the box with
(minX, minY, minZ)=(+inf, +inf, +inf) and (maxX, maxY, maxZ)=(-inf, -inf, -inf). |
AABBd(AABBdc source)
Create a new
AABBd as a copy of the given source. |
AABBd(double minX,
double minY,
double minZ,
double maxX,
double maxY,
double maxZ)
Create a new
AABBd with the given minimum and maximum corner coordinates. |
AABBd(org.joml.Vector3dc min,
org.joml.Vector3dc max)
Create a new
AABBd with the given minimum and maximum corner coordinates. |
AABBd(org.joml.Vector3fc min,
org.joml.Vector3fc max)
Create a new
AABBd 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(double x,
double y,
double z)
Test whether the point
(x, y, z) lies inside this AABB. |
boolean |
containsPoint(org.joml.Vector3dc point)
Test whether the given point lies inside this AABB.
|
AABBd |
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.
|
double |
getMax(int component)
Get the maximum corner coordinate of the given component.
|
double |
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.
|
int |
hashCode() |
AABBd |
intersection(AABBdc other)
Compute the AABB of intersection between
this and the given AABB. |
AABBd |
intersection(AABBdc other,
AABBd dest)
Compute the AABB of intersection between
this and the given AABB. |
boolean |
intersectsAABB(AABBd other)
Test whether
this and other intersect. |
int |
intersectsLineSegment(double p0X,
double p0Y,
double p0Z,
double p1X,
double p1Y,
double p1Z,
org.joml.Vector2d 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 |
intersectsLineSegment(LineSegmentf lineSegment,
org.joml.Vector2d 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 |
intersectsPlane(double a,
double b,
double c,
double d)
Test whether the plane given via its plane equation
a*x + b*y + c*z + d = 0 intersects this AABB. |
boolean |
intersectsPlane(Planed plane)
Test whether the given plane intersects this AABB.
|
boolean |
intersectsRay(double originX,
double originY,
double originZ,
double dirX,
double dirY,
double dirZ)
Test whether the given ray with the origin
(originX, originY, originZ) and direction (dirX, dirY, dirZ)
intersects this AABB. |
boolean |
intersectsRay(double originX,
double originY,
double originZ,
double dirX,
double dirY,
double dirZ,
org.joml.Vector2d 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(Rayd ray)
Test whether the given ray intersects this AABB.
|
boolean |
intersectsRay(Rayd ray,
org.joml.Vector2d 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(double centerX,
double centerY,
double centerZ,
double 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. |
double |
lengthX()
Return the length along the x component
|
double |
lengthY()
Return the length along the y component
|
double |
lengthZ()
Return the length along the z component
|
double |
maxX() |
double |
maxY() |
double |
maxZ() |
double |
minX() |
double |
minY() |
double |
minZ() |
void |
readExternal(ObjectInput in) |
AABBd |
set(AABBdc source)
Set this
AABBd to be a clone of source. |
AABBd |
setMax(double maxX,
double maxY,
double maxZ)
Set the maximum corner coordinates.
|
AABBd |
setMax(org.joml.Vector3dc max)
Set the maximum corner coordinates.
|
AABBd |
setMin(double minX,
double minY,
double minZ)
Set the minimum corner coordinates.
|
AABBd |
setMin(org.joml.Vector3dc min)
Set the minimum corner coordinates.
|
String |
toString()
Return a string representation of this AABB.
|
String |
toString(NumberFormat formatter)
Return a string representation of this AABB by formatting the vector components with the given
NumberFormat. |
AABBd |
transform(org.joml.Matrix4dc m)
Apply the given
affine transformation to this AABBd. |
AABBd |
transform(org.joml.Matrix4dc m,
AABBd dest)
|
AABBd |
translate(double x,
double y,
double z)
Translate
this by the vector (x, y, z). |
AABBd |
translate(double x,
double y,
double z,
AABBd dest)
Translate
this by the vector (x, y, z) and store the result in dest. |
AABBd |
translate(org.joml.Vector3dc xyz)
Translate
this by the given vector xyz. |
AABBd |
translate(org.joml.Vector3dc xyz,
AABBd dest)
Translate
this by the given vector xyz and store the result in dest. |
AABBd |
translate(org.joml.Vector3fc xyz)
Translate
this by the given vector xyz. |
AABBd |
translate(org.joml.Vector3fc xyz,
AABBd dest)
Translate
this by the given vector xyz and store the result in dest. |
AABBd |
union(AABBdc other)
Set
this to the union of this and other. |
AABBd |
union(AABBdc other,
AABBd dest)
Compute the union of
this and other and store the result in dest. |
AABBd |
union(double x,
double y,
double z)
Set
this to the union of this and the given point (x, y, z). |
AABBd |
union(double x,
double y,
double z,
AABBd dest)
Compute the union of
this and the given point (x, y, z) and store the result in dest. |
AABBd |
union(org.joml.Vector3dc p)
Set
this to the union of this and the given point p. |
AABBd |
union(org.joml.Vector3dc p,
AABBd dest)
Compute the union of
this and the given point p and store the result in dest. |
void |
writeExternal(ObjectOutput out) |
public double minX
public double minY
public double minZ
public double maxX
public double maxY
public double maxZ
public AABBd()
AABBd representing the box with
(minX, minY, minZ)=(+inf, +inf, +inf) and (maxX, maxY, maxZ)=(-inf, -inf, -inf).public AABBd(AABBdc source)
AABBd as a copy of the given source.source - the AABBd to copy frompublic AABBd(org.joml.Vector3fc min,
org.joml.Vector3fc max)
AABBd with the given minimum and maximum corner coordinates.min - the minimum coordinatesmax - the maximum coordinatespublic AABBd(org.joml.Vector3dc min,
org.joml.Vector3dc max)
AABBd with the given minimum and maximum corner coordinates.min - the minimum coordinatesmax - the maximum coordinatespublic AABBd(double minX,
double minY,
double minZ,
double maxX,
double maxY,
double maxZ)
AABBd 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 double minX()
public double minY()
public double minZ()
public double maxX()
public double maxY()
public double maxZ()
public AABBd set(AABBdc source)
AABBd to be a clone of source.source - the AABBd to copy frompublic boolean isValid()
AABBdcthis AABB represents a valid AABB.public AABBd setMin(double minX, double minY, double minZ)
minX - the x coordinate of the minimum cornerminY - the y coordinate of the minimum cornerminZ - the z coordinate of the minimum cornerpublic AABBd setMax(double maxX, double maxY, double maxZ)
maxX - the x coordinate of the maximum cornermaxY - the y coordinate of the maximum cornermaxZ - the z coordinate of the maximum cornerpublic AABBd setMin(org.joml.Vector3dc min)
min - the minimum coordinatespublic AABBd setMax(org.joml.Vector3dc max)
max - the maximum coordinatespublic double getMax(int component)
throws IllegalArgumentException
AABBdcgetMax in interface AABBdccomponent - the component, within [0..2]IllegalArgumentException - if component is not within [0..2]public double getMin(int component)
throws IllegalArgumentException
AABBdcgetMin in interface AABBdccomponent - the component, within [0..2]IllegalArgumentException - if component is not within [0..2]public org.joml.Vector3d center(org.joml.Vector3d dest)
AABBdcpublic org.joml.Vector3f center(org.joml.Vector3f dest)
AABBdcpublic org.joml.Vector3d extent(org.joml.Vector3d dest)
AABBdcpublic org.joml.Vector3f extent(org.joml.Vector3f dest)
AABBdcpublic double lengthX()
public double lengthY()
public double lengthZ()
public 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 AABBd union(double x, double y, double 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 AABBd union(org.joml.Vector3dc p)
this to the union of this and the given point p.p - the pointpublic AABBd union(double x, double y, double z, AABBd dest)
AABBdcthis and the given point (x, y, z) and store the result in dest.public AABBd union(org.joml.Vector3dc p, AABBd dest)
AABBdcthis and the given point p and store the result in dest.public AABBd union(AABBdc other)
this to the union of this and other.other - the other AABBdpublic AABBd union(AABBdc other, AABBd dest)
AABBdcthis and other and store the result in dest.public AABBd correctBounds()
public AABBd translate(org.joml.Vector3dc xyz)
this by the given vector xyz.xyz - the vector to translate bypublic AABBd translate(org.joml.Vector3dc xyz, AABBd dest)
AABBdcthis by the given vector xyz and store the result in dest.public AABBd translate(org.joml.Vector3fc xyz)
this by the given vector xyz.xyz - the vector to translate bypublic AABBd translate(org.joml.Vector3fc xyz, AABBd dest)
AABBdcthis by the given vector xyz and store the result in dest.public AABBd translate(double x, double y, double 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 AABBd translate(double x, double y, double z, AABBd dest)
AABBdcthis by the vector (x, y, z) and store the result in dest.public AABBd intersection(AABBdc other, AABBd dest)
AABBdcthis and the given AABB.
If the two AABBs do not intersect, then the minimum coordinates of this
will have a value of Double.POSITIVE_INFINITY and the maximum coordinates will have a value of
Double.NEGATIVE_INFINITY.
intersection in interface AABBdcother - the other AABBdest - will hold the resultpublic AABBd intersection(AABBdc other)
this and the given AABB.
If the two AABBs do not intersect, then the minimum coordinates of this
will have a value of Double.POSITIVE_INFINITY and the maximum coordinates will have a value of
Double.NEGATIVE_INFINITY.
other - the other AABBpublic boolean containsAABB(AABBdc aabb)
AABBdcAABB.containsAABB in interface AABBdcaabb - the AABB to testtrue iff this AABB contains the AABB; false otherwisepublic boolean containsAABB(AABBfc aabb)
AABBdcAABB.containsAABB in interface AABBdcaabb - the AABB to testtrue iff this AABB contains the AABB; false otherwisepublic boolean containsAABB(AABBic aabb)
AABBdcAABB.containsAABB in interface AABBdcaabb - the AABB to testtrue iff this AABB contains the AABB; false otherwisepublic boolean containsPoint(double x,
double y,
double z)
AABBdc(x, y, z) lies inside this AABB.containsPoint in interface AABBdcx - 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.Vector3dc point)
AABBdccontainsPoint in interface AABBdcpoint - the coordinates of the pointtrue iff the given point lies inside this AABB; false otherwisepublic boolean intersectsPlane(double a,
double b,
double c,
double d)
AABBdca*x + b*y + c*z + d = 0 intersects this AABB.
Reference: http://www.lighthouse3d.com ("Geometric Approach - Testing Boxes II")
intersectsPlane in interface AABBdca - 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(Planed plane)
AABBdcReference: http://www.lighthouse3d.com ("Geometric Approach - Testing Boxes II")
intersectsPlane in interface AABBdcplane - the planetrue iff the plane intersects this AABB; false otherwisepublic boolean intersectsAABB(AABBd other)
AABBdcthis and other intersect.intersectsAABB in interface AABBdcother - the other AABBtrue iff both AABBs intersect; false otherwisepublic boolean intersectsSphere(double centerX,
double centerY,
double centerZ,
double radiusSquared)
AABBdc(x - centerX)^2 + (y - centerY)^2 + (z - centerZ)^2 - radiusSquared = 0.
Reference: http://stackoverflow.com
intersectsSphere in interface AABBdccenterX - 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)
AABBdcReference: http://stackoverflow.com
intersectsSphere in interface AABBdcsphere - the spheretrue iff this AABB and the sphere intersect; false otherwisepublic boolean intersectsRay(double originX,
double originY,
double originZ,
double dirX,
double dirY,
double dirZ)
AABBdc(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 AABBdcoriginX - 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(Rayd ray)
AABBdc
This method returns true for a ray whose origin lies inside this AABB.
Reference: An Efficient and Robust Ray–Box Intersection
intersectsRay in interface AABBdcray - the raytrue if this AABB and the ray intersect; false otherwisepublic boolean intersectsRay(double originX,
double originY,
double originZ,
double dirX,
double dirY,
double dirZ,
org.joml.Vector2d result)
AABBdc(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 AABBdcoriginX - 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(Rayd ray, org.joml.Vector2d result)
AABBdc
This method returns true for a ray whose origin lies inside this AABB.
Reference: An Efficient and Robust Ray–Box Intersection
intersectsRay in interface AABBdcray - 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 intersectsLineSegment(double p0X,
double p0Y,
double p0Z,
double p1X,
double p1Y,
double p1Z,
org.joml.Vector2d result)
AABBdc(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
intersectsLineSegment in interface AABBdcp0X - 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 AABBIntersectiond.INSIDE if the line segment lies completely inside of this AABB; or
Intersectiond.OUTSIDE if the line segment lies completely outside of this AABB; or
Intersectiond.ONE_INTERSECTION if one of the end points of the line segment lies inside of this AABB; or
Intersectiond.TWO_INTERSECTION if the line segment intersects two sides of this AABB or lies on an edge or a side of this AABBpublic int intersectsLineSegment(LineSegmentf lineSegment, org.joml.Vector2d result)
AABBdc
This method returns true for a line segment whose either end point lies inside this AABB.
Reference: An Efficient and Robust Ray–Box Intersection
intersectsLineSegment in interface AABBdclineSegment - 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 AABBIntersectiond.INSIDE if the line segment lies completely inside of this AABB; or
Intersectiond.OUTSIDE if the line segment lies completely outside of this AABB; or
Intersectiond.ONE_INTERSECTION if one of the end points of the line segment lies inside of this AABB; or
Intersectiond.TWO_INTERSECTION if the line segment intersects two sides of this AABB or lies on an edge or a side of this AABBpublic AABBd transform(org.joml.Matrix4dc m)
m - the affine transformation matrixpublic AABBd transform(org.joml.Matrix4dc m, AABBd dest)
AABBdcaffine transformation to this AABBd
and store the resulting AABB into dest.
The matrix in m must be affine.
public String toString()
This method creates a new DecimalFormat on every invocation with the format string "0.000E0;-".
public String toString(NumberFormat formatter)
NumberFormat.formatter - the NumberFormat used to format the vector components withpublic 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.