UNPKG

1.09 kBTypeScriptView Raw
1/** Object representing a 2D point. */
2export interface Point {
3 /** X coordinate of the point. */
4 x: number;
5 /** Y coordinate of the point. */
6 y: number;
7}
8/** Object representing a rectangle. */
9export interface Rect {
10 /** Position of the rectangle's top-left corner. */
11 pos: Point;
12 /** Size of the rectangle. */
13 size: Point;
14}
15/** Object representing a line section. */
16export interface Line {
17 /** Starting point of the line. */
18 begin: Point;
19 /** End point of the line. */
20 end: Point;
21}
22/** Object representing an affine transformation 2x3 matrix. */
23export type AffineTransform = number[][];
24/** Rectangle transformed by an affine transformation. */
25export interface TransformedRect {
26 /** Transform transforms the top left corner to the origo. */
27 transform: AffineTransform;
28 /** Size of the rectangle. */
29 size: Point;
30}
31/** Converts a point between two coordinate system. */
32export type PointConverter = (point: Point) => Point;
33/** Type of a point's coordinate system. */
34export type CoordinateType = 'relative' | 'canvas';