Главная » 2017 » Ноябрь » 6 » Расчет нока с графической визуализацией
20:09
Расчет нока с графической визуализацией

 

float a;
float b;
float aist = 946;
float bist = 5;
int c;
float curA;
float sizible;
float k = 7;
float lines;
boolean trig;
float attemps;
float nok;
float first;
 float next;
void setup() {
frameRate(800);
 background(0, 50, 0);
 fill(0, 254, 0);
 a=aist;
 b=bist;
 a=abs(a);
 b=abs(b);
 size(640, 480);
 if(a>b) {
 sizible = a/500;
 }
  if(b>a) {
 sizible = b/500;
 }
}
void draw() {
  if(c >= 10000) {
    fill(255, 0, 0);
    text("ОШИБКА",60, 120);
  }
    if(a==0|b==0) {
    fill(255, 0, 0);
    text("ОШИБКА",60, 120);
  }
  if(c <= 10000) { 
  stroke(140, 60);
  line(lines, 150, lines, 640);
  lines = lines+k;
  if(a!=b) {
   if(a!=b) {
     stroke(0, 254, 0);
    if(a>b) {a=a-b; }
    if(b>a) {b=b-a; }
    float caOut = curA/sizible;
    float aOut = a/sizible;
    float cOut = c * k;
    float cmOut = c-1;
    cmOut = cmOut * k;
    line(cmOut,caOut + 150,cOut,aOut + 150);
    c++;
    curA = a;
    stroke(255, 255, 255, 40);
            line(0, aOut+150, 640, aOut+150);
   }   
  }
  if(trig==false) {
  if(a==b) {
    if(a==1) {
      fill(255, 0, 0);
    }
  text("НОД:"+a, 10, 70);
  text("Решено в (попытки):"+c, 10, 90);
  text("Масштаб по горизонтали крт/реал"+k+"/1", 10, 50);
      float caOut = curA/sizible;
    float aOut = a/sizible;
    float cOut = c * k;
    float cmOut = c-1;
    cmOut = cmOut * k;
    line(cmOut,caOut + 150,cOut,aOut + 150);
    trig=true;
    nok=a;
    attemps=c;
    first= aist/a;
next= bist/a;
    drob();
    if(a==1) {
     
    }

  }
  }
}
}
void mouseWheel(MouseEvent event) {
  float e = event.getCount();
  println(e);
  k=k+e/10;
   a=aist;
 b=bist;
 a=abs(a);
 b=abs(b);
  c=0;
curA = 0;;
sizible = 0;
lines = 0;
boolean trig = false;
clear();
 background(0, 50, 0);
 fill(0, 254, 0);
 a=abs(a);
 b=abs(b);
 size(640, 480);
 if(a>b) {
 sizible = a/500;
 }
  if(b>a) {
 sizible = b/500;
}
    if(first==aist) {
      fill(255, 0, 0);
    }
  text("НОД:"+nok, 10, 70);
  text("Решено в (попытки):"+attemps, 10, 90);
  text("Масштаб по горизонтали крт/реал"+k+"/1", 10, 50);
      float caOut = curA/sizible;
    float aOut = a/sizible;
    float cOut = c * k;
    float cmOut = c-1;
    cmOut = cmOut * k;
    line(cmOut,caOut + 150,cOut,aOut + 150);
    trig=true;
    drob();

}
void drob() {

 text(first, 550, 60);
 text(next, 550, 74);
 stroke(255);
 line(550, 62, 600, 62);

}

Компилятор "processing"

IDE "processing"

Просмотров: 28 | Добавил: semka | Рейтинг: 0.0/0
Всего комментариев: 0
iplogger.ru - IP Logging Service