void DrawStreamlinesImplementation::operator()(
    const Grid<Vec2D<float>>& vector_field, const Grid<float>& scalar_field) {
  glScalef(1.0 / (vector_field.x() - 1), 1.0 / (vector_field.y() - 1), 1.0);
  calibrateColor(vector_field, scalar_field);

  vector<Vec2D<float>> seeds;

  srand(23123);
  for (size_t i = 0; i < LINE_COUNT; ++i) {
    Vec2D<float> point((float)(1 + rand() % 1000) / 999.0,
                       (float)(1 + rand() % 1000) / 999.0);
    seeds.push_back(point);
  }

  float depth = 0;
  for (auto& seed : seeds) {
    depth += 2.0 / LINE_COUNT;
    drawStreamline(seed, 0.5, vector_field, scalar_field, depth);
    drawStreamline(seed, -0.5, vector_field, scalar_field, depth);
  }
}
Example #2
0
void SoftADJDS311::calibrate(){
	delay(2); //wait for LED to come full brintness if used
	calibrateColor();  // This calibrates R, G, and B int registers
	calibrateClear();  // This calibrates the C int registers
	calibrateCapacitors();  // This calibrates the RGB, and C cap registers
}