Linea


float x1 = 100;


float y1 = 150;


float x2 = 400;


float y2 = 300;




void setup() {


  size(600, 400);


  textSize(20);


}




void draw() {


  background(255);


  




  fill(255,255,255);


  ellipse(x1, y1, 1, 1);


  ellipse(x2, y2, 1, 1);


  



  stroke(0);


  line(x1, y1, x2, y2);


 


  float distancia = dist(x1, y1, x2, y2);


  


  fill(0);


  text("Distancia: " + nf(distancia, 1, 2), 20, height - 30);


}



Comentarios

Entradas populares de este blog

5)Peligros de red

Coches que se chocan con una bola