void drawLine(int _i){

float strokewidth = 10; // how much to times vector 

Vec2d a = drawLinePoints[_i];// point 1

Vec2d b = drawLinePoints[_i+1]; // point 2

  

  Vec2d v = b-a; // get vector minus two point vects

  Vec2d vp;

  

  vp.x = v.y *-1.0;// times by inverse cosine is inversly proportional to sine

  vp.y = v.x;

  

  vp.normalize();

  

  Vec2d c = (a+vp * strokewidth);

  Vec2d d = (a-vp * strokewidth);

  

   glVertex2f(c.x, c.y); // puts points

   glVertex2f(d.x, d.y); // puts points   

  

}



void drawPoints(){

float spacing=20;

  //printf( "%f %f\n",  mouseDX,mouseDY );

  Vec2d v = Vec2d();

  //if ( mouseX != prevX || mouseY != prevY){//without spacing

  if ((mouseDX - spacing >= prevX || mouseDX + spacing <= prevX) || (mouseDY - spacing >= prevY || mouseDY+spacing<= prevY)){


     v.x =  mouseDX;

     v.y =  mouseDY;

     prevX = v.x;

     prevY = v.y;

  drawLinePoints[pointCounter] = v;

pointCounter++;

printf( "%f %f\n",  mouseDX, mouseDY );

  

  }

  for (int i = 0; i < pointCounter; i++){

     Vec2d p = drawLinePoints[i];

drawLine(i);

     glVertex2f(p.x, p.y); // puts points

printf( "%f %f\n", p.x,p.y);

}



}