import { Num } from "@penrose/core"; import { Color, Line, Path, PathData, Shape, Vec2, Vec3, Vec4, VecN } from "./types.js"; /** * See https://github.com/penrose/penrose/issues/716 * @param start Start point of the path * @param end End point of the path * @param curveHeight Height of the curve * @param padding Padding between the curve and the labels * @returns Path data */ export declare const makePath: (start: Vec2, end: Vec2, curveHeight: Num, padding: Num) => PathData; /** * Return `i`th element of list `xs`, assuming lists only hold floats. * @param xs List of floats * @param i Index of the element to return * @returns The i-th element of xs */ export declare const get: (xs: VecN, i: number) => Num; /** * Return a paint color of elements `r`, `g`, `b`, `a` (red, green, blue, opacity). * @param r Red * @param g Green * @param b Blue * @param a Opacity * @returns RGBA color */ export declare const rgba: (r: Num, g: Num, b: Num, a: Num) => Color; /** * Select a color based on a level * @param color1 First color * @param color2 Second color * @param level Level * @returns Selected color */ export declare const selectColor: (color1: Color, color2: Color, level: Num) => Color; /** * Return a paint color of elements `h`, `s`, `v`, `a` (hue, saturation, value, opacity). * @param h Hue in [0, 360) * @param s Saturation in [0, 100] * @param v Value in [0, 100] * @param a Opacity * @returns HSVA color */ export declare const hsva: (h: Num, s: Num, v: Num, a: Num) => Color; /** * Return a paint of none (no paint) * @returns None color */ export declare const none: () => Color; /** * Index a point list using 1-based indexing. * @param points List of points * @param i 1-based index * @returns The i-th point */ export declare const oneBasedElement: (points: Vec2[], i: number) => Vec2; /** * Return `acosh(x)`. * @param x Input value * @returns acosh(x) */ export declare const acosh: (x: Num) => Num; /** * Return `acos(x)`. * @param x Input value * @returns acos(x) */ export declare const acos: (x: Num) => Num; /** * Return `asin(x)`. * @param x Input value * @returns asin(x) */ export declare const asin: (x: Num) => Num; /** * Return `asinh(x)`. * @param x Input value * @returns asinh(x) */ export declare const asinh: (x: Num) => Num; /** * Return `mod(a, n)`. * @param a Dividend * @param n Divisor * @returns a mod n */ export declare const mod: (a: Num, n: Num) => Num; /** * Return `atan(x)`. * @param x Input value * @returns atan(x) */ export declare const atan: (x: Num) => Num; /** * Return `atan2(y, x)`. * @param x x-coordinate * @param y y-coordinate * @returns atan2(y, x) */ export declare const atan2: (x: Num, y: Num) => Num; /** * Return `atanh(x)`. * @param x Input value * @returns atanh(x) */ export declare const atanh: (x: Num) => Num; /** * Return `cbrt(x)`. * @param x Input value * @returns cbrt(x) */ export declare const cbrt: (x: Num) => Num; /** * Return `ceil(x)`. * @param x Input value * @returns ceil(x) */ export declare const ceil: (x: Num) => Num; /** * Return `cos(x)`. * @param x Input value * @returns cos(x) */ export declare const cos: (x: Num) => Num; /** * Return `cosh(x)`. * @param x Input value * @returns cosh(x) */ export declare const cosh: (x: Num) => Num; /** * Return `exp(x)`. * @param x Input value * @returns exp(x) */ export declare const exp: (x: Num) => Num; /** * Return `expm1(x)`. * @param x Input value * @returns expm1(x) */ export declare const expm1: (x: Num) => Num; /** * Return `floor(x)`. * @param x Input value * @returns floor(x) */ export declare const floor: (x: Num) => Num; /** * Return `log(x)`. * @param x Input value * @returns log(x) */ export declare const log: (x: Num) => Num; /** * Return `log2(x)`. * @param x Input value * @returns log2(x) */ export declare const log2: (x: Num) => Num; /** * Return `log10(x)`. * @param x Input value * @returns log10(x) */ export declare const log10: (x: Num) => Num; /** * Return `log1p(x)`. * @param x Input value * @returns log1p(x) */ export declare const log1p: (x: Num) => Num; /** * Return `pow(x,y)`. * @param x Base * @param y Exponent * @returns pow(x,y) */ export declare const pow: (x: Num, y: Num) => Num; /** * Return `round(x)`. * @param x Input value * @returns round(x) */ export declare const round: (x: Num) => Num; /** * Return `sign(x)`. * @param x Input value * @returns sign(x) */ export declare const sign: (x: Num) => Num; /** * Return `sin(x)`. * @param x Input value * @returns sin(x) */ export declare const sin: (x: Num) => Num; /** * Return `sinh(x)`. * @param x Input value * @returns sinh(x) */ export declare const sinh: (x: Num) => Num; /** * Return `tan(x)`. * @param x Input value * @returns tan(x) */ export declare const tan: (x: Num) => Num; /** * Return `tanh(x)`. * @param x Input value * @returns tanh(x) */ export declare const tanh: (x: Num) => Num; /** * Return `trunc(x)`. * @param x Input value * @returns trunc(x) */ export declare const trunc: (x: Num) => Num; /** * Return the sum of elements in a vector. * @param xs Elements * @returns Sum of elements */ export declare const sum: (xs: VecN) => Num; /** * Return the sum of vectors in a list of vectors. * @param vecs Vectors * @returns Sum of vectors */ export declare const sumVectors: (vecs: Vec2[]) => Vec2; /** * Return the maximum of the elements in a vector. * @param xs Elements * @returns Maximum element */ export declare const maxList: (xs: VecN) => Num; /** * Return the minimum of the elements in a vector. * @param xs Elements * @returns Minimum element */ export declare const minList: (xs: VecN) => Num; /** * Return the number of the elements in a vector. * @param xs Elements * @returns Number of elements */ export declare const count: (xs: VecN) => Num; /** * Return the dot product of `v` and `w`. * @param v Vector `v` * @param w Vector `w` * @returns Dot product of v and w */ export declare const dot: (v: VecN, w: VecN) => Num; /** * `identity(n)` returns the $n \times n$ identity matrix * $$I = \left[ \begin{array}{cccc} 1 & 0 & \cdots & 0 \\ 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{array} \right].$$ * @param n dimension * @returns Identity matrix */ export declare const identity: (n: number) => Num[][]; /** * `diagonal(v)` takes a vector $v$ of length $n$, and returns the $n \times n$ diagonal matrix * $$D = \left[ \begin{array}{cccc} v_1 & 0 & \cdots & 0 \\ 0 & v_2 & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & v_n \end{array} \right].$$ * @param v vector of diagonal entries * @returns Diagonal matrix */ export declare const diagonal: (v: VecN) => Num[][]; /** * `trace(A)` takes a square matrix $A$, and returns the trace $\text{tr}(A)$, equal to the sum of its diagonal entries. * @param A a square matrix * @returns Trace of A */ export declare const trace: (A: Num[][]) => Num; /** * `determinant(A)` takes a $2 \times 2$, $3 \times 3$, or $4 \times 4$ matrix $A$, and returns its determinant $\text{det}(A)$. * @param A a square matrix * @returns Determinant of A */ export declare const determinant: (A: Num[][]) => Num; /** * `inverse(A)` takes a $2 \times 2$, $3 \times 3$, or $4 \times 4$ matrix $A$, and returns its inverse $A^{-1}$. If the matrix is not invertible, the result may be numerically invalid (with `INF` or `NaN` entries). * @param A a 2x2, 3x3, or 4x4 matrix * @returns Inverse of A */ export declare const inverse: (A: Num[][]) => Num[][]; /** * `outerProduct(u,v)` takes two vectors $u$, $v$ of equal length $n$, and returns the $n \times n$ outer product matrix $A$, with entries $A_{ij} = u_i v_j$. * @param v Vector `v` * @param w Vector `w` * @returns Outer product matrix */ export declare const outerProduct: (v: VecN, w: VecN) => Num[][]; /** * `crossProductMatrix(v)` takes a 3-vector $v$, and returns a $3 \times 3$ skew symmetric matrix $A^T = -A$ such that $Au = v \times u$ for any vector $u$. * @param v Vector `v` * @returns Cross product matrix */ export declare const crossProductMatrix: (v: VecN) => Num[][]; /** * `matrix(a,b,c,d,e,f)` specifies a transformation matrix * $$\left[ \begin{array}{ccc} a & c & e \\ b & d & f \\ 0 & 0 & 1 \end{array} \right].$$ * This function mirrors the SVG/CSS `matrix` transform function. * @param a top left entry * @param b middle left entry * @param c top center entry * @param d middle center entry * @param e top right entry * @param f middle right entry * @returns Transformation matrix */ export declare const matrix: (a: Num, b: Num, c: Num, d: Num, e: Num, f: Num) => Num[][]; /** * `matrix3d(a1, a2, a3, a4, b1, b2, b3, b4, c1, c2, c3, c4, d1, d2, d3, d4)` specifies a transformation matrix * $$\left[ \begin{array}{cccc} a1 & a2 & a3 & a4 \\ b1 & b2 & b3 & b4 \\ c1 & c2 & c3 & c4 \\ d1 & d2 & d3 & d4 \end{array} \right].$$ * This function mirrors the CSS `matrix3d` transform function. * @param a1 1st column of 1st row * @param b1 1st column of 2nd row * @param c1 1st column of 3rd row * @param d1 1st column of 4th row * @param a2 2nd column of 1st row * @param b2 2nd column of 2nd row * @param c2 2nd column of 3rd row * @param d2 2nd column of 4th row * @param a3 3rd column of 1st row * @param b3 3rd column of 2nd row * @param c3 3rd column of 3rd row * @param d3 3rd column of 4th row * @param a4 4th column of 1st row * @param b4 4th column of 2nd row * @param c4 4th column of 3rd row * @param d4 4th column of 4th row * @returns 3D transformation matrix */ export declare const matrix3d: (a1: Num, b1: Num, c1: Num, d1: Num, a2: Num, b2: Num, c2: Num, d2: Num, a3: Num, b3: Num, c3: Num, d3: Num, a4: Num, b4: Num, c4: Num, d4: Num) => Num[][]; /** * `rotate(theta, [x], [y])` returns a counter-clockwise 2D rotation by an angle $\theta$, optionally around the point $(x,y)$. If no point is specified, the rotation is around the origin. * @param theta angle of rotation (in radians) * @param x center of rotation (x coordinate) * @param y center of rotation (y coordinate) * @returns Rotation matrix */ export declare const rotate: (theta: Num, x?: Num, y?: Num) => Num[][]; /** * `rotate2d(theta)` returns a 2D rotation around the origin by a given angle $\theta$, encoded via the $2 \times 2$ matrix. * @param theta angle of rotation (in radians) * @returns 2D rotation matrix */ export declare const rotate2d: (theta: Num) => Num[][]; /** * `rotate3d(theta, v)` returns a 3D rotation by an angle $\theta$ around a unit axis $v$. * @param theta angle of rotation (in radians) * @param v axis of rotation (unit vector) * @returns 3D rotation matrix */ export declare const rotate3d: (theta: Num, v: VecN) => Num[][]; /** * `rotate3dh(theta, v)` returns a 3D rotation by a given angle $\theta$ around a unit axis $v$. This transformation is encoded as a $4 \times 4$ matrix in homogeneous coordinates. * @param theta angle of rotation (in radians) * @param v axis of rotation (unit vector) * @returns 3D rotation matrix in homogeneous coordinates */ export declare const rotate3dh: (theta: Num, v: VecN) => Num[][]; /** * `scale(sx, sy)` returns a nonuniform scaling by factors $s_x$, $s_y$ along $x$, $y$ axes. * @param sx horizontal scale factor * @param sy vertical scale factor * @returns Scaling matrix */ export declare const scale: (sx: Num, sy: Num) => Num[][]; /** * `scale2d(sx,sy)` returns a $2 \times 2$ matrix representing nonuniform scaling by factors $s_x$, $s_y$ along $x$, $y$ axes. * @param sx horizontal scale factor * @param sy vertical scale factor * @returns 2D scaling matrix */ export declare const scale2d: (sx: Num, sy: Num) => Num[][]; /** * `scale3d(sx, sy, sz)` returns a nonuniform scaling by factors $s_x$, $s_y$, $s_z$ along $x$, $y$, $z$ axes. * @param sx x scale factor * @param sy y scale factor * @param sz z scale factor * @returns 3D scaling matrix */ export declare const scale3d: (sx: Num, sy: Num, sz: Num) => Num[][]; /** * `scale3dh(sx, sy, sz)` returns a $4 \times 4$ matrix representing nonuniform scaling by factors $s_x$, $s_y$, $s_z$ along $x$, $y$, $z$ axes. * @param sx x scale factor * @param sy y scale factor * @param sz z scale factor * @returns 3D scaling matrix in homogeneous coordinates */ export declare const scale3dh: (sx: Num, sy: Num, sz: Num) => Num[][]; /** * `skew(a_x, a_y)` takes angles $a_x$ and $a_y$, and returns a 2D skew transformation. * @param ax horizontal angle * @param ay vertical angle * @returns Skew matrix */ export declare const skew: (ax: Num, ay?: Num) => Num[][]; /** * `skew2d(a_x, a_y)` takes angles $a_x$ and $a_y$, and returns a 2D skew transformation encoded via a $2 \times 2$ matrix. * @param ax horizontal angle * @param ay vertical angle * @returns 2D skew matrix */ export declare const skew2d: (ax: Num, ay?: Num) => Num[][]; /** * `shear(u,v)` takes two $n$-dimensional vectors $u$ and $v$, and returns a transformation that shears any given point $x$ in the direction $u$ according to its extent along the direction $v$. * @param u offset direction * @param v shear axis * @returns Shear matrix */ export declare const shear: (u: VecN, v: VecN) => Num[][]; /** * `shear2d(u,v)` takes two 2-dimensional vectors $u$ and $v$, and returns a transformation that shears any given point $x$ in the direction $u$ according to its extent along the direction $v$. * @param u offset direction * @param v shear axis * @returns 2D shear matrix */ export declare const shear2d: (u: Vec2, v: Vec2) => Num[][]; /** * `shear3d(u,v)` takes two 3-dimensional vectors $u$ and $v$, returns a transformation that shears any given point $x$ in the direction $u$ according to its extent along the direction $v$. * @param u offset direction * @param v shear axis * @returns 3D shear matrix */ export declare const shear3d: (u: Vec3, v: Vec3) => Num[][]; /** * `translate(x,y)` returns a translation by the given offset $(x,y)$. * @param x horizontal offset * @param y vertical offset * @returns Translation matrix */ export declare const translate: (x: Num, y?: Num) => Num[][]; /** * `translate3dh(x,y,z)` returns a translation by $(x,y,z)$. * @param x x offset * @param y y offset * @param z z offset * @returns 3D translation matrix */ export declare const translate3dh: (x: Num, y: Num, z: Num) => Num[][]; /** * `lookAt(eye, center, up)` returns a $4 \times 4$ viewing matrix derived from an eye point $e$, a reference point $c$ indicating the center of the scene, and an up vector $u$. * @param eye position of the eye point * @param center position of the reference point * @param up unit vector in the upward direction * @returns Look-at matrix */ export declare const lookAt: (eye: VecN, center: VecN, up: VecN) => Num[][]; /** * `perspective(fovy, aspect, [zNear], [zFar])` returns a $4 \times 4$ perspective projection matrix. * @param fovy field of view angle, in degrees, in the y direction * @param aspect aspect ratio that determines the field of view in the x direction * @param zNear distance from the viewer to the near clipping plane (always positive) * @param zFar distance from the viewer to the far clipping plane (always positive) * @returns Perspective projection matrix */ export declare const perspective: (fovy: Num, aspect: Num, zNear?: Num, zFar?: Num) => Num[][]; /** * `ortho(left, right, bottom, top, [zNear], [zFar])` returns a $4 \times 4$ transformation that produces a parallel projection. * @param Left coordinate of the left vertical clipping plane * @param Right coordinate of the right vertical clipping plane * @param Bottom coordinate of the bottom horizontal clipping plane * @param Top coordinate of the top horizontal clipping plane * @param zNear distance to the nearer depth clipping plane * @param zFar distance to the farther depth clipping plane * @returns Orthographic projection matrix */ export declare const ortho: (Left: Num, Right: Num, Bottom: Num, Top: Num, zNear?: Num, zFar?: Num) => Num[][]; /** * `project(p, model, proj, view)` transforms the specified 3D object coordinates $p$ into 2D window coordinates $q$. * @param p 3D object coordinates (x,y,z) * @param model 4x4 modelview matrix * @param proj 4x4 projection matrix * @param view viewport (x, y, width, height) * @returns Projected 2D coordinates */ export declare const project: (p: Vec3, model: Num[][], proj: Num[][], view: Vec4) => Vec2; /** * `projectDepth(p, model, proj, view)` transforms the specified 3D object coordinates $p$ into 2D window coordinates $q$ and returns the depth. * @param p 3D object coordinates (x,y,z) * @param model 4x4 modelview matrix * @param proj 4x4 projection matrix * @param view viewport (x, y, width, height) * @returns Projected 2D coordinates and depth */ export declare const projectDepth: (p: Vec3, model: Num[][], proj: Num[][], view: Vec4) => Vec3; /** * `projectList(P, model, proj, view)` transforms a list of 3D object coordinates $P = p_1, \ldots, p_k$ into window 2D coordinates. * @param p list of 3D object coordinates (x,y,z) * @param model 4x4 modelview matrix * @param proj 4x4 projection matrix * @param view viewport (x, y, width, height) * @returns List of projected 2D coordinates */ export declare const projectList: (p: Vec3[], model: Num[][], proj: Num[][], view: Vec4) => Vec2[]; /** * `matrixMultiplyList(A, V)` multiplies each vector $v_1, \ldots, v_k$ in the list $V$ by the given $n \times n$ matrix $A$. * @param A `n`x`n` matrix * @param V list of `n`-dimensional vectors * @returns List of matrix-vector products */ export declare const matrixMultiplyList: (A: Num[][], V: VecN[]) => VecN[]; /** * `fromHomogeneous(q)` takes a vector $q$ of length $n+1$, encoding a point in $n$-dimensional homogeneous coordinates, and returns a vector $p$ of length $n$, encoding the same point in Cartesian coordinates. * @param q homogeneous coordinates * @returns Cartesian coordinates */ export declare const fromHomogeneous: (q: VecN) => VecN; /** * `fromHomogeneousList(Q)` takes a list $Q = q_1, \ldots, q_k$ of vectors of length $n+1$, encoding points in $n$-dimensional homogeneous coordinates, and returns a list $P = p_1, \ldots, p_k$ of vectors of length $n$, encoding the same points in Cartesian coordinates. * @param Q list of points in homogeneous coordinates * @returns List of points in Cartesian coordinates */ export declare const fromHomogeneousList: (Q: VecN[]) => VecN[]; /** * `toHomogeneous(p)` takes a vector $p$ of length $n$, encoding a point in $n$-dimensional Cartesian coordinates, and returns a vector $q$ of length $n+1$, encoding the same point in homogeneous coordinates. * @param p Cartesian coordinates * @returns Homogeneous coordinates */ export declare const toHomogeneous: (p: VecN) => VecN; /** * `toHomogeneousList(P)` takes a list $P = p_1, \ldots, p_k$ of vectors of length $n$, encoding points in $n$-dimensional Cartesian coordinates, and returns a list $Q = q_1, \ldots, q_k$ of vectors of length $n+1$, encoding the same points in homogeneous coordinates. * @param P list of points in Cartesian coordinates * @returns List of points in homogeneous coordinates */ export declare const toHomogeneousList: (P: VecN[]) => VecN[]; /** * `toHomogeneousMatrix(A)` takes a square $n \times n$ matrix $A$ representing a spatial transformation in $A$ dimensions, and returns an $(n+1) \times (n+1)$ matrix representing the same transformation in homogeneous coordinates. * @param A matrix encoding linear transformation * @returns Homogeneous transformation matrix */ export declare const toHomogeneousMatrix: (A: Num[][]) => Num[][]; /** * Return the length of the Line shape. * @param l A line * @returns Length of the line */ export declare const length: (l: Line) => Num; /** * Return the normalized version of vector `v`. * @param v Vector `v` * @returns Normalized vector */ export declare const normalize: (v: VecN) => VecN; /** * Given a list of points `pts`, returns a `PathData` that can be used as input to the `Path` shape's `pathData` attribute to be drawn on the screen. * @param pathType Path Type * @param pts List of points * @returns Path data */ export declare const pathFromPoints: (pathType: string, pts: Vec2[]) => PathData; /** * Given a list of points `pts`, returns a `PathData` that can be used as input to the `Path` shape's `pathData` attribute to be drawn on the screen. * @param pathType Path Type * @param pts List of points * @returns Path data for a quadratic curve */ export declare const quadraticCurveFromPoints: (pathType: string, pts: Vec2[]) => PathData; /** * Draw a curve interpolating three given points. * (Note that this is different from specifying the three control points of a quadratic Bézier curve, since a Bézier does not interpolate the middle control point.) * @param pathType Path Type * @param p0 First point * @param p1 Second point * @param p2 Third point * @returns Path data for an interpolating quadratic curve */ export declare const interpolateQuadraticFromPoints: (pathType: string, p0: Vec2, p1: Vec2, p2: Vec2) => PathData; /** * Given a list of points `pts`, returns a `PathData` that can be used as input to the `Path` shape's `pathData` attribute to be drawn on the screen. * @param pathType Path type * @param pts List of points * @returns Path data for a cubic curve */ export declare const cubicCurveFromPoints: (pathType: string, pts: Vec2[]) => PathData; /** * Given a list of `PathData`s, returns a `PathData` representing the union of these paths with lines connecting the start and end points. * @param pathType Path type * @param pathDataList List of path data * @returns Connected path data */ export declare const connectPaths: (pathType: string, pathDataList: PathData[]) => PathData; /** * Given a list of `PathData`s, return the union of these paths. * @param pathDataList List of path data * @returns Concatenated path data */ export declare const concatenatePaths: (pathDataList: PathData[]) => PathData; /** * Given a list of `PathData`s, join them into one SVG path. For correct results, the end points and start points of each path must already coincide. * @param pathDataList List of path data * @returns Joined path data */ export declare const joinPaths: (pathDataList: PathData[]) => PathData; /** * Return path data describing an "impossible polygon." * @param center (x,y) translation * @param radius radius of outer polygon (must be positive) * @param holeSize radius of inner polygon as a fraction of the outer radius (in range (0,1]) * @param angle angle of rotation * @param nSides number of sides (integer ≥ 3) * @param chirality either "cw" for clockwise, or "ccw" for counterclockwise * @returns Path data for a Penrose polygon */ export declare const Penrose: (center?: Vec2, radius?: Num, holeSize?: Num, angle?: Num, nSides?: number, chirality?: string) => PathData; /** * Returns the first point in a list. * @param points list of points * @returns First point in the list */ export declare const firstPoint: (points: VecN[]) => VecN; /** * Returns the last point in a list. * @param points list of points * @returns Last point in the list */ export declare const lastPoint: (points: VecN[]) => VecN; /** * Returns the average (mean) of all points in a list. * @param points list of points * @returns Average point */ export declare const averagePoint: (points: VecN[]) => VecN; /** * Returns path data for a curve that smoothly interpolates the given points. Interpolation is performed via a Catmull-Rom spline. * @param pathType either "open" or "closed." * @param points points to be interpolated * @param tension smoothness of curve (0=piecewise linear, .25=default) * @returns Path data for interpolating spline */ export declare const interpolatingSpline: (pathType: string, points: VecN[], tension?: Num) => PathData; /** * Return `n` points sampled from a diffusion process starting at `X0`, with covariance matrix `A` and constant drift `omega`. * This path approximately integrates the stochastic differential equation dX_t = omega dt + A dW_t, where W_t is a Wiener process. * @param n number of points * @param X0 starting location * @param A covariance matrix * @param omega drift direction * @returns List of points from the diffusion process */ export declare const diffusionProcess: (n: number, X0: Vec2, A: Vec2[], omega: Vec2) => Vec2[]; /** * Return two points parallel to line `s1` using its normal line `s2`. * @param s1 First line * @param s2 Second line (normal to s1) * @param padding Padding distance * @returns Two points for unit mark */ export declare const unitMark: (s1: Line, s2: Line, padding: Num) => Vec2[]; /** * Return two points to "cap off" the line made in `unitMark`. * @param [start, end] Start and end points of the line * @param t Either "start" or "end" * @param size Size of the cap * @returns Two points for unit mark cap */ export declare const unitMark2: ([start, end]: [Vec2, Vec2], t: string, size: Num) => Vec2[]; /** * Return series of elements that can render an arc SVG. * @param pathType either "open" or "closed." * @param start coordinate to start drawing the arc * @param end coordinate to finish drawing the arc * @param [width, height] width and height of the ellipse to draw the arc along * @param rotation angle in degrees to rotate ellipse about its center * @param largeArc 0 to draw shorter of 2 arcs, 1 to draw longer * @param arcSweep 0 to rotate CCW, 1 to rotate CW * @returns Path data for an arc */ export declare const arc: (pathType: string, start: Vec2, end: Vec2, [width, height]: Vec2, rotation: Num, largeArc: Num, arcSweep: Num) => PathData; /** * Return path data that describes a circular arc. * @param pathType either "open" or "closed." * @param center circle center * @param r circle radius * @param theta0 start angle in radians * @param theta1 end angle in radians * @returns Path data for a circular arc */ export declare const circularArc: (pathType: string, center: Vec2, r: Num, theta0: Num, theta1: Num) => PathData; /** * Generate multiple concentric arcs. Useful for denoting equal angles. * @param innerStart coordinate to start drawing the inner arc * @param innerEnd coordinate to end the inner arc * @param outerStart coordinate to start drawing the outer arc * @param outerEnd coordinate to end the outer arc * @param innerRadius radii of the ellipse to draw the inner arc along (width, height) * @param repeat number of times to repeat the arc * @param spacing spacing between arcs * @param arcSweep arc length to sweep * @returns Path data for repeated arcs */ export declare const repeatedArcs: (innerStart: Vec2, innerEnd: Vec2, outerStart: Vec2, outerEnd: Vec2, innerRadius: Vec2, repeat: number, spacing: Num, arcSweep: Num) => PathData; /** * Return series of elements that render a "wedge", which is the same as the arc above except that it's connected to the circle center and filled. * @param center center of the circle on which the arc sits * @param start coordinate to start drawing the arc * @param end coordinate to finish drawing the arc * @param radius width and height of the ellipse to draw the arc along (i.e. [width, height]) * @param rotation angle in degrees to rotate ellipse about its center * @param largeArc 0 to draw shorter of 2 arcs, 1 to draw longer * @param arcSweep 0 to rotate CCW, 1 to rotate CW * @returns Path data for a wedge */ export declare const wedge: (center: Vec2, start: Vec2, end: Vec2, radius: Vec2, rotation: Num, largeArc: Num, arcSweep: Num) => PathData; /** * Find the point that is located at dist r along a line between p1 and p2. * @param p1 start point of line segment * @param p2 endpoint of line segment * @param r distance from p1 to travel along the line * @returns vector representation of the point of intersection */ export declare const ptOnLine: (p1: VecN, p2: VecN, r: Num) => VecN; /** * Return 0 if direction of rotation is CCW, 1 if direction of rotation is CW. * @param [x1, y1] x, y coordinates of the circle/ellipse that the arc is drawn on * @param start start point of the arc * @param end end point of the arc * @returns 0 or 1 depending on CCW or CW rotation */ export declare const arcSweepFlag: ([x1, y1]: Vec2, start: Vec2, end: Vec2) => Num; /** * Return the unsigned angle between vectors `u, v`, in radians. * Assumes that both u and v have nonzero magnitude. * The returned value will be in the range [0,pi]. * @param u A vector * @param v A vector * @returns Angle between vectors in radians */ export declare const angleBetween: (u: VecN, v: VecN) => Num; /** * Return the signed angle from vector `u` to vector `v`, in radians. * Assumes that both u and v are 2D vectors and have nonzero magnitude. * The returned value will be in the range [-pi,pi]. * @param u A vector * @param v A vector * @returns Signed angle from u to v in radians */ export declare const angleFrom: (u: VecN, v: VecN) => Num; /** * Return the 2D cross product of `u` and `v`, equal to the determinant of the 2x2 matrix [u v] * @param u A vector * @param v A vector * @returns 2D cross product */ export declare const cross2D: (u: Vec2, v: Vec2) => Num; /** * Return the 3D cross product of `u` and `v`. * @param u A vector * @param v A vector * @returns 3D cross product */ export declare const cross: (u: Vec3, v: Vec3) => Vec3; /** * Return the intersection of a line passing through `a0` and `a1` with a line passing through `b0` and `b1` * @param a0 First point of first line * @param a1 Second point of first line * @param b0 First point of second line * @param b1 Second point of second line * @returns Intersection point */ export declare const lineLineIntersection: (a0: Vec2, a1: Vec2, b0: Vec2, b1: Vec2) => Vec2; /** * Return a point located at the midpoint between pts `start` and `end` * @param start First point * @param end Second point * @returns Midpoint */ export declare const midpoint: (start: VecN, end: VecN) => VecN; /** * Return a point located at the midpoint of a line `s1` but offset by `padding` in its normal direction (for labeling). * @param s1 A line * @param padding Padding between midpoint and label * @returns Offset midpoint */ export declare const midpointOffset: (s1: Line, padding: Num) => Vec2; /** * Return a list of points for a chevron shape comprised of two line segments intersecting at a right angle at the midpoint of `s1`, which can then be passed to `pathFromPoints` to draw the chevron. * @param s1 A line * @param padding Length of each line segment * @returns List of points for chevron */ export declare const chevron: (s1: Line, padding: Num) => Vec2[]; /** * Return a point located at `padding` of a line `s1` offset by `padding` in its normal direction (for making right angle markers). * @param pt1 First point * @param pt2 Second point * @param pt3 Third point * @param padding Offset from line to returned point * @returns Offset point */ export declare const innerPointOffset: (pt1: Vec2, pt2: Vec2, pt3: Vec2, padding: Num) => Vec2; /** * Create equally spaced tick marks centered at the midpoint of a line * @param pt1 starting point of a line * @param pt2 ending point of a line * @param spacing space in px between each tick * @param numTicks number of tick marks to create * @param tickLength 1/2 length of each tick * @returns Path data for tick marks */ export declare const ticksOnLine: (pt1: Vec2, pt2: Vec2, spacing: Num, numTicks: number, tickLength: Num) => PathData; /** * Given two orthogonal segments that intersect at `intersection`, and a size `len` * return a path comprised of three points that describe a perpendicular mark at the angle where the segments intersect. * @param s1 First line segment * @param s2 Second line segment * @param intersection Point of intersection * @param len Side length of square marker * @returns Path data for oriented square */ export declare const orientedSquare: (s1: Line, s2: Line, intersection: Vec2, len: Num) => PathData; /** * Given three lines `l1, l2, l3` that already form a triangle, return a path that describes the triangle (which can then be filled, etc.). * @param l1 First line * @param l2 Second line * @param l3 Third line * @returns Path data for triangle */ export declare const triangle: (l1: Line, l2: Line, l3: Line) => PathData; /** * Return the average of floats `x` and `y`. * @param x `x` * @param y `y` * @returns Average of x and y */ export declare const average2: (x: Num, y: Num) => Num; /** * Return the average of the floats in the list `xs`. * @param xs `xs` * @returns Average of xs */ export declare const average: (xs: VecN) => Num; /** * Return the normalized version of vector `v`. * @param v `v` * @returns Normalized vector */ export declare const unit: (v: VecN) => VecN; /** * Return a uniform random value between minVal and maxValue. * @param minVal minimum value * @param maxVal maximum value * @returns Random value */ export declare const random: (minVal: Num, maxVal: Num) => Num; /** * Return a uniform random value between 0 and 1 * @returns Random value between 0 and 1 */ export declare const unitRandom: () => Num; /** * Return a random value sampled from the uniform distribution on the unit disk. * @returns Random point on unit disk */ export declare const diskRandom: () => Vec2; /** * Return a random value sampled from the uniform distribution on the unit circle. * @returns Random point on unit circle */ export declare const circleRandom: () => Vec2; /** * Return a random value sampled from the uniform distribution on the unit sphere. * @returns Random point on unit sphere */ export declare const sphereRandom: () => Vec3; /** * Return a random value sampled from a normal distribution with mean 0 and standard deviation 1. * @returns Random value from normal distribution */ export declare const normalRandom: () => Num; /** * Return a random point sampled from the uniform distribution on a triangle with vertices a, b, c. * @param a First vertex * @param b Second vertex * @param c Third vertex * @returns Random point in triangle */ export declare const triangleRandom: (a: Vec2, b: Vec2, c: Vec2) => Vec2; /** * Sample a random color once, with opacity `alpha` and colorType `colorType` (`"rgb"` or `"hsv"`). * @param alpha Opacity * @param colorType Color model * @returns Random color */ export declare const sampleColor: (alpha: Num, colorType: "rgb" | "hsv") => Color; /** * Return a uniform index value between minIndex and maxIndex. * @param minIndex minimum index * @param maxIndex maximum index * @returns Random index */ export declare const randomIndex: (minIndex: Num, maxIndex: Num) => number; /** * Set the opacity of a color `color` to `frac`. * @param color Color * @param frac Opacity * @returns Color with new opacity */ export declare const setOpacity: (color: Color, frac: Num) => Color; /** * Multiply a matrix `m` and a vector `v` (where `v` is implicitly treated as a column vector). * @param m A matrix * @param v A vector * @returns Result of matrix-vector multiplication */ export declare const mul: (m: VecN[], v: VecN) => VecN; /** * Return the barycenter of the triangle with vertices `a`, `b`, `c`. * @param a First vertex * @param b Second vertex * @param c Third vertex * @returns Barycenter */ export declare const barycenter: (a: Vec2, b: Vec2, c: Vec2) => Vec2; /** * Return the circumcenter of the triangle with vertices `p`, `q`, `r`. * @param p First vertex * @param q Second vertex * @param r Third vertex * @returns Circumcenter */ export declare const circumcenter: (p: Vec2, q: Vec2, r: Vec2) => Vec2; /** * Return the circumradius of the triangle with vertices `p`, `q`, `r`. * @param p First vertex * @param q Second vertex * @param r Third vertex * @returns Circumradius */ export declare const circumradius: (p: Vec2, q: Vec2, r: Vec2) => Num; /** * Return the incenter of the triangle with vertices `p`, `q`, `r`. * @param p First vertex * @param q Second vertex * @param r Third vertex * @returns Incenter */ export declare const incenter: (p: Vec2, q: Vec2, r: Vec2) => Vec2; /** * Return the inradius of the triangle with vertices `p`, `q`, `r`. * @param p First vertex * @param q Second vertex * @param r Third vertex * @returns Inradius */ export declare const inradius: (p: Vec2, q: Vec2, r: Vec2) => Num; /** * Return the square of the number `x`. * @param x `x` * @returns Square of x */ export declare const sqr: (x: Num) => Num; /** * Return the square root of the number `x`. (NOTE: if `x < 0`, you may get `NaN`s) * @param x `x` * @returns Square root of x */ export declare const sqrt: (x: Num) => Num; /** * Return the max of the numbers `x`, `y`. * @param x `x` * @param y `y` * @returns Maximum of x and y */ export declare const max: (x: Num, y: Num) => Num; /** * Return the min of the numbers `x`, `y`. * @param x `x` * @param y `y` * @returns Minimum of x and y */ export declare const min: (x: Num, y: Num) => Num; /** * Return the absolute value of the number `x`. * @param x `x` * @returns Absolute value of x */ export declare const abs: (x: Num) => Num; /** * Convert the angle `theta` from degrees to radians. * @param theta `theta` * @returns Angle in radians */ export declare const toRadians: (theta: Num) => Num; /** * Convert the angle `theta` from radians to degrees. * @param theta The angle in radians * @returns The angle in degrees */ export declare const toDegrees: (theta: Num) => Num; /** * Return the Euclidean norm of the vector `v`. * @param v A vector * @returns The Euclidean norm of v */ export declare const norm: (v: VecN) => Num; /** * Return the Euclidean norm squared of the vector `v`. * @param v A vector * @returns The Euclidean norm squared of v */ export declare const normsq: (v: VecN) => Num; /** * Return the Euclidean distance between the vectors `v` and `w`. * @param v A vector * @param w A vector * @returns The Euclidean distance between v and w */ export declare const vdist: (v: VecN, w: VecN) => Num; /** * Returns the scalar-vector product. * @param s A scalar * @param v A vector * @returns The scalar-vector product */ export declare const vmul: (s: Num, v: VecN) => VecN; /** * Return the Euclidean distance squared between the vectors `v` and `w`. * @param v A vector * @param w A vector * @returns The Euclidean distance squared between v and w */ export declare const vdistsq: (v: VecN, w: VecN) => Num; /** * Return the angle made by the vector `v` with the positive x-axis. * @param v A vector * @returns The angle made by v with the positive x-axis */ export declare const angleOf: (v: VecN) => Num; /** * Base e of the natural logarithm. * @returns The value of e */ export declare const MathE: () => Num; /** * Ratio of the circumference of a circle to its diameter. * @returns The value of PI */ export declare const MathPI: () => Num; /** * Rotate a 2D vector `v` by 90 degrees counterclockwise. * @param v A vector * @returns The rotated vector */ export declare const rot90: (v: Vec2) => Vec2; /** * Rotate a 2D vector `v` by theta degrees counterclockwise. * @param v A vector * @param theta degrees to rotate counterclockwise * @returns The rotated vector */ export declare const rotateBy: (v: Vec2, theta: Num) => Vec2; /** * Return the signed distance between a shape and a point * @param s A shape (Rect, Circle, Polygon, Line, or Polyline) * @param p A point * @returns The signed distance */ export declare const signedDistance: (s: Shape, p: Vec2) => Num; /** * Returns the distance between a rect and a point * @param rect A rectangle represented by its corner points * @param pt A point * @returns The signed distance */ export declare const signedDistanceRect: (rect: Vec2[], pt: Vec2) => Num; /** * Returns the distance between a circle and a point * @param c center of circle * @param r radius of circle * @param pt the point * @returns The signed distance */ export declare const signedDistanceCircle: (c: Vec2, r: Num, pt: Vec2) => Num; /** * Returns the distance between a polygon and a point * @param pts points of the polygon * @param pt the point * @returns The signed distance */ export declare const signedDistancePolygon: (pts: Vec2[], pt: Vec2) => Num; /** * Returns the distance between an ellipse and a point * @param c center of ellipse * @param rx horizontal radius of ellipse * @param ry vertical radius of ellipse * @param pt the point * @returns The signed distance */ export declare const signedDistanceEllipse: (c: Vec2, rx: Num, ry: Num, pt: Vec2) => Num; /** * Returns the distance between a line and a point * @param start start of line * @param end end of line * @param pt the point * @returns The signed distance */ export declare const signedDistanceLine: (start: Vec2, end: Vec2, pt: Vec2) => Num; /** * Returns the distance between a line and a polyline * @param pts points of the polyline * @param pt the point * @returns The signed distance */ export declare const signedDistancePolyline: (pts: Vec2[], pt: Vec2) => Num; /** * Returns the signed distance between a group of shapes and a point * @param shapes A list of shapes * @param pt A point * @returns The signed distance */ export declare const signedDistanceGroup: (shapes: Shape[], pt: Vec2) => Num; /** * Construct a unit vector u in the direction of the given angle theta (in radians). * @param theta direction * @returns A unit vector */ export declare const unitVector: (theta: Num) => Vec2; /** * Given a point p and vector v, find the first point where the ray r(t)=p+tv intersects the given shape S. * If there are no intersections, returns p. * @param S A shape (Circle, Rect, Line, Polyline, Polygon, Ellipse, or Group) * @param p A point * @param v A vector * @returns The intersection point */ export declare const rayIntersect: (S: Exclude, p: Vec2, v: Vec2) => Vec2; /** * Given a point p and vector v, returns the distance to the first point where the ray r(t)=p+tv intersects the shape S. * If there are no intersections, returns Infinity. * @param S A shape (Circle, Rect, Line, Polyline, Polygon, Ellipse, or Group) * @param p A point * @param v A vector * @returns The distance to intersection */ export declare const rayIntersectDistance: (S: Exclude, p: Vec2, v: Vec2) => Num; /** * Ray intersection with a circle * @param c center of circle * @param r radius of circle * @param p A point * @param v A vector * @returns The intersection point */ export declare const rayIntersectCircle: (c: Vec2, r: Num, p: Vec2, v: Vec2) => Vec2; /** * Distance to ray intersection with a circle * @param c center of circle * @param r radius of circle * @param p A point * @param v A vector * @returns The distance to intersection */ export declare const rayIntersectCircleDistance: (c: Vec2, r: Num, p: Vec2, v: Vec2) => Num; /** * Ray intersection with an ellipse * @param c center of ellipse * @param rx horizontal radius of ellipse * @param ry vertical radius of ellipse * @param p A point * @param v A vector * @returns The intersection point */ export declare const rayIntersectEllipse: (c: Vec2, rx: Num, ry: Num, p: Vec2, v: Vec2) => Vec2; /** * Distance to ray intersection with an ellipse * @param c center of ellipse * @param rx horizontal radius of ellipse * @param ry vertical radius of ellipse * @param p A point * @param v A vector * @returns The distance to intersection */ export declare const rayIntersectEllipseDistance: (c: Vec2, rx: Num, ry: Num, p: Vec2, v: Vec2) => Num; /** * Ray intersection with a line * @param start start point of the line * @param end end point of the line * @param p A point * @param v A vector * @returns The intersection point */ export declare const rayIntersectLine: (start: Vec2, end: Vec2, p: Vec2, v: Vec2) => Vec2; /** * Distance to ray intersection with a line * @param start start point of the line * @param end end point of the line * @param p A point * @param v A vector * @returns The distance to intersection */ export declare const rayIntersectLineDistance: (start: Vec2, end: Vec2, p: Vec2, v: Vec2) => Num; /** * Ray intersection with a rectangle * @param rect The top-right, top-left, bottom-left, bottom-right points (in that order) of the rectangle * @param p A point * @param v A vector * @returns The intersection point */ export declare const rayIntersectRect: (rect: Vec2[], p: Vec2, v: Vec2) => Vec2; /** * Distance to ray intersection with a rectangle * @param rect The top-right, top-left, bottom-left, bottom-right points (in that order) of the rectangle * @param p A point * @param v A vector * @returns The distance to intersection */ export declare const rayIntersectRectDistance: (rect: Vec2[], p: Vec2, v: Vec2) => Num; /** * Ray intersection with a polygon or polyline * @param pts The points of the polygon or polyline * @param closed Whether the shape is closed (true for polygon, false for polyline) * @param p A point * @param v A vector * @returns The intersection point */ export declare const rayIntersectPoly: (pts: Vec2[], closed: boolean, p: Vec2, v: Vec2) => Vec2; /** * Distance to ray intersection with a polygon or polyline * @param pts The points of the polygon or polyline * @param closed Whether the shape is closed (true for polygon, false for polyline) * @param p A point * @param v A vector * @returns The distance to intersection */ export declare const rayIntersectPolyDistance: (pts: Vec2[], closed: boolean, p: Vec2, v: Vec2) => Num; /** * Ray intersection with a group of shapes * @param shapes A list of shapes * @param p A point * @param v A vector * @returns The intersection point */ export declare const rayIntersectGroup: (shapes: Shape[], p: Vec2, v: Vec2) => Vec2; /** * Distance to ray intersection with a group of shapes * @param shapes A list of shapes * @param p A point * @param v A vector * @returns The distance to intersection */ export declare const rayIntersectGroupDistance: (shapes: Shape[], p: Vec2, v: Vec2) => Num; /** * Given a point p and vector v, find the unit normal at the first point where the ray r(t)=p+tv intersects the given shape S. * If there are no intersections, returns (0,0). * @param S A shape (Circle, Rect, Line, Polyline, Polygon, Ellipse, or Group) * @param p A point * @param v A vector * @returns The unit normal at the intersection point */ export declare const rayIntersectNormal: (S: Exclude, p: Vec2, v: Vec2) => Vec2; /** * Normal at ray intersection with a circle * @param c center of circle * @param r radius of circle * @param p A point * @param v A vector * @returns The unit normal at the intersection point */ export declare const rayIntersectNormalCircle: (c: Vec2, r: Num, p: Vec2, v: Vec2) => Vec2; /** * Normal at ray intersection with an ellipse * @param c center of ellipse * @param rx horizontal radius of ellipse * @param ry vertical radius of ellipse * @param p A point * @param v A vector * @returns The unit normal at the intersection point */ export declare const rayIntersectNormalEllipse: (c: Vec2, rx: Num, ry: Num, p: Vec2, v: Vec2) => Vec2; /** * Normal at ray intersection with a line * @param start start point of the line * @param end end point of the line * @param p A point * @param v A vector * @returns The unit normal at the intersection point */ export declare const rayIntersectNormalLine: (start: Vec2, end: Vec2, p: Vec2, v: Vec2) => Vec2; /** * Normal at ray intersection with a rectangle * @param rect The top-right, top-left, bottom-left, bottom-right points (in that order) of the rectangle * @param p A point * @param v A vector * @returns The unit normal at the intersection point */ export declare const rayIntersectNormalRect: (rect: Vec2[], p: Vec2, v: Vec2) => Vec2; /** * Normal at ray intersection with a polygon or polyline * @param pts The points of the polygon or polyline * @param closed Whether the shape is closed (true for polygon, false for polyline) * @param p A point * @param v A vector * @returns The unit normal at the intersection point */ export declare const rayIntersectNormalPoly: (pts: Vec2[], closed: boolean, p: Vec2, v: Vec2) => Vec2; /** * Normal at ray intersection with a group of shapes * @param shapes A list of shapes * @param p A point * @param v A vector * @returns The unit normal at the intersection point */ export declare const rayIntersectNormalGroup: (shapes: Shape[], p: Vec2, v: Vec2) => Vec2; /** * Returns a point on the shape s closest to a query point p. If this point is not unique, an arbitrary choice is made. * @param s A shape (Circle, Rect, Polygon, Line, Polyline, Ellipse, or Group) * @param p A point * @returns The closest point on the shape */ export declare const closestPoint: (s: Shape, p: Vec2) => Vec2; /** * Returns the closest point on a circle to a given point * @param c center of circle * @param r radius of circle * @param pt the point * @returns The closest point on the circle */ export declare const closestPointCircle: (c: Vec2, r: Num, pt: Vec2) => Vec2; /** * Returns the closest point on a rectangle to a given point * @param rect The top-right, top-left, bottom-left, bottom-right points (in that order) of the rectangle * @param pt the point * @returns The closest point on the rectangle */ export declare const closestPointRect: (rect: Vec2[], pt: Vec2) => Vec2; /** * Returns the closest point on a line to a given point * @param start start point of line * @param end end point of line * @param pt the point * @returns The closest point on the line */ export declare const closestPointLine: (start: Vec2, end: Vec2, pt: Vec2) => Vec2; /** * Returns the closest point on an ellipse to a given point * @param c center of ellipse * @param rx horizontal radius of ellipse * @param ry vertical radius of ellipse * @param pt the point * @returns The closest point on the ellipse */ export declare const closestPointEllipse: (c: Vec2, rx: Num, ry: Num, pt: Vec2) => Vec2; /** * Returns the closest point on a polygon or polyline to a given point * @param pts points of the polygon * @param closed whether or not the polygon is closed * @param pt the point * @returns The closest point on the polygon or polyline */ export declare const closestPointPoly: (pts: Vec2[], closed: boolean, pt: Vec2) => Vec2; /** * Returns the closest point on a group of shapes to a given point * @param shapes shapes of the group * @param pt the point * @returns The closest point on the group of shapes */ export declare const closestPointGroup: (shapes: Shape[], pt: Vec2) => Vec2; /** * Returns a point on the visibility silhouette of shape s closest to a query point p. * If this point is not unique, an arbitrary choice is made. If no such point exists, the query point p is returned. * @param s A shape (Circle, Rect, Polygon, Line, Polyline, Ellipse, or Group) * @param p A point * @returns The closest point on the visibility silhouette */ export declare const closestSilhouettePoint: (s: Exclude, p: Vec2) => Vec2; /** * Returns the closest point on the visibility silhouette of a circle * @param c center of circle * @param r radius of circle * @param p A point * @returns The closest point on the visibility silhouette of the circle */ export declare const closestSilhouettePointCircle: (c: Vec2, r: Num, p: Vec2) => Vec2; /** * Returns the closest point on the visibility silhouette of an ellipse * @param c center of ellipse * @param rx horizontal radius of ellipse * @param ry vertical radius of ellipse * @param p A point * @returns The closest point on the visibility silhouette of the ellipse */ export declare const closestSilhouettePointEllipse: (c: Vec2, rx: Num, ry: Num, p: Vec2) => Vec2; /** * Returns the closest point on the visibility silhouette of a line * @param start start point of line * @param end end point of line * @param p A point * @returns The closest point on the visibility silhouette of the line */ export declare const closestSilhouettePointLine: (start: Vec2, end: Vec2, p: Vec2) => Vec2; /** * Returns the closest point on the visibility silhouette of a rectangle * @param rect The top-right, top-left, bottom-left, bottom-right points (in that order) of the rectangle * @param p A point * @returns The closest point on the visibility silhouette of the rectangle */ export declare const closestSilhouettePointRect: (rect: Vec2[], p: Vec2) => Vec2; /** * Returns the closest point on the visibility silhouette of a polyline * @param points points of the polyline * @param p A point * @returns The closest point on the visibility silhouette of the polyline */ export declare const closestSilhouettePointPolyline: (points: Vec2[], p: Vec2) => Vec2; /** * Returns the closest point on the visibility silhouette of a polygon * @param points points of the polygon * @param p A point * @returns The closest point on the visibility silhouette of the polygon */ export declare const closestSilhouettePointPolygon: (points: Vec2[], p: Vec2) => Vec2; /** * Returns the closest point on the visibility silhouette of a group of shapes * @param shapes A list of shapes * @param p A point * @returns The closest point on the visibility silhouette of the group of shapes */ export declare const closestSilhouettePointGroup: (shapes: Shape[], p: Vec2) => Vec2; /** * Returns the distance to the closest point on the visibility silhouette of shape s relative to query point p. * If no such point exists, returns Infinity. * @param s A shape (Circle, Rect, Polygon, Line, Polyline, Ellipse, or Group) * @param p A point * @returns The distance to the closest point on the visibility silhouette */ export declare const closestSilhouetteDistance: (s: Exclude, p: Vec2) => Num; /** * Return the distance between a rectangle (defined using the bottom-left and top-right points) and a line (defined using start and end points) * @param bottomLeft bottom-left point of rectangle * @param topRight top-right point of rectangle * @param start start point of line * @param end end point of line * @returns The distance between the rectangle and the line */ export declare const rectLineDist: (bottomLeft: Vec2, topRight: Vec2, start: Vec2, end: Vec2) => Num; /** * Return the distance between two shapes. * @param s1 a shape * @param s2 a shape * @returns The distance between the two shapes */ export declare const shapeDistance: (s1: Shape, s2: Shape) => Num; /** * Return the distance between two circles. * @param c1 center of first circle * @param r1 radius of first circle * @param c2 center of second circle * @param r2 radius of second circle * @returns The distance between the two circles */ export declare const shapeDistanceCircles: (c1: Vec2, r1: Num, c2: Vec2, r2: Num) => Num; /** * Return the distance between two rectangles. * @param rect1 The top-right, top-left, bottom-left, bottom-right points (in that order) of the first rectangle. * @param rect2 The top-right, top-left, bottom-left, bottom-right points (in that order) of the second rectangle. * @returns The distance between the two rectangles */ export declare const shapeDistanceRects: (rect1: Vec2[], rect2: Vec2[]) => Num; /** * Returns the distance between a rectangle and a line. * @param rect The top-right, top-left, bottom-left, bottom-right points (in that order) of the rectangle. * @param start The start point of the line * @param end The end point of the line * @returns The distance between the rectangle and the line */ export declare const shapeDistanceRectLine: (rect: Vec2[], start: Vec2, end: Vec2) => Num; /** * Returns the distance between a rectangle and a polyline. * @param rect The top-right, top-left, bottom-left, bottom-right points (in that order) of the rectangle. * @param points points of polyline * @returns The distance between the rectangle and the polyline */ export declare const shapeDistanceRectlikePolyline: (rect: Vec2[], points: Vec2[]) => Num; /** * Returns the distance between two polygons. * @param pts1 The list of points for the first polygon * @param pts2 The list of points for the second polygon * @returns The distance between the two polygons */ export declare const shapeDistancePolys: (pts1: Vec2[], pts2: Vec2[]) => Num; /** * Returns the distance between a rectangle and a circle. * @param rect The top-right, top-left, bottom-left, bottom-right points (in that order) of the rectangle. * @param c center of the circle * @param r radius of the circle * @returns The distance between the rectangle and the circle */ export declare const shapeDistanceRectCircle: (rect: Vec2[], c: Vec2, r: Num) => Num; /** * Returns the distance between a polygon and an ellipse. * @param pts The list of points for the polygon * @param c center of the ellipse * @param rx horizontal radius of ellipse * @param ry vertical radius of ellipse * @returns The distance between the polygon and the ellipse */ export declare const shapeDistancePolyEllipse: (pts: Vec2[], c: Vec2, rx: Num, ry: Num) => Num; /** * Returns the distance between a circle and a line. * @param c center of the circle * @param r radius of the circle * @param start start point of line * @param end end point of line * @returns The distance between the circle and the line */ export declare const shapeDistanceCircleLine: (c: Vec2, r: Num, start: Vec2, end: Vec2) => Num; /** * Returns the distance between two lines. * @param start1 start point of first line * @param end1 end point of first line * @param start2 start point of second line * @param end2 end point of second line * @returns The distance between the two lines */ export declare const shapeDistanceLines: (start1: Vec2, end1: Vec2, start2: Vec2, end2: Vec2) => Num; //# sourceMappingURL=computation.d.ts.map