venny
Version:
Declarative Venn diagrams
26 lines (25 loc) • 1.51 kB
TypeScript
import { Circle, Point, IntersectionStats } from '../interfaces';
export interface PointWithIndex extends Point {
parentIndex: [number, number];
angle: number;
}
/** Returns the intersection area of a bunch of circles (where each circle
is an object having an x,y and radius property) */
export declare function intersectionArea(circles: Circle[], stats?: IntersectionStats): number;
/** returns whether a point is contained by all of a list of circles */
export declare function containedInCircles(point: Point, circles: Circle[]): boolean;
/** Circular segment area calculation. See http://mathworld.wolfram.com/CircularSegment.html */
export declare function circleArea(r: number, width: number): number;
/** euclidean distance between two points */
export declare function distance(p1: Point, p2: Point): number;
/** Returns the overlap area of two circles of radius r1 and r2 - that
have their centers separated by distance d. Simpler faster
circle intersection for only two circles */
export declare function circleOverlap(r1: number, r2: number, d: number): number;
/** Given two circles (containing a x/y/radius attributes),
returns the intersecting points if possible.
note: doesn't handle cases where there are infinitely many
intersection points (circles are equivalent):, or only one intersection point*/
export declare function circleCircleIntersection(p1: Circle, p2: Circle): Point[];
/** Returns the center of a bunch of points */
export declare function getCenter(points: Point[]): Point;