Example #1
0
 void BoardView::mousePressEvent(QMouseEvent *event)
 {
   QPoint point{-1, -1};
   calculatePoint(point, event);
   
   if (point.x() != -1)
     emit pointClicked(point);
 }
Example #2
0
void EFX::calculatePoint(Function::Direction direction, int startOffset, qreal iterator, qreal* x, qreal* y) const
{
    iterator = calculateDirection(direction, iterator);
    iterator += convertOffset(startOffset + m_startOffset);

    if (iterator >= M_PI * 2.0)
        iterator -= M_PI * 2.0;

    calculatePoint(iterator, x, y);
}
Example #3
0
void EFX::calculatePoint(Function::Direction direction, int startOffset, float iterator, float* x, float* y) const
{
    iterator = calculateDirection(direction, iterator);
    iterator += convertOffset(startOffset + getAttributeValue(StartOffset));

    if (iterator >= M_PI * 2.0)
        iterator -= M_PI * 2.0;

    calculatePoint(iterator, x, y);
}
Example #4
0
 void BoardView::mouseMoveEvent(QMouseEvent *event)
 {
   QPoint point{-1, -1};
   calculatePoint(point, event);
   const bool needRepaint =(point != m_underMousePoint);
   m_underMousePoint = point;
   
   if (needRepaint)
     update();
 }
Example #5
0
void mouse (int button, int state, int x, int y) {

	switch(button) {
	case GLUT_LEFT_BUTTON:
		if (state == GLUT_DOWN) {
			startPosX = x;
			startPosY = y;
			calculatePoint(startPosX, startPosY);
			glutIdleFunc(moveCar);
		}
		break;
	case GLUT_RIGHT_BUTTON:
		if (state == GLUT_DOWN) {
			glutIdleFunc(resetLights);
		}
		break;
	default:
		break;
	}
}
Example #6
0
void EFX::preview(QVector <QPoint>& polygon, Function::Direction direction, int startOffset) const
{
    int stepCount = 128;
    int step = 0;
    qreal stepSize = (qreal)(1) / ((qreal)(stepCount) / (M_PI * 2.0));

    qreal i = 0;
    qreal x = 0;
    qreal y = 0;

    /* Resize the array to contain stepCount points */
    polygon.resize(stepCount);

    /* Draw a preview of the effect */
    for (step = 0; step < stepCount; step++)
    {
        calculatePoint(direction, startOffset, i, &x, &y);
        polygon[step] = QPoint(int(x), int(y));
        i += stepSize;
    }
}
Example #7
0
void EFX::preview(QPolygonF &polygon, Function::Direction direction, int startOffset) const
{
    int stepCount = 128;
    int step = 0;
    float stepSize = (float)(1) / ((float)(stepCount) / (M_PI * 2.0));

    float i = 0;
    float x = 0;
    float y = 0;

    /* Reset the polygon to fill it with new values */
    polygon.clear();

    /* Draw a preview of the effect */
    for (step = 0; step < stepCount; step++)
    {
        calculatePoint(direction, startOffset, i, &x, &y);
        polygon << QPointF(x, y);
        i += stepSize;
    }
}
Example #8
0
TTErr Bspline2D::processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
{
	TTAudioSignal&		out = outputs->getSignal(0);
	TTChannelCount		numOutputChannels = out.getNumChannelsAsInt();
	
	if (numOutputChannels != 2) {
		TTValue v = 2;		
		out.setMaxNumChannels(v);
		out.setNumChannels(v);		
	}
	
	TTAudioSignal&		in0 = inputs->getSignal(0);
	TTUInt16			 vs = in0.getVectorSizeAsInt();
	
	TTSampleValuePtr	inSampleX			= in0.mSampleVectors[0];
	TTSampleValuePtr	outSampleX    		= out.mSampleVectors[0];
	TTSampleValuePtr	outSampleY			= out.mSampleVectors[1];
    TTFloat64 f;
	
	for (int i=0; i<vs; i++) {	
						
		f = inSampleX[i] * 0.5; //0... 1. 
		
		if ((f > 0) && (f < 1)){
			interval = f * (TTFloat64)((mResolution - mDegree) + 2);
			calculatePoint();											// output intermediate point
			outSampleX[i] = b_op[0];
			outSampleY[i] = b_op[1];
			//outSampleZ[i] = b_op[2];
		} else if (f <= 0.0){
					// output the first point
		} else if (f >= 1.0){
				// output the last point
		}
	}
return kTTErrNone;
}
Example #9
0
bool EFX::preview(QVector <QPoint>& polygon) const
{
    bool retval = true;
    int stepCount = 128;
    int step = 0;
    qreal stepSize = (qreal)(1) / ((qreal)(stepCount) / (M_PI * 2.0));

    qreal i = 0;
    qreal x = 0;
    qreal y = 0;

    /* Resize the array to contain stepCount points */
    polygon.resize(stepCount);

    /* Draw a preview of a circle */
    for (step = 0; step < stepCount; step++)
    {
        calculatePoint(i, &x, &y);
        polygon[step] = QPoint(int(x), int(y));
        i += stepSize;
    }

    return retval;
}