martes, 17 de septiembre de 2024

Práctica 1


int x1=150;

int y1=300;

int x2=450;

int y2=400;

int r=100;

float d;

void setup(){
  
  size(600,600);
  background(255);
  
}

void draw(){

  dibujar();
  d=distancia(x1,y1,x2,y2);
  text(d,275,375);
  noLoop();
  
}

void dibujar(){
 
  fill(0,0,255);
  circle(x1,y1,r);
  circle (x2,y2,r);
  
}

float distancia(float dx1,float dy1,float dx2,float dy2){
 
  float dist;
  
  dist=sqrt((dx1-dx2)*(dx1-dx2)+(dy1-dy2)*(dy1-dy2)); 
  
  return dist;
  
}

No hay comentarios:

Publicar un comentario

Proyecto GPS

 PROYECTO GPS Aquí adjunto el proyecto del GPS, están tanto el build como la carpeta de Solar2S en el mismo comprimido. Proyecto GPS