/*/*
 * AngLine.java                Jonathan Kallay 7/14/99
 * (c) 1999 Williams College
 */
import java.awt.*;
import objectdraw.*;

/**
 * AngLine is an implementation of a Line which can be specified by its origin, length and angle
 * to the horizontal.
 *
 * @author Jonathan Kallay
 * @version 1.0 last update 8/25/99
 * @version 1.1 last update 11/4/99 by Kim Bruce to use Location
 */
public class AngLine extends Line implements LineInterface{

        private double length;                // length of line
          private double angle;                // angle of line to horizontal (measuring from up from positive x-axis)

  /**
   * Creates a new Line object.
   * @param start - the starting coordinates of the line.
   * @param length - the length of the line.
   * @param radianAngle - the angle between the line and the positive x-axis.
   * @param canvas - the canvas in which the line is created.
   */
        public AngLine(Location start, double length, double radianAngle, DrawingCanvas canvas){
           super(start,new Location(start.getX() + length*Math.cos(radianAngle),
                                                                                            start.getY() - length*Math.sin(radianAngle)),canvas);
            this.length = length;
            angle = radianAngle;
  }

  // returns coordinates of other end of line
  public Location getDest() {
                  return new Location(start.getX() + length*Math.cos(angle),
                                                                      start.getY() - length*Math.sin(angle));
  }
}
