# CIRCLE_SEGMENT Area, Height, Angle, Sampling and Quadrature

CIRCLE_SEGMENT is a MATLAB library which carries out computations associated with a circle segment, including height, width, angle, area, centroid, sampling, and quadrature.

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. The "width" W of the segment is the length of P1:P2.

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.

### 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 MATLAB 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 MATLAB library which performs geometric calculations in 2, 3 and M dimensional space, including the computation of angles, areas, containment, distances, intersections, lengths, and volumes.

STROUD, a MATLAB library 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.

### Reference:

• Gaspare da Fies, Marco Vianello,
Trigonometric gaussian quadrature on subintervals of the period,
Electronic Transactions on Numerical Analysis,
Volume 39, pages 102-112, 2012.
• Walter Gautschi,
Orthogonal Polynomials: Computation and Approximation,
Oxford, 2004,
ISBN: 0-19-850672-4,
LC: QA404.5 G3555.

### Examples and Tests:

Test 3 plots quadrature points for circle segments of various angles THETA:

Test 6 samples points from circle segments of various angles THETA:

Test 12 plots the quadrature points for several rules, defined on circle segments that are specified by R (circle radius), C (circle center), and P1, P2 (the points that define the chord.)

• test12_rule1.png, points for rule of radius 2, center (1,0), p1 at pi/4, p2 at 5pi/4.
• test12_rule2.png, points for rule of radius 1.5, center (-1,2), p1 at 5pi/6, p2 at 10pi/6.

Test 16 plots points for circle sectors.

Test 17 plots points for a circle segment.

You can go up one level to the MATLAB source codes.

Last revised on 22 May 2013.