Outils pour utilisateurs

Outils du site


wiki:projets:optimizer:optimizer

Table des matières

NO WASTE/OPTIMIZER

  • Porteur du projet : PAPAZIAN Sévan
  • Date : 2019/2020
  • Objet :Réalisation d'une dispositif de médiation interactif
  • Titre :Optimizer

Intention :

L’objectif est de sensibiliser l’utilisateur au gaspillage dans l’industrie de la mode avant même l’assemblage d’une piece lors du patronage et malgré l’utilisation de logiciel permettant d’optimiser le placement des patrons sur les laises (bande de tissus) il reste des parties de tissus non utilisé et jetées. L’outils interactif me permet de mettre en place un dispositif ludique permettant à l’utilisateur de se prêter au jeu de l’optimisation de patron pour mettre le gaspillage qui en découle..

Je questionne la culture de l’industrie textile en mettant l’utilisateur face à un process industriel

Avec quels outils ?

https://processing.org/

Processing (autrefois typographié Proce55ing) est un environnement de développement libre (sous licence GNU GPL), créé par Benjamin Fry et Casey Reas, deux artistes américains. Processing est le prolongement « multimédia » de Design by numbers, l’environnement de programmation graphique développé par John Maeda au Media Lab du Massachusetts Institute of Technology.

Cette outils m’a permis de programmer une premiere ébauche de ce dispositif de mediation que j’ai baptisé OPTIMIZER le fonctionnement est simple, on dispose de plusieurs patron de vêtements qu’il faut arriver à disposer de façon la plus optimal dans le carré. L’utilisateur dispose de plusieurs touche pour faire tourner le patron etc..

Code :

TangramShape[] tangramset;
float tangramside;
PFont mono;
PImage img;
PImage img2;
int time;

void setup() {
  //size(displayWidth,displayHeight);


  size(500, 700);
  background(255);
  img = loadImage("fond3.png");  // Load the image into the program  
  

  tangramside = height/2;
  tangramset = new TangramShape[7];
  tangramset[0] = new TangramShape(new PVector(40, 30), tangramside, 2);
  tangramset[0].setRotation(-HALF_PI*2);
  tangramset[1] = new TangramShape(new PVector(90, 30), tangramside, 3);
  //tangramset[1].setRotation(HALF_PI*2);
  tangramset[2] = new TangramShape(new PVector(180, 30), tangramside, 3);
  tangramset[3] = new TangramShape(new PVector(270, 30), tangramside, 1);
  tangramset[3].setRotation(-HALF_PI*2);
  tangramset[4] = new TangramShape(new PVector(300, 130), tangramside, 1);
  tangramset[5] = new TangramShape(new PVector(400, 30), tangramside, 2);
  tangramset[5].setRotation(-HALF_PI*2);
  tangramset[6] = new TangramShape(new PVector(480, 30), tangramside, 3
    );
} 

{
}

void draw() {
  background(255);

  

  image(img, 0, 0);


  for (int i=0; i<tangramset.length; i++) {
    tangramset[i].update(mouseX, mouseY);
    tangramset[i].display();
  }
  timer();
}


void clear() { 
  tangramset[0].location = new PVector(40, 30);
  tangramset[0].setRotation(-HALF_PI*2);
  tangramset[1].location = new PVector(90, 30);
  //tangramset[1].setRotation(HALF_PI);
  tangramset[2].location = new PVector(180, 30);
  tangramset[2].setRotation(0);
  tangramset[3].location = new PVector(270, 30);
  tangramset[3].setRotation(-HALF_PI*2);
  tangramset[4].location = new PVector(300, 130);
  tangramset[4].setRotation(0);
  tangramset[5].location = new PVector(400, 30);
  tangramset[5].setRotation(-HALF_PI*2);
  tangramset[6].location = new PVector(480, 30);
  tangramset[6].setRotation(0);
}


void mouseReleased() {
  for (int i=0; i<tangramset.length; i++) {
    tangramset[i].click(mouseX, mouseY);
  }
}

void keyReleased() {
  if (key == ' ') {
    for (int i=0; i<tangramset.length; i++) {
      if (tangramset[i].selected) {
        tangramset[i].rotation+=PI/4.0;
      }
    }
  }
  if (key == 'b') {
    for (int i=0; i<tangramset.length; i++) {
      if (tangramset[i].selected) {
        tangramset[i].rotation-=PI/36.0;
      }
    }
  }
  if (key == 'n') {
    for (int i=0; i<tangramset.length; i++) {
      if (tangramset[i].selected) {
        tangramset[i].rotation = 0;
      }
    }
  }
  if (key == 'm') {
    for (int i=0; i<tangramset.length; i++) {
      if (tangramset[i].selected) {
        tangramset[i].rotation+=PI/36.0;
      }
    }
  }
  if (key == 'c') {
    clear();
  }
  if (key == 'l') {
    for (int i=0; i<tangramset.length; i++) {
      tangramset[i].showstroke = !tangramset[i].showstroke;
    }
  }
}

