• Create Account

Banner advertising on our site currently available from just \$5!

### #ActualMedo3337

Posted 18 May 2013 - 06:59 AM

Let me make it more clear

I have this function:

D3DXVECTOR3 GetRandomVector(D3DXVECTOR3 velocity)
{
D3DXVECTOR3 vVector;

// Pick a random Z between -1.0f and 1.0f.
vVector.z = GetRandMinMax( -1.0f, 1.0f );

// Get radius of this circle
float radius = (float)sqrt(1 - vVector.z * vVector.z);

// Pick a random point on a circle.
float t = GetRandMinMax( -D3DX_PI, D3DX_PI ); // I THINK THIS LINE SHOULD BE MODIFIED TO PICK A POINT LIMITED TO QUARTER OF THE CIRCLE (According to the direction of D3DXVECTOR3 velocity)

// Compute matching X and Y for our Z.

return vVector;
}


In the above method, the random vector is anywhere on the circle between (-D3DX_PI, D3DX_PI) I want to limit the random number to be only quarter of the circle based on the direction of D3DXVECTOR3 velocity.

### #3Medo3337

Posted 18 May 2013 - 06:58 AM

Let me make it more clear

I have this function:

D3DXVECTOR3 GetRandomVector(D3DXVECTOR3 velocity)
{
D3DXVECTOR3 vVector;

// Pick a random Z between -1.0f and 1.0f.
vVector.z = GetRandMinMax( -1.0f, 1.0f );

// Get radius of this circle
float radius = (float)sqrt(1 - vVector.z * vVector.z);

// Pick a random point on a circle.
float t = GetRandMinMax( -D3DX_PI, D3DX_PI );

// Compute matching X and Y for our Z.

return vVector;
}


In the above method, the random vector is anywhere on the circle between (-D3DX_PI, D3DX_PI) I want to limit the random number to be only quarter of the circle based on the direction of D3DXVECTOR3 velocity.

### #2Medo3337

Posted 18 May 2013 - 06:58 AM

Let me make it more clear

I have this function:

D3DXVECTOR3 GetRandomVector(D3DXVECTOR3 velocity)
{
D3DXVECTOR3 vVector;

// Pick a random Z between -1.0f and 1.0f.
vVector.z = GetRandomMinMax( -1.0f, 1.0f );

// Get radius of this circle
float radius = (float)sqrt(1 - vVector.z * vVector.z);

// Pick a random point on a circle.
float t = GetRandMinMax( -D3DX_PI, D3DX_PI );

// Compute matching X and Y for our Z.

return vVector;
}


In the above method, the random vector is anywhere on the circle between (-D3DX_PI, D3DX_PI) I want to limit the random number to be only quarter of the circle based on the direction of D3DXVECTOR3 velocity.

### #1Medo3337

Posted 18 May 2013 - 06:42 AM

Let me make it more clear

I have this function:

D3DXVECTOR3 GetRandomVector(D3DXVECTOR3 velocity)
{
D3DXVECTOR3 vVector;

// Pick a random Z between -1.0f and 1.0f.
vVector.z = GetRandomMinMax( -1.0f, 1.0f );

// Get radius of this circle
float radius = (float)sqrt(1 - vVector.z * vVector.z);

// Pick a random point on a circle.
float t = GetRandMinMax( -D3DX_PI, D3DX_PI );

// Compute matching X and Y for our Z.