Advertisement

Screen Directions

Started by April 09, 2001 05:13 AM
1 comment, last by MTProd 23 years, 10 months ago
Hello, I would like to create a simple direction engine like "Donuts" the DirectDraw exemple delivred with DirectX SDK... It Look like this: float dirX[40] = { 0.000000f, 0.156434f, 0.309017f, 0.453991f, 0.587785f, 0.707107f, 0.809017f, 0.891007f, 0.951057f, 0.987688f, 1.000000f, 0.987688f, 0.951057f, 0.891007f, 0.809017f, 0.707107f, 0.587785f, 0.453990f, 0.309017f, 0.156434f, 0.000000f, -0.156435f, -0.309017f, -0.453991f, -0.587785f, -0.707107f, -0.809017f, -0.891007f, -0.951057f, -0.987688f, -1.000000f, -0.987688f, -0.951056f, -0.891006f, -0.809017f, -0.707107f, -0.587785f, -0.453990f, -0.309017f, -0.156434f, }; float dirY[40] = { -1.000000f, -0.987688f, -0.951057f, -0.891007f, -0.809017f, -0.707107f, -0.587785f, -0.453990f, -0.309017f, -0.156434f, 0.000000f, 0.156434f, 0.309017f, 0.453991f, 0.587785f, 0.707107f, 0.809017f, 0.891007f, 0.951057f, 0.987688f, 1.000000f, 0.987688f, 0.951057f, 0.891006f, 0.809017f, 0.707107f, 0.587785f, 0.453990f, 0.309017f, 0.156434f, 0.000000f, -0.156435f, -0.309017f, -0.453991f, -0.587785f, -0.707107f, -0.809017f, -0.891007f, -0.951057f, -0.987688f, }; If your are alwalys there I would like to do exactly this but whit more or less directions (per exemple: 36 directions or 50) How I must calculate it ? Do I have to use matrix, vector ? Thanks to help me and have a good week ! Mathieu Boillat MTProd Director http://www.mtprod.com
Mathieu BoillatMTProd Directorhttp://www.mtprod.com
Looks like a sine lookup table...
(the first is a cosine and second is a sine lookup table)

calc like this:

#define vecsize 12;

float dirX[vecsize];
#define PI 3.14
for(int ix = 0; ix < vecsize;ix++)
{
dirX[ix] = sin((2*PI)/vecsize*ix); // this sin function expects radians
}


Edited by - JOL on April 9, 2001 7:04:26 AM
hmmm.... i in squarebrackets meant italic


Edited by - JOL on April 9, 2001 7:08:56 AM
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~I'm looking for work
Advertisement
Thanks a Lot, that's cool !

Did you know a fonction to look at a point like this:

char LookOn( lookX, lookY )
{
// This function should return the direction that look at pixel "lookX" and pixel "lookY"
}

That's more hard...

Still thank you for your help !

Edited by - MTProd on April 9, 2001 4:02:33 PM
Mathieu BoillatMTProd Directorhttp://www.mtprod.com

This topic is closed to new replies.

Advertisement