Debian Codegraph @

topojson/test/spherical-ringArea-test.js

raw
1 var tape = require("tape"),
2 spherical = require("../lib/topojson/spherical");
3
4 require("./inDelta");
5
6 tape("spherical.ringArea small clockwise area", function(test) {
7 test.inDelta(spherical.ringArea([[0, -.5], [0, .5], [1, .5], [1, -.5], [0, -.5]]), 0.0003046212, 1e-10);
8 test.end();
9 });
10
11 tape("spherical.ringArea small counterclockwise area", function(test) {
12 test.inDelta(spherical.ringArea([[0, -.5], [1, -.5], [1, .5], [0, .5], [0, -.5]]), -0.0003046212, 1e-10);
13 test.end();
14 });
15
16 tape("spherical.ringArea large clockwise rectangle", function(test) {
17 test.inDelta(spherical.ringArea([[-170, 80], [0, 80], [170, 80], [170, -80], [0, -80], [-170, -80], [-170, 80]]), -0.7088456510, 1e-10);
18 test.end();
19 });