Projets d'introduction au graphisme des Ordinateurs(IGOR)

2011-2016 L1 MPI


avant apres

2017-2019 L1 MPI


avant apres

2021-2022 L1 MPI et LDD MI

silhou0silhou

2022-2023 L1 MPI et LDD MI


2023-2024 L1 MPI et LDD MI


2024-2025 L1 MPI et LDD MI

2025-2026 L1 MPI et LDD MI

  • le code de la fonction IsPointIn()
  •   // inspire de Jonas Raoni Soares Silva
      // http://jsfromhell.com/math/is-point-in-poly [rev. #0]
      boolean isPointIn(PVector pt){
        boolean c = false;
        for(int i = -1, l = pts.size(), j = l - 1; ++i < l; j = i)
          if (((pts.get(i).y <= pt.y && pt.y < pts.get(j).y) || (pts.get(j).y <= pt.y && pt.y < pts.get(i).y))
               && (pt.x < (pts.get(j).x - pts.get(i).x) * (pt.y - pts.get(i).y) / (pts.get(j).y - pts.get(i).y) + pts.get(i).x))
            c = !c;
        return c;
      }
    
    
  • le code de la fonction colorDist()
  • /**
     CALCULATES A 'DISTANCE' BETWEEN TWO COLORS
     dist=0.0 should mean the very same color. 
     distance between black and white should be 1
     distance between opaque and transparent color should be 1
     from: http://stackoverflow.com/questions/5066439/compare-pixel-colour-java
     with alpha and normalisation added  ***/
    float colorDist(color c1, color c2) {
      float rmean =(red(c1) + red(c2)) / 2;
      float r = red(c1) - red(c2);
      float g = green(c1) - green(c2);
      float b = blue(c1) - blue(c2);
      float a = (alpha(c1) - alpha(c2))/255.0;
      return Math.max(a, sqrt((int(((512+rmean)*r*r))>>8)+(4*g*g)+(int(((767-rmean)*b*b))>>8))/764.8333);
    } // colorDist()
    



    ... et bonne chance !