Hello,
I finally got some credible results.
But Only one thing
When the agent travels from say radian of 0
and when it elevates to a directional vector of which it has a -ve x component (I meant just going left)
The right solution comes up to my mind was the agent turns right and starts to elevate and goes around
eventually hitting a sort of upwards vector which pointing to the left and going into the screen somewhat.
But With Slerp or Lerp which comes from D3DX, the interpolation always wants to choose the shortest path,
I want the interpolation function takes the longer path, which indeed has to go around a large helix
before hitting the straight line segment, In my case, it chooses a shorter path and then connects with
the straight line with an abrupt turn which I believe is wrong.
When the dubins got some ideas knowing it is a right turn, can I force the Slerp or Lerp to go around
and choose the longer path?
Or In the picture, the agent actually has to go the other way round, but it *must* choose a longer path before
it stops the interpolation.
Hang on, I double checked, looks like the directional vector is wrong, the right turn ends at 0.6,xx,xx What the heck
So the interpolation will stop very quickly
Thanks
Jack[attachment=33558:2016-09-30 16_31_13-TestSB.jpg]
But wait a minute
Why with a right turn, the center of rotation should be in the positive x range
What did I do wrong?
[attachment=33559:2016-09-30 16_59_18-TestOpenTissue2 (Debugging) - Microsoft Visual Studio (Administrator).jpg]
Oh hell yeah.... rotZ(PI/2) instead of rotZ(-PI/2)
D3DXVECTOR3 dot(D3DXVECTOR3 t1, D3DXMATRIX t2)
{
// x = ax + by + cz
// y = px + qy + rz
// z = ux + vy + wz
//double x = t1.x * t2._11 + t1.y * t2._21 + t1.z * t2._31;
//double y = t1.x * t2._12 + t1.y * t2._22 + t1.z * t2._32;
//double z = t1.x * t2._13 + t1.y * t2._23 + t1.z * t2._33;
double x = t1.x * t2._11 + t1.y * t2._12 + t1.z * t2._13;
double y = t1.x * t2._21 + t1.y * t2._22 + t1.z * t2._23;
double z = t1.x * t2._31 + t1.y * t2._32 + t1.z * t2._33;
return D3DXVECTOR3(x, y, z);
}
D3DXMATRIX rotZ(float angle)
{
D3DXMATRIX rZ;
D3DXMatrixIdentity(&rZ);
D3DXMatrixRotationZ(&rZ, angle);
return rZ;
}
Okay, I know now, I messed up the code before, I just did too much to the code[attachment=33560:2016-09-30 17_31_22-TestSB.jpg]