Back to class index
LineSegment[Class Summary]
a
b
ctor (+3 overloads)
GetPoint(d)[const]
CenterPoint()[const]
Reverse()
Dir()[const]
Transform(transform) (+3 overloads)
Length()[const]
LengthSq()[const]
IsFinite()[const]
Equals(...)[const]
Contains(...)[const] (+1 overload)
ClosestPoint(point,d)[const] (+3 overloads)
Distance(point,d)[const] (+6 overloads)
Intersects(plane)[const] (+10 overloads)
IntersectsDisc(disc)[const]
ToRay()[const]
ToLine()[const]

LineSegment::ClosestPoint

Syntax

float3 LineSegment::ClosestPoint(const float3 &point, float *d=0) const; [8 lines of code]
float3 LineSegment::ClosestPoint(const Ray &other, float *d=0, float *d2=0) const; [12 lines of code]
float3 LineSegment::ClosestPoint(const Line &other, float *d=0, float *d2=0) const; [11 lines of code]
float3 LineSegment::ClosestPoint(const LineSegment &other, float *d=0, float *d2=0) const; [12 lines of code]

Computes the closest point on this line segment to the given object.

Parameters

float *d [out]If specified, this parameter receives the normalized distance along this line segment which specifies the closest point on this line segment to the specified point. This pointer may be null.float *d2 [out]If specified, this parameter receives the (normalized, in case of line segment) distance along the other line object which specifies the closest point on that line to this line segment. This pointer may be null.

Return Value

The closest point on this line segment to the given object.

Performance

float3 LineSegment::ClosestPoint(const float3 &point, float *d=0) const

16.421nsecs/call ≈ 60.9M calls/second ≈ 1.01M calls/frame (@ 60fps).
This function does not perform dynamic memory allocation.

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

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

float3 LineSegment::ClosestPoint(const Line &other, float *d=0, float *d2=0) const

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

float3 LineSegment::ClosestPoint(const LineSegment &other, float *d=0, float *d2=0) const

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

See Also

Contains(), Distance(), Intersects().

Leave a Comment

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