Back to class index
Ray[Class Summary]
pos
dir
ctor (+3 overloads)
GetPoint(distance)[const]
Transform(transform) (+3 overloads)
Contains(...)[const] (+1 overload)
Equals(otherRay,epsilon)[const]
Distance(point,d)[const] (+9 overloads)
ClosestPoint(targetPoint,d)[const] (+3 overloads)
Intersects(...)[const] (+13 overloads)
IntersectsDisc(disc)[const]
ToLine()[const]
ToLineSegment(d)[const]

Ray::Distance

Syntax

float Ray::Distance(const float3 &point, float *d) const; [4 lines of code]
float Ray::Distance(const float3 &point) const; [4 lines of code]
float Ray::Distance(const Ray &other, float *d, float *d2=0) const; [7 lines of code]
float Ray::Distance(const Ray &other) const; [4 lines of code]
float Ray::Distance(const Line &other, float *d, float *d2=0) const; [7 lines of code]
float Ray::Distance(const Line &other) const; [4 lines of code]
float Ray::Distance(const LineSegment &other, float *d, float *d2=0) const; [7 lines of code]
float Ray::Distance(const LineSegment &other) const; [4 lines of code]
float Ray::Distance(const Sphere &sphere) const; [4 lines of code]
float Ray::Distance(const Capsule &capsule) const; [4 lines of code]

Computes the distance between this ray 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.

Parameters

float *d [out]If specified, receives the parametric distance along this ray that specifies the closest point on this ray to the given object. The value returned here can be negative. This pointer may be null.float *d2 [out]If specified, receives the parametric distance along the other line that specifies the closest point on that line to this ray. The value returned here can be negative. This pointer may be null.

Performance

float Ray::Distance(const float3 &point, float *d) const

24.632nsecs/call ≈ 40.6M calls/second ≈ 676.64k calls/frame (@ 60fps).
This function does not perform dynamic memory allocation.

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

24.632nsecs/call ≈ 40.6M calls/second ≈ 676.64k calls/frame (@ 60fps).
This function does not perform dynamic memory allocation.

float Ray::Distance(const Ray &other, float *d, float *d2=0) const

0.074μsecs/call ≈ 13.53M calls/second ≈ 225.55k calls/frame (@ 60fps).
This function does not perform dynamic memory allocation.

float Ray::Distance(const Ray &other) const

0.078μsecs/call ≈ 12.82M calls/second ≈ 213.68k calls/frame (@ 60fps).
This function does not perform dynamic memory allocation.

float Ray::Distance(const Line &other, float *d, float *d2=0) const

0.074μsecs/call ≈ 13.53M calls/second ≈ 225.55k calls/frame (@ 60fps).
This function does not perform dynamic memory allocation.

float Ray::Distance(const Line &other) const

0.078μsecs/call ≈ 12.82M calls/second ≈ 213.68k calls/frame (@ 60fps).
This function does not perform dynamic memory allocation.

float Ray::Distance(const LineSegment &other, float *d, float *d2=0) const

0.074μsecs/call ≈ 13.53M calls/second ≈ 225.55k calls/frame (@ 60fps).
This function does not perform dynamic memory allocation.

float Ray::Distance(const LineSegment &other) const

0.078μsecs/call ≈ 12.82M calls/second ≈ 213.68k calls/frame (@ 60fps).
This function does not perform dynamic memory allocation.

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

28.737nsecs/call ≈ 34.8M calls/second ≈ 579.98k calls/frame (@ 60fps).
This function does not perform dynamic memory allocation.

float Ray::Distance(const Capsule &capsule) const

0.086μsecs/call ≈ 11.6M calls/second ≈ 193.33k calls/frame (@ 60fps).
This function does not perform dynamic memory allocation.

See Also

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

Leave a Comment

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