Function S2Loop.getSurfaceIntegral
This method computes the oriented surface integral of some quantity f(x) over the loop interior, given a function f_tri(A,B,C) that returns the corresponding integral over the spherical triangle ABC. Here "oriented surface integral" means:
T getSurfaceIntegral(T)
(
T function(const(Vector!(double,3LU)), const(Vector!(double,3LU)), const(Vector!(double,3LU))) fTri
) const;
(1) f_tri(A,B,C) must be the integral of f if ABC is counterclockwise, and the integral of -f if ABC is clockwise.
(2) The result of this function is *either* the integral of f over the loop interior, or the integral of (-f) over the loop exterior.
Note that there are at least two common situations where it easy to work around property (2) above:
- If the integral of f over the entire sphere is zero, then it doesn't matter which case is returned because they are always equal.
- If f is non-negative, then it is easy to detect when the integral over the loop exterior has been returned, and the integral over the loop interior can be obtained by adding the integral of f over the entire unit sphere (a constant) to the result.
Also requires that the default constructor for T must initialize the value to zero. (This is true for built-in types such as "double".)