Back to class index
OBB[Class Summary]
pos
r
axis
ctor (+1 overload)
SetNegativeInfinity()
SetFrom(aabb) (+6 overloads)
SetFromApproximate(...)
ToPolyhedron()[const]
MinimalEnclosingAABB()[const]
MaximalContainedAABB()[const]
MinimalEnclosingSphere()[const]
MaximalContainedSphere()[const]
Size()[const]
HalfSize()[const]
Diagonal()[const]
HalfDiagonal()[const]
WorldToLocal()[const]
LocalToWorld()[const]
IsFinite()[const]
IsDegenerate()[const]
CenterPoint()[const]
Centroid()[const]
Volume()[const]
SurfaceArea()[const]
PointInside(x,y,z)[const]
Edge(edgeIndex)[const]
CornerPoint(cornerIndex)[const]
PointOnEdge(edgeIndex,u)[const]
FaceCenterPoint(faceIndex)[const]
FacePoint(faceIndex,u,v)[const]
FacePlane(faceIndex)[const]
GetCornerPoints(outPointArray)[const]
GetFacePlanes(outPlaneArray)[const]
RandomPointInside(rng)[const]
RandomPointOnSurface(rng)[const]
RandomPointOnEdge(rng)[const]
RandomCornerPoint(rng)[const]
Translate(offset)
Scale(...) (+1 overload)
Transform(transform) (+3 overloads)
ClosestPoint(point)[const]
Distance(point)[const] (+1 overload)
Contains(point)[const] (+7 overloads)
Intersects(aabb)[const] (+11 overloads)
Enclose(point)
Triangulate(...)[const]
ToEdgeList(outPos)[const]
ExtremePointsAlongDirection(...)[static]
PCAEnclosingOBB(...)[static]
NumVerticesInTriangulation(...)[static]
NumVerticesInEdgeList()[static]

OBB::Distance

Syntax

float OBB::Distance(const float3 &point) const; [7 lines of code]
float OBB::Distance(const Sphere &sphere) const; [4 lines of code]

Computes the distance between this OBB and the given object.

This function finds the nearest pair of points on this and the given object, and computes their distance. If the two objects intersect, or one object is contained inside the other, the returned distance is zero.

Performance

float OBB::Distance(const float3 &point) const

45.158nsecs/call ≈ 22.14M calls/second ≈ 369.08k calls/frame (@ 60fps).
This function does not perform dynamic memory allocation.

float OBB::Distance(const Sphere &sphere) const

49.263nsecs/call ≈ 20.3M calls/second ≈ 338.32k calls/frame (@ 60fps).
This function does not perform dynamic memory allocation.

See Also

Contains(), Intersects(), ClosestPoint().

Work in progress:

Todo: in float OBB::Distance(const float3 &point) const:
Add OBB::Distance(Line/Ray/LineSegment/Plane/Triangle/Polygon/Circle/Disc/AABB/OBB/Capsule/Frustum/Polyhedron).
Todo: in float OBB::Distance(const float3 &point) const:
This code can be optimized a bit. See Christer Ericson's Real-Time Collision Detection, p.134.

Leave a Comment

Name:
Comments:
Captcha:captcha image Type in the black symbols:
Back to class index