CommandInterpreter::CommandInterpreter( LEDStripe& LEDStripeInner, LEDStripe& LEDStripeOuter, int minimalOutput ) : m_LEDStripeInner( LEDStripeInner ) , m_LEDStripeOuter( LEDStripeOuter ) , m_mode( LogoModeClock ) , m_stripeType( StripeOuter ) , m_hour( 0 ) , m_minute( 0 ) , m_second( 0 ) , m_hourWidth( 2 ) , m_minuteWidth( 2 ) , m_secondWidth( 2 ) , m_minimalOutput( minimalOutput ) { m_hourColor = ColorHSV( 240, 255, 255 ); m_minuteColor = ColorHSV( 120, 255, 255 ); m_secondColor = ColorHSV( 0, 255, 255 ); m_backgroundColorOuter = ColorHSV( 0, 0, 50 ); m_backgroundColorInner = ColorHSV( 0, 0, 50 ); }
void CommandInterpreter::updatePixels() { if( m_mode == LogoModeClock ) { m_LEDStripeInner.addFullHSVColor( m_backgroundColorInner.h, m_backgroundColorInner.s, m_backgroundColorInner.v ); m_LEDStripeOuter.addFullHSVColor( m_backgroundColorOuter.h, m_backgroundColorOuter.s, m_backgroundColorOuter.v ); // hours clockHand( m_LEDStripeInner, m_hour, m_hourColor, 12 ); // minutes clockHand( m_LEDStripeOuter, m_minute, ColorHSV( 100, 255, 255 ), //m_minuteColor, 60 ); // seconds clockHand( m_LEDStripeOuter, m_second, m_secondColor, 60 ); m_LEDStripeInner.refresh(); m_LEDStripeOuter.refresh(); } else if( m_mode == LogoModeGeneric ) { } }
void Nova::draw(Cart& can) { const long double R = 1.0l; while (myRedraw) { myRedraw= false; #pragma omp parallel num_threads(myThreads) { unsigned int nthreads = omp_get_num_threads(); double blockstart = can.getCartHeight() / nthreads; unsigned int iterations; double smooth; for (unsigned int k = 0; k <= (can.getWindowHeight() / nthreads) && can.isOpen(); k++) { // As long as we aren't trying to render off of the screen... long double row = blockstart * omp_get_thread_num() + can.getMinY() + can.getPixelHeight() * k; for (long double col = can.getMinX(); col <= can.getMaxX(); col += can.getPixelWidth()) { complex c(col, row); complex z(1, 0); smooth = exp(-std::abs(z)); complex n, d, c1; complex r(1, 0); iterations = 0; while (std::abs(z) < 2.0l && iterations != myDepth) { iterations++; n = z * z * z - 1.0l; d = z * z * 3.0l; z = z + c - (R * n / d); smooth += exp(-std::abs(z)); } smooth /= myDepth; if (smooth != smooth || smooth < 0) // Check to see if smooth is NAN smooth = 0; smooth = smooth - (int)smooth; float mult = iterations/(float)myDepth; if (iterations == myDepth) can.drawPoint(col, row, BLACK); else can.drawPoint(col, row, ColorHSV((float) smooth * 6.0f, 1.0f, (float) smooth, 1.0f)); } can.handleIO(); if (myRedraw) break; } } manhattanShading(can); while (can.isOpen() && !myRedraw) can.sleep(); //Removed the timer and replaced it with an internal timer in the Canvas class } }