sphere_quad
sphere_quad,
a MATLAB code 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 and
an Octave version.
Related Data and Programs:
sphere_quad_test
sphere_exactness,
a MATLAB program which
tests the polynomial exactness of a quadrature rule for the unit sphere;
SPHERE_GRID,
a MATLAB 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 MATLAB library which
computes Lebedev quadrature rules for the unit sphere;
SPHERE_MONTE_CARLO,
a MATLAB library which
applies a Monte Carlo method to estimate the integral of a function
over the surface of the sphere in 3D;
STROUD,
a MATLAB library which
approximates the integral of a function on the surface or in the interior
of a variety of geometric shapes.
Reference:

James Arvo,
Stratified sampling of spherical triangles,
Computer Graphics Proceedings, Annual Conference Series,
ACM SIGGRAPH '95, pages 437438, 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: 1584883014,
LC: QA167.H36.
Source Code:

arc_cosine.m
computes the arc cosine function, with argument truncation.

arc_sine.m
computes the arc sine function, with argument truncation.

atan4.m
computes the inverse tangent of the ratio Y / X.

ch_cap.m
capitalizes a character.

icos_shape.m
describes an icosahedron.

icos_size.m
gives "sizes" for an icosahedron in 3D.

polyterm_exponent.m,
allows the user to set or get the exponents defining a monomial.

polyterm_value_3d.m,
evaluates a monomial.

r8vec_polarize.m
decomposes an R8VEC into normal and parallel components.

s_eqi.m
compares two strings for equality, ignoring case.

sphere01_distance_xyz.m
computes great circle distances on a unit sphere.

sphere01_monomial_integral.m
returns monomial integrals on the unit sphere.

sphere01_quad_icos1c.m
centroid rule, subdivide then project.

sphere01_quad_icos1m.m
midside rule, subdivide then project.

sphere01_quad_icos1v.m
vertex rule, subdivide then project.

sphere01_quad_icos2v.m
vertex rule, project, then subdivide.

sphere01_quad_llc.m
Longitude/Latitude grid with centroid rule.

sphere01_quad_llm.m
longitude/latitude grid plus midside rule.

sphere01_quad_llv.m
longitude/latitude grid with vertex rule.

sphere01_quad_mc.m
uses the Monte Carlo rule for sphere quadrature.

sphere01_quad_mc_size.m
sizes a Monte Carlo rule for sphere quadrature.

sphere01_sample_3d.m
picks random points on a sphere in 3D.

sphere01_triangle_angles_to_area.m
computes the area of a spherical triangle.

sphere01_triangle_project.m
projects from a plane triangle to a spherical triangle.

sphere01_triangle_project2.m
projects from a plane triangle to a spherical triangle using
a more sophisticated algorithm.

sphere01_triangle_sample.m
samples a spherical triangle.

sphere01_triangle_sides_to_angles.m
computes spherical triangle angles.

sphere01_triangle_vertices_to_areas.m
computes the area of a spherical triangle.

sphere01_triangle_vertices_to_centroid.m
gets a spherical triangle "centroid".

sphere01_triangle_vertices_to_midpoints.m
gets the midsides of a spherical triangle.

sphere01_triangle_vertices_to_sides.m
computes spherical triangle sides.

timestamp.m
prints the current YMDHMS date as a time stamp.

tp_to_xyz.m
converts spherical TP coordinates to XYZ coordinates.
Last revised on 26 March 2019.