/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Examen;

/**
 *
 * @author felix
 */
public class Linea {
    private Punto inicio;
    private Punto fin;
    
    public Linea(Punto P1, Punto P2) {
        inicio = P1;
        fin = P2;
    }
    
    public double distancia(){
        double d;
        
        d = (inicio.getX() - fin.getX())*(inicio.getX() - fin.getX())
         +  (inicio.getY() - fin.getY())*(inicio.getY() - fin.getY());
        
        return Math.sqrt(d);
    }
    
    @Override
    public String toString() {
        return inicio + " - " + fin  + " d = " + distancia();
    }
    
    Punto getInicial() {
        return inicio;
    }
    
}
