This is a function in the d3.v3.js file (the graph library D3.js):
function d3_geo_areaRingStart() {
var λ00, φ00, λ0, cosφ0, sinφ0;
d3_geo_area.point = function(λ, φ) {
d3_geo_area.point = nextPoint;
λ0 = (λ00 = λ) * d3_radians, cosφ0 = Math.cos(φ = (φ00 = φ) * d3_radians / 2 + π / 4),
sinφ0 = Math.sin(φ);
};
function nextPoint(λ, φ) {
λ *= d3_radians;
φ = φ * d3_radians / 2 + π / 4;
var dλ = λ - λ0, cosφ = Math.cos(φ), sinφ = Math.sin(φ), k = sinφ0 * sinφ, u = cosφ0 * cosφ + k * Math.cos(dλ), v = k * Math.sin(dλ);
d3_geo_areaRingSum.add(Math.atan2(v, u));
λ0 = λ, cosφ0 = cosφ, sinφ0 = sinφ;
}
d3_geo_area.lineEnd = function() {
nextPoint(λ00, φ00);
};
}
I was completely taken aback that the programmers used π, φ and λ as variable names. Surprisingly, these variables were accepted even by Notepad (ie: it didn't turn into junk/unrecognized characters).
Is it good practice to use such variables? I can see that they're very intuitive and searchable too, but a bit unnerving.
ρ
can mean density or resistivity or possibly even something completely different. If you are writing code for people who see these symbols frequently and can recognize on the spot what you are calculating, then you get a lot of terseness by using these symbols, because they carry semantic meaning. But otherwise people will be happy to read a descriptive variable name that they can google to freshen up their memory.