csharp/Alan-FGR/aelum/Farseer/Farseer%20Physics%20Engine%203.5/Common/LineTools.cs

LineTools.cs
using System;
using FarseerPhysics.Collision;
using Microsoft.Xna.Framework;

namespace FarseerPhysics.Common
{
    /// 
    /// Collection of helper methods for misc collisions.
    /// Does float tolerance and line collisions with lines and AABBs.
    /// 
    public static clast LineTools
    {
        public static float DistanceBetweenPointAndLineSegment(ref Vector2 point, ref Vector2 start, ref Vector2 end)
        {
            if (start == end)
                return Vector2.Distance(point, start);

            Vector2 v = Vector2.Subtract(end, start);
            Vector2 w = Vector2.Subtract(point, start);

            float c1 = Vector2.Dot(w, v);
            if (c1 = -Settings.Epsilon && denom = 0.0f && ua = 0.0f && ub