CIRCLE_SEGMENT
Area, Height, Angle, Sampling and Quadrature
CIRCLE_SEGMENT
is a C library 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.
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
CIRCLE_SEGMENT is available in
a C version and
a C++ version and
a FORTRAN77 version and
a FORTRAN90 version and
a MATLAB version.
Related Data and Programs:
CIRCLE_RULE,
a C library 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 library which
performs geometric calculations in 2, 3 and M dimensional space,
including the computation of angles, areas, containment, distances,
intersections, lengths, and volumes.
GNUPLOT,
C programs which
illustrate how a program can write data and command files
so that gnuplot can create plots of the program results.
STROUD,
a C library which
defines quadrature rules for a variety of Mdimensional regions,
including the interior of the square, cube and hypercube, the pyramid,
cone and ellipse, the hexagon, the Mdimensional octahedron,
the circle, sphere and hypersphere, the triangle, tetrahedron and simplex,
and the surface of the circle, sphere and hypersphere.
Source Code:
Examples and Tests:
Test number 6 creates some samples of points in circle segments, and
writes out data files and gnuplot command files to create graphics:

sample01_boundary.txt,
data defining the boundary of the circle segment.

sample01_commands.txt,
commands to gnuplot to create a plot.

sample01_data.txt,
the sample data.

sample01.png,
the plot

sample02_boundary.txt,
data defining the boundary of the circle segment.

sample02_commands.txt,
commands to gnuplot to create a plot.

sample02_data.txt,
the sample data.

sample02.png,
the plot

sample03_boundary.txt,
data defining the boundary of the circle segment.

sample03_commands.txt,
commands to gnuplot to create a plot.

sample03_data.txt,
the sample data.

sample03.png,
the plot

sample04_boundary.txt,
data defining the boundary of the circle segment.

sample04_commands.txt,
commands to gnuplot to create a plot.

sample04_data.txt,
the sample data.

sample04.png,
the plot
List of Routines:

CIRCLE_SEGMENT_ANGLE_FROM_CHORD computes the angle of a circle segment.

CIRCLE_SEGMENT_ANGLE_FROM_CHORD_ANGLES computes angle of a circle segment.

CIRCLE_SEGMENT_ANGLE_FROM_HEIGHT computes the angle of a circle segment.

CIRCLE_SEGMENT_AREA_FROM_ANGLE computes the area of a circle segment.

CIRCLE_SEGMENT_AREA_FROM_CHORD computes the area of a circle segment.

CIRCLE_SEGMENT_AREA_FROM_HEIGHT computes the area of a circle segment.

CIRCLE_SEGMENT_AREA_FROM_SAMPLE computes the area of a circle segment.

CIRCLE_SEGMENT_CDF computes a CDF related to a circle segment.

CIRCLE_SEGMENT_CENTROID_FROM_CHORD computes the centroid of a circle segment.

CIRCLE_SEGMENT_CENTROID_FROM_HEIGHT computes centroid of a circle segment.

CIRCLE_SEGMENT_CENTROID_FROM_SAMPLE estimates a circle segment centroid.

CIRCLE_SEGMENT_CONTAINS_POINT reports whether a point is in a circle segment.

CIRCLE_SEGMENT_HEIGHT_FROM_ANGLE: height of a circle segment from angle.

CIRCLE_SEGMENT_HEIGHT_FROM_AREA: height of a circle segment from area.

CIRCLE_SEGMENT_HEIGHT_FROM_CHORD: height of a circle segment from chord.

CIRCLE_SEGMENT_SAMPLE_FROM_CHORD samples points from a circle segment.

CIRCLE_SEGMENT_SAMPLE_FROM_HEIGHT samples points from a circle segment.

CIRCLE_SEGMENT_WIDTH_FROM_HEIGHT computes the width of a circle segment.

FILENAME_INC increments a partially numeric file name.

R8_ACOS computes the arc cosine function, with argument truncation.

R8_ASIN computes the arc sine function, with argument truncation.

R8_ATAN computes the inverse tangent of the ratio Y / X.

R8_EPSILON returns the R8 round off unit.

R8_MAX returns the maximum of two R8's.

R8_MIN returns the minimum of two R8's.

R8_UNIFORM_01 returns a pseudorandom R8 scaled to [0,1].

R8MAT_UNIFORM_01_NEW fills an R8MAT with pseudorandom values scaled to [0,1].

R8VEC_LINSPACE_NEW creates a vector of linearly spaced values.

R8VEC_SUM returns the sum of an R8VEC.

R8VEC_UNIFORM_01_NEW returns a unit pseudorandom R8VEC.

TIMESTAMP prints the current YMDHMS date as a time stamp.

TRIDISOLVE solves a tridiagonal system of linear equations.
You can go up one level to
the C source codes.
Last revised on 06 July 2013.