AStar.getClosestPositionInSegment

Returns the closest position to to_position that resides inside a segment between two connected points.

More...
struct AStar
@nogc nothrow const
Vector3
getClosestPositionInSegment
(
in Vector3 to_position
)

Detailed Description

var as = AStar.new()

as.add_point(1, Vector3(0,0,0)) as.add_point(2, Vector3(0,5,0))

as.connect_points(1, 2)

var res = as.get_closest_position_in_segment(Vector3(3,3,0)) # returns (0, 3, 0)

The result is in the segment that goes from y=0 to y=5. It's the closest position in the segment to the given point.

Meta