AStar2D.getClosestPositionInSegment

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

More...
struct AStar2D
@nogc nothrow const
Vector2
getClosestPositionInSegment
(
in Vector2 to_position
)

Detailed Description

var astar = AStar2D.new() astar.add_point(1, Vector2(0, 0)) astar.add_point(2, Vector2(0, 5)) astar.connect_points(1, 2) var res = astar.get_closest_position_in_segment(Vector2(3, 3)) # Returns (0, 3)

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