Example #1
0
    // todo use Navmesh.GetLocalClearance
    static float GetLocalClearance(double2 a, double2 b, double2 c, Edge *exit, bool lhs)
    {
        var lba        = math.lengthsq(a - b);
        var lbc        = math.lengthsq(c - b);
        var clearance  = math.sqrt(math.min(lba, lbc));
        var constraint = TryGetConstraint(exit, clearance, b, lhs);

        if (constraint == null)
        {
            return((float)clearance);
        }
        return((float)math.length(Math.ClosestPointOnLineSegment(b, constraint->Org->Point, constraint->Dest->Point) - b));
    }