/usr/share/radiance/circle.cal is in radiance-materials 4R1+20120125-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | {
Calculate center and radius of circle based on three
points in the plane.
Beware colinear points and points parallel to y-axis.
6/4/2002 Greg Ward
solution due to Paul Bourke
Inputs:
x1,y1,x2,y2,x3,y3 - points on circle
Outputs:
xc, yc, r - center and radius
}
sq(x) : x*x;
ma = (y2-y1)/(x2-x1);
mb = (y3-y2)/(x3-x2);
xc = (ma*mb*(y1-y3) + mb*(x1+x2) - ma*(x2+x3)) / (2*(mb-ma));
yc = ((x1+x2)/2 - xc)/ma + (y1+y2)/2;
r = sqrt(sq(x2-xc) + sq(y2-yc));
|