Back to class index
Sphere[Class Summary]
pos
r
ctor (+4 overloads)
Translate(offset)
Transform(transform) (+3 overloads)
MinimalEnclosingAABB()[const]
MaximalContainedAABB()[const]
SetNegativeInfinity()
Volume()[const]
SurfaceArea()[const]
Diameter()[const]
Centroid()[const]
AnyPointFast()[const]
ExtremePoint(direction)[const] (+1 overload)
ProjectToAxis(...)[const]
IsFinite()[const]
IsDegenerate()[const]
SetDegenerate()
Contains(point)[const] (+11 overloads)
Distance(point)[const] (+9 overloads)
MaxDistance(point)[const]
ClosestPoint(point)[const]
Intersects(...)[const] (+11 overloads)
Enclose(point,epsilon) (+10 overloads)
ExtendRadiusToContain(point,epsilon) (+1 overload)
RandomPointInside(lcg)
RandomPointOnSurface(lcg)
Triangulate(...)[const]
ToString()[const]
SerializeToString()[const]
SerializeToCodeString()[const]
Equals(rhs,epsilon)[const]
BitEquals(other)[const]
FastEnclosingSphere(...)[static]
OptimalEnclosingSphere(...)[static] (+4 overloads)
FitThroughPoints(a,b)[static] (+2 overloads)
RandomPointInside(lcg,center,radius)[static]
RandomPointOnSurface(lcg,center,radius)[static]
RandomUnitaryFloat3(lcg)[static]
IntersectLine(...)[static]
FromString(str,outEndStr)[static] (+1 overload)

Sphere::Intersects

Syntax

int Sphere::Intersects(const LineSegment &lineSegment, float4 *intersectionPoint=0, float4 *intersectionNormal=0, float *d=0, float *d2=0) const; [23 lines of code]
int Sphere::Intersects(const Line &line, float4 *intersectionPoint=0, float4 *intersectionNormal=0, float *d=0, float *d2=0) const; [19 lines of code]
int Sphere::Intersects(const Ray &ray, float4 *intersectionPoint=0, float4 *intersectionNormal=0, float *d=0, float *d2=0) const; [26 lines of code]
bool Sphere::Intersects(const Plane &plane) const; [4 lines of code]
bool Sphere::Intersects(const AABB &aabb, float4 *closestPointOnAABB=0) const; [4 lines of code]
bool Sphere::Intersects(const OBB &obb, float4 *closestPointOnOBB=0) const; [4 lines of code]
bool Sphere::Intersects(const Triangle &triangle, float4 *closestPointOnTriangle=0) const; [4 lines of code]
bool Sphere::Intersects(const Capsule &capsule) const; [4 lines of code]
bool Sphere::Intersects(const Polygon &polygon) const; [4 lines of code]
bool Sphere::Intersects(const Frustum &frustum) const; [4 lines of code]
bool Sphere::Intersects(const Polyhedron &polyhedron) const; [4 lines of code]
bool Sphere::Intersects(const Sphere &sphere) const; [4 lines of code]

Tests whether this sphere and the given object intersect.

Both objects are treated as "solid", meaning that if one of the objects is fully contained inside another, this function still returns true. (e.g. in case a line segment is contained inside this sphere, or this sphere is contained inside a polyhedron, etc.)

Parameters

float4 *intersectionPoint [out]If specified, receives the actual point of intersection. This pointer may be null.float4 *intersectionNormal [out]If specified, receives the sphere normal at the point of intersection. This pointer may be null.float *d [out]If specified, receives the distance along the Line/LineSegment/Ray to the intersection. This pointer may be null.

Return Value

In the case of Ray/Line/LineSegment intersection tests, the number of intersections is returned (0, 1 or 2). For other functions, true is returned if an intersection occurs or one of the objects is contained inside the other, and false otherwise.

See Also

Contains(), Distance(), ClosestPoint(), LineSegment::GetPoint().