Facebook
From Coral Bee, 8 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 357
  1. #include "StdAfx.h"
  2. #include "F_Liniowa.h"
  3.  
  4.  
  5. CF_Liniowa::CF_Liniowa()
  6. {
  7.        
  8. }
  9.  
  10. CF_Liniowa::~CF_Liniowa(void)
  11. {
  12. }
  13.  
  14. void CF_Liniowa::Rysuj()
  15. {
  16.         // Rysowanie funkcji:
  17.  
  18. glBegin(GL_LINE_STRIP);
  19.  
  20. glColor3f(1,0,0);//czerwony kolor      
  21.  
  22. for (std::list<CPunkt>::iterator it=lista.begin(); it != lista.end(); ++it)
  23. glVertex3f(it->pozycja[0],it->pozycja[1],it->pozycja[2]);
  24.  
  25. glEnd();
  26. /*
  27. CPunkt pom;
  28. pom.pozycja[0]=0;
  29. pom.pozycja[1]=0;
  30. pom.pozycja[2]=0;
  31.  
  32. glBegin(GL_LINES); //linia
  33. for (std::list<CPunkt>::iterator it=lista.begin(); it != lista.end(); it++)
  34. {
  35. for (std::list<CPunkt>::iterator it=lista.begin(); it != lista.end(); ++it)
  36.         {
  37.                 if(it->pozycja[0]==0)
  38.                 {
  39.                 pom.pozycja[0]=it->pozycja[0];
  40.                 pom.pozycja[1]=it->pozycja[1];
  41.                 pom.pozycja[2]=it->pozycja[2];
  42.                 }
  43.  
  44.                 if(it->pozycja[0]!=0)
  45.                 {
  46.                 glColor3f(1,0,0);//zielony kolor
  47.                 glBegin(GL_LINES); //linia
  48.                 glVertex3f(pom.pozycja[0],pom.pozycja[1],pom.pozycja[2]);
  49.                 glVertex3f(it->pozycja[0],it->pozycja[1],it->pozycja[2]);
  50.                 glEnd();
  51.                 pom.pozycja[0]=it->pozycja[0];
  52.                 pom.pozycja[1]=it->pozycja[1];
  53.                 pom.pozycja[2]=it->pozycja[2];
  54.                 }
  55.         }
  56. } */
  57.  
  58. }
  59.  
  60. void CF_Liniowa::konstr(int A, int B)
  61. {
  62.         lista.clear();
  63.         for(int i=-100;i<=100;i++)
  64.         {
  65.                 CPunkt tmp;
  66.                 tmp.pozycja[0]=i;
  67.                 tmp.pozycja[1]=A*i+B;
  68.                 tmp.pozycja[2]=0;
  69.                 lista.push_back(tmp);
  70.         }
  71.         for (std::list<CPunkt>::iterator it=lista.begin(); it != lista.end(); ++it)
  72.         {
  73.                
  74.         }
  75. }