package org.lucci.madhoc.simulation.projection;

import org.lucci.madhoc.network.Station;
import org.lucci.up.data.Point;

/*
 * Created on May 3, 2005
 */

/**
 * @author luc.hogie
 */
public class RoundWindowProjection extends WindowProjection
{
    /* (non-Javadoc)
     * @see org.lucci.madhoc.simulation.DeviceRelevancy#deviceIsRelevant(org.lucci.madhoc.network.hardware.Device)
     */
    public boolean acceptComputer(Station computer)
    {
        double edgeLength = computer.getNetwork().getNetworkEnvironment().getGrid().getEdgeLenght();
        Point center = new Point(edgeLength / 2, edgeLength / 2);
        double radius = getRadiusRatio() * edgeLength / 2; 
        double distanceToCenter = computer.getLocation().getDistanceTo(center);

        return distanceToCenter < radius;
    }

    /* (non-Javadoc)
     * @see org.lucci.madhoc.simulation.projection.Projection#getName()
     */
    public String getName()
    {
        return "Round window";
    }
}