Using sin() function

Interesting problem. The approach I would take would be to write your own function that uses sin(), but only some of the time. Like so:

void setup(){
  size(800,400);
}

void draw(){
  background(0);
  stroke(255);
  fill(255);
  translate(0,200);
  line(0,0,width,0);
  noStroke();
  for( int x = 0; x <width; x++){
    float a = map(x,0,width,0,TWO_PI+2);
    float y = sin_line(a,1);
    ellipse(x,-180*y,5,5);
  }
  
}

float sin_line(float a, float d) {
  // Takes an angle a, and a line length d, and returns the sin(a), except not really.
  // At the peaks of the sine curve are lines of length d where the wave stays at the peak.
  while( a < 0 ){
    a += TWO_PI;
  }
  while( a >= TWO_PI + d + d ){
    a -= TWO_PI + d + d;
  }
  // a is now in the range 0 to TWO_PI + 2 * d.
 
  if( a >= 0 && a < HALF_PI ){
    return sin(a);
  }
  if( a >= HALF_PI && a < HALF_PI + d ){
    return(1);
  }
  if( a >= HALF_PI + d && a < HALF_PI + d + PI ){
    return(sin(a-d));
  }
  if( a >= HALF_PI + d + PI && a < HALF_PI + d + PI + d){
    return(-1); 
  }
  if( a >= HALF_PI + d + PI + d){
    return(sin(a-(2*d))); 
  } 
  return(0); // Should not occur.
}

If you run this, you can see that it plots a sine wave, except the wave crests are not mountain peaks, but plateaus and plains.