circle_segment
    
    
    
      circle_segment,
      a MATLAB code 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.
        
      
    
    
      Licensing:
    
    
      The information on this web page is distributed under the MIT license.
    
    
      Languages:
    
    
      circle_segment is available in
      a C version and
      a C++ version and
      a Fortran90 version and
      a MATLAB version and
      an Octave version.
    
    
      Related Data and Programs:
    
    
      
      circle_segment_test
    
    
      
      circle_rule,
      a MATLAB 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 MATLAB code which
      performs geometric calculations in 2, 3 and M dimensional space,
      including the computation of angles, areas, containment, distances,
      intersections, lengths, and volumes.
    
    
      
      stroud_rule, 
      a MATLAB 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.
    
    
      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.
         
      
    
    
      Source Code:
    
    
      
        - 
          
          circle_segment_angle_from_chord.m, 
          computes the angle of a circle segment from the chord endpoints.
        
 
        - 
          circle_segment_angle_from_chord_angles.m, 
          computes the angle of a circle segment from the chord angles.
        
 
        - 
          circle_segment_angle_from_height.m, 
          computes the angle of a circle segment from its height.
        
 
        - 
          circle_segment_area_from_angle.m, 
          computes the area of a circle segment from the angle.
        
 
        - 
          circle_segment_area_from_chord.m, 
          computes the area of a circle segment from the coordinates of the endpoints
          of the chord.
        
 
        - 
          circle_segment_area_from_height.m, 
          computes the area of a circle segment from the height.
        
 
        - 
          circle_segment_area_from_sample.m, 
          estimates the area of a circle segment, described by the coordinates of the 
          endpoints of the chords, using Monte Carlo sampling over the entire circle.
        
 
        - 
          circle_segment_cdf.m, 
          computes a cumulative density function (CDF) for heights H2 of
          circle segments formed by choosing a point at random in 
          a circle segment of height H.
        
 
        - 
          circle_segment_centroid_from_chord.m, 
          computes the centroid of a circle segment from the coordinates of the endpoints
          of the chord.
        
 
        - 
          circle_segment_centroid_from_height.m, 
          computes the centroid of a circle segment from its height.
        
 
        - 
          circle_segment_centroid_from_sample.m, 
          computes the centroid of a circle segment from a Monte Carlo sample.
        
 
        - 
          circle_segment_contains_point.m, 
          determines whether a circle segment contains a point.
        
 
        - 
          circle_segment_height_from_angle.m, 
          computes the height of a circle segment from its angle.
        
 
        - 
          circle_segment_height_from_angle.m, 
          computes the height of a circle segment from its angle.
        
 
        - 
          circle_segment_height_from_area.m, 
          computes the height of a circle segment from its area.
        
 
        - 
          circle_segment_height_from_chord.m, 
          computes the height of a circle segment from its chord endpoints.
        
 
        - 
          circle_segment_sample_from_chord.m, 
          computes random sample points from a circle segment based on 
          the chord endpoints.
        
 
        - 
          circle_segment_sample_from_height.m, 
          computes random sample points from a circle segment based on the height.
        
 
        - 
          
          circle_segment_width_from_height.m, 
          computes the width of a circle segment from its height.
        
 
        - 
          circle01_to_circle.m, 
          maps points from the unit circle to a general one.
        
 
        - 
          gauss.m, 
          computes a Gauss quadrature rule, by Walter Gautschi.
        
 
        - 
          gqcircsect.m, 
          computes a Gauss quadrature rule for a circle sector
          in the unit circle.
        
 
        - 
          gqcircsegm.m, 
          computes a Gauss quadrature rule for a circle segment 
          in the unit circle.
        
 
        - 
          r_jacobi.m, 
          computes recurrence coefficients for monic Jacobi polynomials,
          by Dirk Laurie and Walter Gautschi.
        
 
        - 
          tridisolve.m, 
          solves a tridiagonal system of linear equations.
        
 
        - 
          trigauss.m, 
          computes a trigonometric gaussian quadrature rule,
          by Gaspare Da Fies, Alvise Sommariva, Marco Vianello.
        
 
        - 
          trigauss_conversion.m, 
          converts Gauss to trigonometric Gauss quadrature,
          by Gaspare Da Fies, Alvise Sommariva, Marco Vianello.
        
 
        - 
          weights_3t.m, 
          Gauss quadrature weights from 3 term recurrence coefficients,
          by Gaspare Da Fies, Alvise Sommariva, Marco Vianello.
        
 
      
    
    
    
      Last revised on 13 December 2018.