|
봐주셔서 감사합니다..^^
예전에 책쫌 본 기억을 되살려 고생고생함서
만든건데요.. 배열루 계산된거 있잖아요. 이걸 txt화일로
저장할려면 어떻게 하죠..??
가지고 있는책에 파일입출력부분은 봐두 잘모르겠습니다.ㅠㅠ
마지막으로 하나더.. 코드중에서요.. r_p_x 랑..
r_p_y .. 이게 x랑y좌푠데.. 이걸 그림으로 그릴려면
어떻게 해야하는지..ㅠㅠ
좀 갈켜주심 정말 감사드리겠습니다..
#include <iostream.h>
#include <math.h>
double degree_to_radian(double); //degree->radian
double radian_to_degree(double); //radian->degree
double R_x (double,double); //벡터의 x성분 계산
double R_y (double,double); //벡터의 y성분 계산
double theta_3 (double);
double theta_4 (double);
int main(int argc, char *argv[])
{
//방향
double t_2[36],t_s;
//크기
double r_1_x[36],r_1_y[36],s,s_x,s_y,t_3[36],t_4[36],
t_5[24],r_6_x[36],r_6_y[36],r_p_x[36],r_p_y[36];
int i,j;
for ( i=0,j=0;i<=360;i=i+10,j++)
{
t_2[j]=degree_to_radian(i);
//R_A벡터
r_1_x[j]=R_x(0.1,t_2[j]);
r_1_y[j]=R_y(0.1,t_2[j]);
//S벡터
s_x=r_1_x[j]+0.2;
s_y=r_1_y[j];
s=sqrt(s_x*s_x+s_y*s_y);
t_s=atan(s_y/s_x);
//theta 3
t_3[j]=t_s+theta_3(s);
t_3[j]=radian_to_degree(t_3[j]);
//theta 4
t_4[j]=t_s+theta_4(s);
t_4[j]=radian_to_degree(t_4[j]);
//theta 5
t_5[j]=t_3[j]-45;
t_5[j]=degree_to_radian(t_5[j]);
//R_pa벡터
r_6_x[j]=R_x(0.15,t_5[j]);
r_6_y[j]=R_y(0.15,t_5[j]);
//R_p벡터
r_p_x[j]=r_1_x[j]+r_6_x[j];
r_p_y[j]=r_1_y[j]+r_6_y[j];
cout<<t_2[j]<<"\t"<<t_3[j]<<"\t"<<t_4[j]<<"\t"<<
r_p_x[j]<<"\t"<<r_p_y[j]<<endl;
}
return 0;
}
double degree_to_radian(double a)
{
double b;
b=(a*3.14159265)/180;
return b;
}
double radian_to_degree(double a)
{
double b;
b=a*180/3.14159265;
return b;
}
double R_x (double a,double b)
{
double c;
c=a*cos(b);
return c;
}
double R_y (double a,double b)
{
double c;
c=a*sin(b);
return c;
}
double theta_3 (double a)
{
double b,c;
b=-1*0.252*0.252+-1*a*a+0.3*0.3;
b=b/(2*0.252*a);
c=acos(b);
return c;
}
double theta_4 (double a)
{
double b,c;
b=0.252*0.252+a*a-0.3*0.3;
b=b/(2*0.252*a);
c=acos(b);
return c;
}
|