왼쪽 위 모서리가 (0,0)이고 30도 각도로 시작한다고 가정하면 (0,300)의 시작점과 600의 선 길이 , 어떻게 라인의 끝점을 계산합니까 주어진 각도를 대표하는 라인.각도와 길이가 주어지면 좌표를 계산하는 방법
는 C 의사 코드는
main() {
int x,y;
getEndPoint(30, 600, 0, 300, &x, &y);
printf("end x=%d, end y=%d", x, y);
}
// input angle can be from 0 - 90 degrees
void getEndPoint(int angle, int len, int start_x, int start_y, int *end_x, int *end_y)
{
calculate the endpoint here for angle and length
*end_x = calculated_end_x;
*end_y = calculated_end_y;
}
end_x 및 end_y에 대한 유형 (int *)을 원할뿐 아니라 함수 끝 부분에서 과제를 뒤집어 쓰고 싶다고 가정합니다. –
감사합니다. 계산 된 값을 원했습니다. 그것을 반영하기 위해 편집 됨. – amanda
그는 당신의 기능 서명이 나쁘다는 것을 의미합니다. 내가 고칠거야. –