Example #1
0
        // define is in the wall by r
        public bool InWall(Vector vector, double r)
        {
            var metaDir = End.Normalize(Begin).Multiply(r / 2.0);
            var xBegin  = Begin.NewSubtract(metaDir);
            var xEnd    = End.NewAdd(metaDir);

            // x, y should > min && < max
            return(vector.X > Math.Min(xBegin.X, xEnd.X) &&
                   vector.X < Math.Max(xBegin.X, xEnd.X) &&
                   vector.Y > Math.Min(xBegin.Y, xEnd.Y) &&
                   vector.Y < Math.Max(xBegin.Y, xEnd.Y));
        }