circle_segment, a C code which carries out various computations associated with a circle segment, using gnuplot to illustrate some of the computations.
Begin with a circle of radius R. Choose two points P1 and P2 on the circle, and draw the chord P1:P2. This chord divides the circle into two pieces, each of which is called a circle segment. Consider one of the pieces. The "angle" THETA of this segment is the angle P1:C:P2, where C is the center of the circle. Let Q be the point on the chord P1:P2 which is closest to C. The "height" H of the segment is the distance from Q to the perimeter of the circle.
This library considers various computations, including:
Determine the angle THETA, given R and H.
Determine the height H, given R and THETA.
Determine the height H, given R and AREA.
Determine the width W, given R and H.
Determine the area, given R and H.
Determine the centroid, given R and H.
Select points uniformly at random from a segment, given R and H.
Determine a cumulative density function (CDF) for the height H2 of a circle segment defined by a point selected at random from a circle segment of height H.
Determine a quadrature rule that can be used to estimate integrals of functions f(x,y) over the segment.
CIRCLE_SEGMENT creates some graphics plots using gnuplot.
The computer code and data files described and made available on this web page are distributed under the MIT license
circle_segment is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version.
CIRCLE_RULE, a C code which computes quadrature rules for the unit circle in 2D, that is, the circumference of the circle of radius 1 and center (0,0).
GEOMETRY, a C code which performs geometric calculations in 2, 3 and M dimensional space, including the computation of angles, areas, containment, distances, intersections, lengths, and volumes.
gnuplot_test, C codes which illustrate how a program can write data and command files so that gnuplot can create plots of the program results.
STROUD, a C code which defines quadrature rules for a variety of M-dimensional regions, including the interior of the square, cube and hypercube, the pyramid, cone and ellipse, the hexagon, the M-dimensional octahedron, the circle, sphere and hypersphere, the triangle, tetrahedron and simplex, and the surface of the circle, sphere and hypersphere.