apollonius
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -1,2 +0,2 @@ | ||
// Type definitions of apollonius library | ||
// Type declaration for apollonius library | ||
// Definitions by: Akseli Palén <akseli.palen@gmail.com> | ||
@@ -11,7 +11,6 @@ // | ||
interface Options { | ||
epsilon: number; | ||
export default apollonius; | ||
export function apollonius(c1: Circle2, c2: Circle2, c3: Circle2): Circle2 | null; | ||
export namespace options { | ||
export let epsilon: number; | ||
} | ||
export default function apollonius(c1: Circle2, c2: Circle2, c3: Circle2): Circle2 | null; | ||
export const options: Options; |
14
index.js
const defaultEpsilon = 0.0000000001 // precision from affineplane | ||
const libOptions = { | ||
const options = { | ||
epsilon: defaultEpsilon // keep epsilon modifiable | ||
@@ -20,3 +20,3 @@ } | ||
const d = Math.sqrt(dx * dx + dy * dy) | ||
const epsilon = libOptions.epsilon | ||
const epsilon = options.epsilon | ||
@@ -82,3 +82,3 @@ if (d < epsilon) { | ||
const epsilon = libOptions.epsilon | ||
const epsilon = options.epsilon | ||
@@ -147,3 +147,3 @@ // First we handle the cases where the circle centers are equal. | ||
export function apollonius (c1, c2, c3) { | ||
function apollonius (c1, c2, c3) { | ||
// Find a circle that is externally tangent to the three circles c1,c2,c3. | ||
@@ -164,3 +164,3 @@ // If no such circle exists on the real plane, return null. | ||
// | ||
const epsilon = libOptions.epsilon | ||
const epsilon = options.epsilon | ||
@@ -218,5 +218,5 @@ // Circle differences | ||
return { x, y, r } | ||
} | ||
}; | ||
export { apollonius, options } | ||
export default apollonius | ||
export const options = libOptions |
{ | ||
"name": "apollonius", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Solves Apollonius' problem by finding a fourth circle tangent to three given circles", | ||
@@ -12,3 +12,3 @@ "type": "module", | ||
"test:unit": "node test/index.js", | ||
"test:types": "tsc test/types.ts --esModuleInterop", | ||
"test:types": "tsc test/types.ts", | ||
"test": "npm run lint && npm run test:unit", | ||
@@ -28,3 +28,7 @@ "release": "npm test && npm publish" | ||
"apollonius", | ||
"tangent" | ||
"tangent", | ||
"math", | ||
"packing", | ||
"layout", | ||
"2d" | ||
], | ||
@@ -31,0 +35,0 @@ "author": "Akseli Palén <akseli.palen@gmail.com>", |
13842