[ create a new paste ] login | about

Link: http://codepad.org/5iiR8vCR    [ raw code | output | fork ]

C, pasted on May 21:
#include <stdio.h>
#include <math.h>
#define D(x) ((x) * (x))
void f(double a, double b, double c, double *u, double *v, double *w)
{
  double x, y, h;
  x = (D(c) + D(a) - D(b)) / (2.0 * c);
  y = (D(c) + D(b) - D(a)) / (2.0 * c);
  h = sqrt(D(a) - D(D(c) + D(a) - D(b)) / (4 * D(c)));
  *u = acos(x / a);
  *v = acos(y / b);
  *w = acos(h / a) + acos(h / b);
}

int main()
{
  double x1, y1, x2, y2, x3, y3;
  double a, b, c, u, v, w;
  printf("1: "); scanf("%lf %lf", &x1, &y1);
  printf("2: "); scanf("%lf %lf", &x2, &y2);
  printf("3: "); scanf("%lf %lf", &x3, &y3);
  a = sqrt(D(x1 - x2) + D(y1 - y2));
  b = sqrt(D(x2 - x3) + D(y2 - y3));
  c = sqrt(D(x3 - x1) + D(y3 - y1));
  f(a, b, c, &u, &v, &w);
  printf("radian: %g, %g, %g\n", u, v, w);
  printf("anglar: %g, %g, %g\n", 180.0 * u / M_PI, 180.0 * v / M_PI, 180.0 * w / M_PI);
  return 0;
}
/* end */


Output:
1
2
3
4
5
In function `f':
undefined reference to `acos'
undefined reference to `acos'
undefined reference to `acos'
undefined reference to `acos'


Create a new paste based on this one


Comments: