동일한 문제가있었습니다. 여기에 C의 작은 스 니펫이 있습니다. 보시다시피 중심점에는 두 가지 점이 있습니다. 나는 그것이 도움이되기를 바랍니다. 내 신용 곧 이그나시오 :
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main(void)
{
float x1,y1; //Punto A
float x2,y2; //Punto B
float x3,y3; //Punto medio
float x,y;
float z,t; //los otros posibles puntos
float R; //Distancia
printf("Introduce Ax:\n");
scanf ("%f",&x1);
printf("Introduce Ay:\n");
scanf ("%f",&y1);
printf("Introduce Bx:\n");
scanf ("%f",&x2);
printf("Introduce By:\n");
scanf ("%f",&y2);
printf("Introduce Cx:\n");
scanf ("%f",&x3);
printf("Introduce Cy:\n");
scanf ("%f",&y3);
printf("Introduce la distancia:\n");
scanf ("%f",&R);
x=-((-(x2*x2)+2*x1*x2-(x1*x1))*x3-(x3*y1*y1)+(2*x3*y1*y2)-(x3*y2*y2)+(y2-y1)*sqrt(y2*y2-2*y1*y2+y1*y1+x2*x2-2*x1*x2+x1*x1)*R)/(y2*y2-2*y1*y2+y1*y1+x2*x2-2*x1*x2+x1*x1);
y=((y2*y2-2*y1*y2+y1*y1+x2*x2-2*x1*x2+x1*x1)*y3+(x2-x1)*sqrt(y2*y2-2*y1*y2+y1*y1+x2*x2-2*x1*x2+x1*x1)*R)/(y2*y2-2*y1*y2+y1*y1+x2*x2-2*x1*x2+x1*x1);
printf ("x=%f\n",x);
printf ("y=%f\n",y);
z=((y2-y1)*sqrt((y2*y2)-2*y1*y2+y1*y1+x2*x2-2*x1*x2+x1*x1)*R+x3*y2*y2-2*x3*y1*y2+x3*y1*y1+(x2*x2-2*x1*x2+x1*x1)*x3)/(y2*y2-2*y1*y2+y1*y1+x2*x2-2*x1*x2+x1*x1);
t=-((x2-x1)*sqrt(y2*y2-2*y1*y2+y1*y1+x2*x2-2*x1*x2+x1*x1)*R+(-(y2*y2)+2*y1*y2-(y1*y1)-(x2*x2)+2*x1*x2-(x1*x1)*y3))/(y2*y2-2*y1*y2+y1*y1+x2*x2-2*x1*x2+x1*x1);
printf ("\nx=%f\n",z);
printf ("y=%f\n",t);
system("pause");
return 0;
}
'하나의 끝점에서 다른 쪽 끝으로 원호 그리기', 실제로 여기에 붙어 있습니다. 호를 그릴 수있는 두 가지 방법, 호가 3 점 모두를 통과하도록 호를 그리는 방법, 그것이 어려운 부분입니다. – Graviton
세 가지 포인트 중 'atan2()'를 사용하십시오. 처음 두 줄이 있기 때문에 원하는 순서를 알 수 있습니다. 라인이 올라올 때까지 2 * pi를 추가하십시오. –
@lgnacio, 나는 당신의 의견을 이해하지 못한다. – Graviton