class TangramShape {
  PVector location;
  float rotation = 0;
  float squareside;
  float gridunit;
  int shapetype;
  boolean selected = false;
  boolean mouseover = false;
  boolean showstroke = true;

  TangramShape(PVector loc, float sqs, int typ) {
    location = loc;
    squareside = sqs;
    gridunit = squareside/8.0;
    shapetype = typ;
  }

  void display() {
    pushMatrix();
    translate(location.x, location.y);
    rotate(rotation);
    if (selected) {
      stroke(255, 0, 0);
      strokeWeight(2);
    } else {
      strokeWeight(1);
      if (showstroke) {
        stroke(255);
      } else {
        stroke(0);
      }
    }
    fill(0);
    switch(shapetype) {
    case 0: // Big triangle
      triangle(-4*gridunit, -2*gridunit, 4*gridunit, -2*gridunit, 0, 2*gridunit);
      if (mouseover) {
        stroke(255);
        ellipse(0, 0, gridunit/2, gridunit/2);
      }
      break;
    case 1: // Middle triangle
beginShape();
      vertex(-40,0);
      vertex(0, 0);
      vertex(40, -20);
      vertex(40, -40);
      vertex(-40, -40);
      vertex(-40, 0);
      endShape();

      if (mouseover) {
        stroke(255);
        ellipse(0, 0, gridunit/2, gridunit/2);
      }
      break;
    case 2: // Small triangle
      beginShape();
      vertex(-80, -10);
      vertex(-20, 0);
      vertex(-20, 0);
      vertex(0, -10);
      vertex(20, 0);
      vertex(80, -10);
      vertex(80, -40);
      vertex(40, -40);
      vertex(40, -120);
      vertex(-40, -120);
      vertex(-40, -40);
      vertex(-80, -40);
      vertex(-80, -10);

      // vertex(-40,-5);
      //vertex(-10,0);
      //vertex(-10,0);
      //vertex(0,-5);
      //vertex(10,0);
      //vertex(40,-5);
      //vertex(40,-20);
      //vertex(20,-20);
      //vertex(20,-60);
      //vertex(-20,-60);
      //vertex(-20,-20);
      //vertex(-40,-20);
      //vertex(-40,-5);

      endShape();
      if (mouseover) {
        stroke(255);
        ellipse(0, 0, gridunit/2, gridunit/2);
      }
      break;
    case 3:  // Square
      beginShape();
      vertex(-50, 0);
      vertex(50, 0);
      vertex(40, 160);
      vertex(4, 160);
      vertex(0, 50);
      vertex(-4, 160);
      vertex(-40, 160);
      vertex(-50, 0);
      endShape();

      if (mouseover) {
        stroke(255);
        ellipse(0, 0, gridunit/2, gridunit/2);
      }
      break;
    case 4:  // Rhomboid
      quad(-3*gridunit, -3*gridunit, gridunit, -4*gridunit, gridunit, -4*gridunit, 4*gridunit, gridunit);
      if (mouseover) {
        stroke(255);
        ellipse(0, 0, gridunit/2, gridunit/2);
      }
      break;
    }
    popMatrix();
  }

  void setRotation(float rot) {
    rotation = rot;
  }

  void update(float x, float y) {
    if (dist(x, y, location.x, location.y) < 2*gridunit) {
      mouseover = true;
    } else {
      mouseover = false;
    }
    if (selected) {
      location.x = x;
      location.y = y;
    }
  }

  void click(float x, float y) {
    switch(shapetype) {
    case 0: // Big triangle
      if (dist(x, y, location.x, location.y) < gridunit) {
        selected = !selected;
      }
      break;
    case 1: // Middle triangle
      if (dist(x, y, location.x, location.y) < gridunit) {
        selected = !selected;
      }
      break;
    case 2: // Small triangle
      if (dist(x, y, location.x, location.y) < gridunit) {
        selected = !selected;
      }
      break;
    case 3:  // Square
      if (dist(x, y, location.x, location.y) < gridunit) {
        selected = !selected;
      }
      break;
    case 4:  // Rhomboid
      if (dist(x, y, location.x, location.y) < gridunit) {
        selected = !selected;
      }
      break;
    }
  }
}

void timer() {
  time++;
  if (time>10000) {
    time = 0;  
    saveFrame();
     background(255);
     clear();
     
  }
}
wiki/projets/optimizer/optimizer.txt · Dernière modification: 2020/04/03 22:38 (modification externe)