I don’t know if some post like this was posted b4…
so how do I get the coords with distance ‘n’ angles?plz…I only want some source codes below on the form…(kinda…)
(int can be float or any thing that please U)
int[] getcoord_da(int dis,int angle){
…(your source codes…)
return(the_return_var_thing[]);
}
ps:if this form thing is wrong,do it another way.
I’m begginner…so donna about these…
I´m not sure I understood you right but I think what you want is code to convert polar coordinates (radius, angle) to rectangular (x and y).
This is done simply using sines and co-sines.
something like this:
#include <math.h>
.
.
.
// some coord type definition like this:
typedef struct coord
{
float x,y;
} COORD;
.
.
.
//some other code
.
.
.
COORD polar2rect(float r, float theta)
{
COORD p;
p.x=r*cos(theta);
p.y=r*sin(theta);
return p;
}
Remember to use theta in radians.
To convert to degrees and back use this formula
rad=pi*deg/180;
or
deg=180*rad/pi;