new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

D3 · all subjects

d3-geo/math

11 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

d3-geo spherical math functions

Spherical math functions: d3.geoArea (compute spherical area), d3.geoBounds (compute latitude-longitude bounding box), d3.geoCentroid (compute spherical centroid), d3.geoDistance (compute great-arc distance between points), d3.geoLength (compute line or polygon perimeter length), d3.geoInterpolate (interpolate between points along great arc), d3.geoContains (test point inside feature), d3.geoRotation (create rotation function for specified angles).

geoArea signature and behavior

geoArea(object) returns the spherical area of the specified GeoJSON object in steradians. This is the spherical equivalent of path.area.

geoBounds signature and return format

geoBounds(object) returns the spherical bounding box for the specified GeoJSON object as a two-dimensional array [[left, bottom], [right, top]], where left is the minimum longitude, bottom is the minimum latitude, right is the maximum longitude, and top is the maximum latitude. All coordinates are in degrees. This is the spherical equivalent of path.bounds.

geoCentroid signature and behavior

geoCentroid(object) returns the spherical centroid of the specified GeoJSON object. This is the spherical equivalent of path.centroid.

geoDistance signature and units

geoDistance(a, b) returns the great-arc distance in radians between two points. Each point must be specified as a two-element array [longitude, latitude] in degrees. This is the spherical equivalent of path.measure given a LineString of two points.

geoLength signature and behavior

geoLength(object) returns the great-arc length of the specified GeoJSON object in radians. For polygons, it returns the perimeter of the exterior ring plus that of any interior rings. This is the spherical equivalent of path.measure.

geoInterpolate signature and behavior

geoInterpolate(a, b) returns an interpolator function given two points a and b. Each point must be specified as a two-element array [longitude, latitude] in degrees. The returned interpolator takes a single argument t, where t ranges from 0 to 1; t=0 returns point a, t=1 returns point b. Intermediate values interpolate along the great arc between a and b. If a and b are antipodes, an arbitrary great arc is chosen.

geoContains signature and behavior

geoContains(object, point) returns true if and only if the specified GeoJSON object contains the specified point, or false otherwise. The point must be specified as a two-element array [longitude, latitude] in degrees. For Point and MultiPoint geometries, an exact test is used; for a Sphere, true is always returned; for other geometries, an epsilon threshold is applied.

geoRotation signature and angle parameters

geoRotation(angles) returns a rotation function for the given angles. The angles parameter must be a two- or three-element array of numbers [lambda, phi, gamma] specifying rotation angles in degrees about each spherical axis, corresponding to yaw, pitch, and roll respectively. If gamma is omitted, it defaults to 0.

rotation function call signature

A rotation function returned by geoRotation(angles) takes a point and returns a new array [longitude, latitude] in degrees representing the rotated point. The input point must be specified as a two-element array [longitude, latitude] in degrees.

rotation.invert method signature

rotation.invert(point) returns a new array [longitude, latitude] in degrees representing the point of the given rotated point; it is the inverse operation of calling the rotation function directly. The point must be specified as a two-element array [longitude, latitude] in degrees.

Give your agent this brain