SPHERE_QUAD
Quadrature on the Surface of the Unit Sphere
SPHERE_QUAD
is a C++ library which
estimates the integral of a scalar function F(X,Y,Z) over the surface of
the unit sphere centered at the origin.
The library includes one function, SPHERE01_QUAD_MC, which
estimates the integral using a Monte Carlo approach. It randomly
samples points on the surface, and estimates the integral as the
average of these values times the area of the surface.
The library includes three functions based on the idea of a
latitudinal/longitudinal grid: SPHERE01_QUAD_LLC,
SPHERE01_QUAD_LLV and SPHERE01_QUAD_LLM.
The surface of the sphere is divided into rectangles whose sides
are always lines of latitude or longitude. Each rectangle is then
split diagonally into a pair of triangles (except for the degenerate
rectangles that include the north or south pole as a vertex.)
The user controls the accuracy of the integral estimate by specifying
a maximum side length H. The functions determine angular increments
that guarantee the size restriction. Of course, this means that the
restriction on latitude, enforced at the equator, will result in excessively
small triangles away from the equator. That is a penalty of
using this simple subdivision scheme.
The library includes three functions based on the idea of first
subdividing the surface into 20 congruent spherical triangles, based
on the projection of a regular icosahedron. The functions
SPHERE01_QUAD_ICOS1C, SPHERE01_QUAD_ICOS1V and
SPHERE01_QUAD_ICOS1M use this idea, along with subdivision.
The function SPHERE01_QUAD_ICOS2V is similar to
SPHERE01_QUAD_ICOS1V but uses a more sophisticated algorithm
to project points from the planar triangle to the unit sphere.
However, the modifications seem to make little difference to the
resulting integral estimate.
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
SPHERE_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 unit sphere in 3D;
SPHERE_TRIANGLE_QUAD,
a C++ library which
estimates the integral of a function over a spherical triangle.
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,
a MATLAB program which
reads XYZ information defining points in 3D,
and displays an image in the MATLAB graphics window.
XYZ_DISPLAY_OPENGL,
a C++ program which
reads XYZ information defining points in 3D,
and displays an image using OpenGL.
Reference:
-
James Arvo,
Stratified sampling of spherical triangles,
Computer Graphics Proceedings, Annual Conference Series,
ACM SIGGRAPH '95, pages 437-438, 1995.
-
Philip Davis, Philip Rabinowitz,
Methods of Numerical Integration,
Second Edition,
Dover, 2007,
ISBN: 0486453391,
LC: QA299.3.D28.
-
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.
Source Code:
Examples and Tests:
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_MAX returns the maximum of two I4's.
-
I4_MIN returns the smaller of two I4's.
-
I4VEC_COPY copies an I4VEC.
-
ICOS_SHAPE describes a icosahedron.
-
ICOS_SIZE gives "sizes" for an icosahedron in 3D.
-
R8_ABS returns the absolute value of an R8.
-
R8_GAMMA evaluates Gamma(X) for a real argument.
-
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_COPY copies an R8VEC.
-
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.
-
R8VEC_SUM returns the sum of an R8VEC.
-
SPHERE01_DISTANCE_XYZ computes great circle distances on a unit sphere.
-
SPHERE01_MONOMIAL_INTEGRAL returns monomial integrals on the unit sphere.
-
SPHERE01_QUAD_ICOS1C: centroid rule, subdivide then project.
-
SPHERE01_QUAD_ICOS1M: midside rule, subdivide then project.
-
SPHERE01_QUAD_ICOS1V: vertex rule, subdivide then project.
-
SPHERE01_QUAD_ICOS2V: vertex rule, subdivide then project.
-
SPHERE01_QUAD_LLC: Longitude/Latitude grid with centroid rule.
-
SPHERE01_QUAD_LLM: longitude/latitude grid plus midside rule.
-
SPHERE01_QUAD_LLV: longitude/latitude grid with vertex rule.
-
SPHERE01_QUAD_MC uses the Monte Carlo rule for sphere quadrature.
-
SPHERE01_QUAD_MC_SIZE sizes a Monte Carlo rule for sphere quadrature.
-
SPHERE01_SAMPLE picks random points on a unit sphere.
-
SPHERE01_TRIANGLE_ANGLES_TO_AREA: area of a spherical triangle on the unit sphere.
-
SPHERE01_TRIANGLE_PROJECT projects from a plane triangle to a spherical triangle.
-
SPHERE01_TRIANGLE_PROJECT2 projects from a plane triangle to a spherical triangle.
-
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_ANGLES: angles of spherical triangle on unit sphere.
-
SPHERE01_TRIANGLE_VERTICES_TO_AREA: area of a 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.
-
TP_TO_XYZ converts unit spherical TP coordinates to XYZ coordinates.
You can go up one level to
the C++ source codes.
Last revised on 23 September 2010.