Hello, I want to calculate the points of an elliptical arc, but I do not really now, how to use
void al_calculate_arc(float* dest, int stride, float cx, float cy,
float rx, float ry, float start_theta, float delta_theta, float thickness,
int num_segments)
Could you give me an example how to store the values of the arc, if cx, cy, rx, ry, start_theta, delta_theta and thickness are given?
[edit] removed; posted in the wrong place
Nice game, but that doesn't help me
Woah. , I was wondering where my post went. I was like "I swear I posted it!
"
void al_calculate_arc(float* dest, int stride, float cx, float cy, float rx, float ry, float start_theta, float delta_theta, float thickness, int num_segments)
The key is 'num_segments'. You need to have room in 'dest' (in an array or dynamically allocated memory) for at least num_segments*2 x and y values, and if it's a packed array then stride should be 2*sizeof(float). It will store the coordinates of the arc in the 'dest' array. If thickness is greater than zero you need twice as many elements in the array.
For a quick code example here :
#define NUM_PTS 10 float fltarray[2*NUM_PTS]; float* fltarray2 = new float[2*NUM_PTS]; float* fltarray3 = new float[2*2*NUM_PTS]; al_calculate_arc(fltarray , 2*sizeof(float) , 0 , 0 , 100 , 50 , M_PI/2.0f , M_PI/2.0f , 0 , NUM_PTS); al_calculate_arc(fltarray2 , 2*sizeof(float) , 0 , 0 , 100 , 50 , M_PI/2.0f , M_PI/2.0f , 0 , NUM_PTS); al_calculate_arc(fltarray3 , 4*sizeof(float) , 0 , 0 , 100 , 50 , M_PI/2.0f , M_PI/2.0f , 10.0f , NUM_PTS);
Here's my example:
{"name":"609792","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/4\/24345a9c83882bd68f82b63576d033b6.png","w":1375,"h":893,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/4\/24345a9c83882bd68f82b63576d033b6"}
This example program shows for 2 seconds then closes.