SHARE
TWEET

Untitled

a guest Feb 27th, 2020 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void DisplayMelc() {
  2.     double pi = 4 * atan(1.0);
  3.     double a = 0.3;
  4.     double b = 0.2;
  5.     double tmin = -1 * pi,tmax=pi;
  6.     double ratia = 0.005;
  7.     double proportia = 0.80;
  8.     double x, y;
  9.  
  10.     glColor3f(1, 0.1, 0.1); // rosu
  11.     glBegin(GL_LINE_STRIP);
  12.     for (double t = tmin + ratia; t < tmax; t+= ratia) {
  13.         x = 2.0 * (a * cos(t) + b)*cos(t);
  14.         y = 2.0 * (a * cos(t) + b) * sin(t);
  15.  
  16.  
  17.         glVertex2f(x*proportia, y*proportia);
  18.     }
  19.     glEnd();
  20. }
  21.  
  22. void DisplayCicloida() {
  23.     double a = 0.1;
  24.     double b = 0.2;
  25.     double tmin = -9.5, tmax = 9.5;
  26.     double ratia = 0.005;
  27.     double proportia=0.9;
  28.     double x, y;
  29.  
  30.  
  31.     glColor3f(1, 0.1, 0.1); // rosu
  32.     glBegin(GL_LINE_STRIP);
  33.     for (double t = tmin ; t < tmax; t += ratia) {
  34.         x = a * t - b * sin(t);
  35.         y = a-b*cos(t);
  36.         glVertex2f(x , y  );
  37.     }
  38.     glEnd();
  39. }
  40.  
  41. void DisplayHipocicloida() {
  42.     double pi = 4 * atan(1.0);
  43.     double R = 0.1;
  44.     double r = 0.3;
  45.     double tmin = 0, tmax = 2 * pi;
  46.     double ratia = 0.005;
  47.     double x, y;
  48.  
  49.     glColor3f(1, 0.1, 0.1); // rosu
  50.     glBegin(GL_LINE_STRIP);
  51.     for (double t = tmin; t < tmax; t += ratia) {
  52.         x = (R-r)*cos(r/R*t)-r*cos(t-r/R*t);
  53.         y = (R - r) *sin(r / R * t) - r * sin(t - r / R * t);
  54.  
  55.  
  56.         glVertex2f(x , y);
  57.     }
  58.     glEnd();
  59. }
  60. void DisplaySpiralaLogaritmica() {
  61.    
  62.     double ratia = 0.05;
  63.     double a = 0.02;
  64.    
  65.     glColor3f(1, 0.1, 0.1); // rosu
  66.     glBegin(GL_LINE_STRIP);
  67.     for (double t = 0 + ratia; t <=3; t += ratia) {
  68.        double r=a*exp(1+t);
  69.        double x = r * cos(t);
  70.        double y = r * sin(t);
  71.  
  72.         glVertex2f(x ,y );
  73.     }
  74.     glEnd();
  75. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top