Hi,

finally I made a little motion path.

void
animatePath(QCAR::Matrix44F& modelViewMatrix)
{
//while(checkMovement){
switch(checkMovementState){
case moveXAxe:
if(translateCubeX < 150.0f)
{
translateCubeX = translateCubeX + 1.0f;
SampleUtils::translatePoseMatrix(translateCubeX, -50.0f, 50.0f,&modelViewMatrix.data[0]);
}else
{
winkelX = (CurveX);
winkelY = (CurveY);
radX = winkelX * PI / 180;
radY = winkelY * PI / 180;
CurveYHolder = (float)(1.0f * (sin(radX)));
CurveXHolder =(float)(1.0f*(1 - (cos(radY))));
translateCubeY = translateCubeY + CurveYHolder;
translateCubeX = translateCubeX - CurveXHolder;
LOG("CurveXHolder: %f, CurveYHolder: %f",CurveXHolder, CurveYHolder);
SampleUtils::translatePoseMatrix(translateCubeX, translateCubeY, 50.0f,&modelViewMatrix.data[0]);
checkMovementState = 2;
}
break;
case moveCurve:
if(winkelX < 360)
{
winkelX = (CurveX);
winkelY = (CurveY);
radX = winkelX * PI / 180;
radY = winkelY * PI / 180;
CurveYHolder = (float)(1.0f * (sin(radX)));
CurveXHolder =(float)(1.0f*(1 - (cos(radY))));
translateCubeY = translateCubeY + CurveYHolder;
translateCubeX = translateCubeX - CurveXHolder;
LOG("CurveXHolder: %f, CurveYHolder: %f",CurveXHolder, CurveYHolder);
SampleUtils::translatePoseMatrix(translateCubeX, translateCubeY, 50.0f,&modelViewMatrix.data[0]);
CurveX = CurveX +1.0f;
CurveY = CurveY +1.0f;
}else
{
CurveX = 1.0f;
CurveY = 1.0f;
winkelX = 0.0f;
winkelX = (CurveX*2);
winkelY = (CurveY*2);
radX = winkelX * PI / 180;
radY = winkelY * PI / 180;
CurveYHolder = (float)(sin(radY) * 2);
CurveXHolder = (float) (2*cos(radX));
CurveXHolder = (float) CurveXHolder -2;
translateCubeY = translateCubeY + CurveYHolder;
translateCubeX = translateCubeX - CurveXHolder;
LOG("CurveXHolder: %f, CurveYHolder: %f",CurveXHolder, CurveYHolder);
SampleUtils::translatePoseMatrix(translateCubeX, translateCubeY, 50.0f,&modelViewMatrix.data[0]);
CurveX = CurveX +1.0f;
CurveY = CurveY +1.0f;
checkMovementState = 3;
}
break;
case moveCurveExperiment:
if(winkelX < 180)
{
winkelX = (CurveX*2);
winkelY = (CurveY*2);
radX = winkelX * PI / 180;
radY = winkelY * PI / 180;
CurveYHolder = (float)(sin(radY) * 2);
CurveXHolder = (float) (2*cos(radX));
CurveXHolder = CurveXHolder -2;
translateCubeY = translateCubeY + CurveYHolder;
translateCubeX = translateCubeX - CurveXHolder;
LOG("CurveXHolder: %f, CurveYHolder: %f",CurveXHolder, CurveYHolder);
SampleUtils::translatePoseMatrix(translateCubeX, translateCubeY, 50.0f,&modelViewMatrix.data[0]);
CurveX = CurveX +1.0f;
CurveY = CurveY +1.0f;
}else
{
translateCubeX = 50.0f;
translateCubeY = -50.0f;
translateCubeX = translateCubeX + 1.0f;
SampleUtils::translatePoseMatrix(translateCubeX, -50.0f, 50.0f,&modelViewMatrix.data[0]);
checkMovementState = 1;
CurveX = 1.0f;
CurveY = 1.0f;
}
break;
}
//}
}

There are a few things which I don't understand.

The first and second formula are very similar. The first one is from a book and the second one is from me.

One problem are both if-statements. For winkelX
I have also no idea where the origin is and what the value of the radius means "((2*cos(radX));". I tested a lot to find a value which fits my screen size.

Greetz

Robert

Hi,

finally I made a little motion path.

There are a few things which I don't understand.

The first and second formula are very similar. The first one is from a book and the second one is from me.

One problem are both if-statements. For winkelX I have also no idea where the origin is and what the value of the radius means "((2*cos(radX));". I tested a lot to find a value which fits my screen size.

Greetz

Robert