AIMA.Core.Environment.XYEnv.XYEnvironmentState.withinRadius C# (CSharp) Method

withinRadius() private method

private withinRadius ( int radius, XYLocation agentLocation, XYLocation objectLocation ) : bool
radius int
agentLocation AIMA.Core.Util.DataStructure.XYLocation
objectLocation AIMA.Core.Util.DataStructure.XYLocation
return bool
        private bool withinRadius(int radius, XYLocation agentLocation,
                XYLocation objectLocation)
        {
            int xdifference = agentLocation.getXCoOrdinate()
                    - objectLocation.getXCoOrdinate();
            int ydifference = agentLocation.getYCoOrdinate()
                    - objectLocation.getYCoOrdinate();
            return Math.sqrt((xdifference * xdifference)
                    + (ydifference * ydifference)) <= radius;
        }
    }