# SPHERE_TRIANGLE_QUAD Estimate Integrals over Spherical Triangles

SPHERE_TRIANGLE_QUAD is a C++ library which estimates the integral of a scalar function F(X,Y,Z) over a spherical triangle on the unit sphere.

Three methods of estimation are very crude and cannot be improved:

• the centroid rule, based on a single function value.
• the vertex rule, which averages the vertex values.
• the midside rule, which averages the midside values.

One method of estimation uses random sampling, the Monte Carlo method, whose accuracy can be improved by increasing the number of sample points.

Another method is based on the centroid rule, but allows the user to decompose the original spherical triangle into collection of smaller triangles. The accuracy of the estimate should improve as the size of these triangles decreases.

### Languages:

SPHERE_TRIANGLE_QUAD is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version.

### Related Data and Programs:

RANDOM_DATA, a C++ library which generates sample points for various probability distributions, spatial dimensions, and geometries;

SPHERE_EXACTNESS, a C++ program which tests the polynomial exactness of a quadrature rule for the unit sphere;

SPHERE_GRID, a C++ library which provides a number of ways of generating grids of points, or of points and lines, or of points and lines and faces, over the unit sphere.

SPHERE_LEBEDEV_RULE, a C++ library which computes Lebedev quadrature rules for the unit sphere;

SPHERE_MONTE_CARLO, a C++ library which applies a Monte Carlo method to estimate the integral of a function over the surface of the sphere in 3D;

SPHERE_QUAD, a C++ library which approximates an integral over the surface of the unit sphere by applying a triangulation to the surface;

SPHERE_TRIANGLE_MONTE_CARLO, a C++ library which applies a Monte Carlo method to estimate the integral of a function over a spherical triangle on the surface of the unit sphere in 3D;

STROUD, a C++ library which approximates the integral of a function on the surface or in the interior of a variety of geometric shapes.

XYZ_DISPLAY_OPENGL a C++ program which reads XYZ information defining points in 3D, and displays an image using OpenGL.

### Reference:

• Jacob Goodman, Joseph ORourke, editors,
Handbook of Discrete and Computational Geometry,
Second Edition,
CRC/Chapman and Hall, 2004,
ISBN: 1-58488-301-4,
LC: QA167.H36.

### List of Routines:

• ARC_COSINE computes the arc cosine function, with argument truncation.
• ARC_SINE computes the arc sine function, with argument truncation.
• ATAN4 computes the inverse tangent of the ratio Y / X.
• I4_POWER returns the value of I^J.
• R8_ABS returns the absolute value of an R8.
• R8_MAX returns the maximum of two R8's.
• R8_MIN returns the minimum of two R8's.
• R8_UNIFORM_01 returns a unit pseudorandom R8.
• R8VEC_DOT_PRODUCT computes the dot product of a pair of R8VEC's.
• R8VEC_NORM returns the L2 norm of an R8VEC.
• R8VEC_POLARIZE decomposes an R8VEC into normal and parallel components.
• SPHERE01_DISTANCE_XYZ computes great circle distances on a unit sphere.
• SPHERE01_SAMPLE picks random points on a unit sphere.
• SPHERE01_TRIANGLE_ANGLES_TO_AREA: area of spherical triangle on unit sphere.
• SPHERE01_TRIANGLE_PROJECT projects from plane to spherical triangle.
• SPHERE01_TRIANGLE_PROJECT2 projects from plane to spherical triangle.
• SPHERE01_TRIANGLE_QUAD_ICOS1C: centroid rule, subdivide then project.
• SPHERE01_TRIANGLE_QUAD_ICOS1M: midside rule, subdivide then project.
• SPHERE01_TRIANGLE_QUAD_ICOS1V: vertex rule, subdivide then project.
• SPHERE01_TRIANGLE_QUAD_ICOS2V: vertex rule, subdivide then project.
• SPHERE01_TRIANGLE_SAMPLE: sample points from triangle on unit sphere.
• SPHERE01_TRIANGLE_SIDES_TO_ANGLES: angles of spherical triangle on unit sphere.
• SPHERE01_TRIANGLE_VERTICES_TO_AREA: area of spherical triangle on unit sphere.
• SPHERE01_TRIANGLE_VERTICES_TO_CENTROID: centroid of spherical triangle on unit sphere.
• SPHERE01_TRIANGLE_VERTICES_TO_MIDPOINTS gets the midsides of a spherical triangle.
• SPHERE01_TRIANGLE_VERTICES_TO_SIDES_3D: sides of spherical triangle on unit sphere.
• TIMESTAMP prints the current YMDHMS date as a time stamp.

You can go up one level to the C++ source codes.

Last revised on 29 September 2010.