package Algorithms; import edu.carleton.motion.*; import java.io.*; import java.util.*; import java.awt.*; /** Basic motion planning algorithm. Returns a two-point path for each * robot, where the first point is the start point and the second is the end. * @author Bill Graner, Dave Flynn * @version 10/5/03 */ public class StraightLine implements MPAlgorithm { //All your base are belong to us. public void draw (Graphics g) { } /** The motion planning method. Returns a straight line for each robot * to follow from start to end. */ public Vector solve(Scenario problem) { Vector paths = new Vector(problem.getNRobots()); for (int k=0; k < problem.getNRobots(); k++) paths.add(k, new SolutionPath()); // Vector pointPath; SolutionPath tempPath; Vector tempbuff; // for each robot/SE pair in the problem... for (int i=0; i < problem.getNRobots(); i++) { //pointPath = new Vector(2); // put the start & end points into a new vector tempPath = (SolutionPath) problem.getPath(i); ((SolutionPath)paths.get(i)).setStart (tempPath.getStartPoint(), tempPath.getStartOrient()); ((SolutionPath)paths.get(i)).setEnd (tempPath.getEndPoint(), tempPath.getEndOrient()); // ((SolutionPath)paths.get(i)).setPath(pointPath); // Put this vector into the vector of paths.. } ((SolutionPath)paths.get(0)).showValues(); return paths; } }