UNPKG

gl2d

Version:

2D graphics package for WebGL

371 lines (370 loc) 13 kB
import { PointLike } from "./point"; import { Rect } from "./rect"; import { Struct } from "gulp-structify/struct"; import { StructBuffer } from "gulp-structify/buffer"; /** * Ellipse with semi axes (rx,ry) centered at the point (cx,cy). */ export declare class Ellipse { static fromRect(bounds: Rect): Ellipse; static create(other: EllipseLike): Ellipse; /** * The semi x axis of this ellipse, that is, the distance from the center of this ellipse to its left and right vertices. */ rx: number; /** * The semi y axis of this ellipse, that is, the distance from the center of this ellipse to its top and bottom vertices. */ ry: number; /** * The X coordinate of the point at the center of this ellipse. */ cx: number; /** * The Y coordinate of the point at the center of this ellipse. */ cy: number; /** * Ellipse with semi axes (rx,ry) centered at the point (cx,cy). */ constructor(rx?: number, ry?: number, cx?: number, cy?: number); /** * Sets this ellipse to an ellipse bounded by the specified rect. */ setFromRect(bounds: Rect): void; /** * Checks if this ellipse contains the specified point. * @param pt the point to check. */ contains(pt: PointLike): boolean; /** * Checks if this ellipse contains the point (x,y). * @param x the x coordinate of the point. * @param y the y coordinate of the point. */ contains$(x: number, y: number): boolean; /** * Sets each component of this Ellipse to that of the other Ellipse. */ set(other: EllipseLike): void; /** * Sets each component of this Ellipse. */ set$(rx: number, ry: number, cx: number, cy: number): void; /** * Sets each component of this Ellipse to the specified scalar. */ setScalar(k: number): void; /** * Adds the other Ellipse to this Ellipse componentwise. */ add(other: EllipseLike): void; /** * Adds the specified values to this Ellipse componentwise. */ add$(rx: number, ry: number, cx: number, cy: number): void; /** * Subtracts the other Ellipse from this Ellipse componentwise. */ subtract(other: EllipseLike): void; /** * Subtracts the specified values from this Ellipse componentwise. */ subtract$(rx: number, ry: number, cx: number, cy: number): void; /** * Multiplies each component of this Ellipse by the specified scalar. */ mulScalar(k: number): void; /** * Divides each component of this Ellipse by the specified scalar. */ divScalar(k: number): void; /** * Checks if each component of this Ellipse is exactly equal to that of the other Ellipse. */ equals(other: EllipseLike): boolean; /** * Checks if each component of this Ellipse is exactly equal to the specified scalar. */ equalsScalar(k: number): boolean; /** * Checks if each component of this Ellipse is approximately equal to that of the other Ellipse. */ epsilonEquals(other: EllipseLike, e: number): boolean; /** * Checks if each component of this Ellipse is approximately equal to the specified scalar. */ epsilonEqualsScalar(k: number, e: number): boolean; /** * Returns a string representation of this Ellipse. */ toString(): string; } /** * Ellipse with semi axes (rx,ry) centered at the point (cx,cy). */ export interface EllipseLike { /** * The semi x axis of this ellipse, that is, the distance from the center of this ellipse to its left and right vertices. */ rx: number; /** * The semi y axis of this ellipse, that is, the distance from the center of this ellipse to its top and bottom vertices. */ ry: number; /** * The X coordinate of the point at the center of this ellipse. */ cx: number; /** * The Y coordinate of the point at the center of this ellipse. */ cy: number; } /** * A Ellipse backed by a Float32Array. */ export declare class EllipseStruct extends Struct<Float32Array> { static fromRect(bounds: Rect): EllipseStruct; static create(other: EllipseLike): EllipseStruct; static create$(rx: number, ry: number, cx: number, cy: number): EllipseStruct; /** * Sets this ellipse to an ellipse bounded by the specified rect. */ setFromRect: (bounds: Rect) => void; /** * Checks if this ellipse contains the specified point. * @param pt the point to check. */ contains: (pt: PointLike) => boolean; /** * Checks if this ellipse contains the point (x,y). * @param x the x coordinate of the point. * @param y the y coordinate of the point. */ contains$: (x: number, y: number) => boolean; /** * Sets each component of this Ellipse to that of the other Ellipse. */ set: (other: EllipseLike) => void; /** * Sets each component of this Ellipse. */ set$: (rx: number, ry: number, cx: number, cy: number) => void; /** * Sets each component of this Ellipse to the specified scalar. */ setScalar: (k: number) => void; /** * Adds the other Ellipse to this Ellipse componentwise. */ add: (other: EllipseLike) => void; /** * Adds the specified values to this Ellipse componentwise. */ add$: (rx: number, ry: number, cx: number, cy: number) => void; /** * Subtracts the other Ellipse from this Ellipse componentwise. */ subtract: (other: EllipseLike) => void; /** * Subtracts the specified values from this Ellipse componentwise. */ subtract$: (rx: number, ry: number, cx: number, cy: number) => void; /** * Multiplies each component of this Ellipse by the specified scalar. */ mulScalar: (k: number) => void; /** * Divides each component of this Ellipse by the specified scalar. */ divScalar: (k: number) => void; /** * Checks if each component of this Ellipse is exactly equal to that of the other Ellipse. */ equals: (other: EllipseLike) => boolean; /** * Checks if each component of this Ellipse is exactly equal to the specified scalar. */ equalsScalar: (k: number) => boolean; /** * Checks if each component of this Ellipse is approximately equal to that of the other Ellipse. */ epsilonEquals: (other: EllipseLike, e: number) => boolean; /** * Checks if each component of this Ellipse is approximately equal to the specified scalar. */ epsilonEqualsScalar: (k: number, e: number) => boolean; /** * Returns a string representation of this Ellipse. */ toString: () => string; /** * Creates a Ellipse struct backed by the specified data. */ constructor(data?: Float32Array); /** * The semi x axis of this ellipse, that is, the distance from the center of this ellipse to its left and right vertices. */ /** * The semi x axis of this ellipse, that is, the distance from the center of this ellipse to its left and right vertices. */ rx: number; /** * The semi y axis of this ellipse, that is, the distance from the center of this ellipse to its top and bottom vertices. */ /** * The semi y axis of this ellipse, that is, the distance from the center of this ellipse to its top and bottom vertices. */ ry: number; /** * The X coordinate of the point at the center of this ellipse. */ /** * The X coordinate of the point at the center of this ellipse. */ cx: number; /** * The Y coordinate of the point at the center of this ellipse. */ /** * The Y coordinate of the point at the center of this ellipse. */ cy: number; } /** * A Ellipse buffer backed by a Float32Array. */ export declare class EllipseBuffer extends StructBuffer<Float32Array> { /** * Creates an empty Ellipse buffer with the specified Ellipse capacity. */ static create(capacity: number): EllipseBuffer; /** * Sets this ellipse to an ellipse bounded by the specified rect. */ setFromRect: (bounds: Rect) => void; /** * Checks if this ellipse contains the specified point. * @param pt the point to check. */ contains: (pt: PointLike) => boolean; /** * Checks if this ellipse contains the point (x,y). * @param x the x coordinate of the point. * @param y the y coordinate of the point. */ contains$: (x: number, y: number) => boolean; /** * Sets each component of this Ellipse to that of the other Ellipse. */ set: (other: EllipseLike) => void; /** * Sets each component of this Ellipse. */ set$: (rx: number, ry: number, cx: number, cy: number) => void; /** * Sets each component of this Ellipse to the specified scalar. */ setScalar: (k: number) => void; /** * Adds the other Ellipse to this Ellipse componentwise. */ add: (other: EllipseLike) => void; /** * Adds the specified values to this Ellipse componentwise. */ add$: (rx: number, ry: number, cx: number, cy: number) => void; /** * Subtracts the other Ellipse from this Ellipse componentwise. */ subtract: (other: EllipseLike) => void; /** * Subtracts the specified values from this Ellipse componentwise. */ subtract$: (rx: number, ry: number, cx: number, cy: number) => void; /** * Multiplies each component of this Ellipse by the specified scalar. */ mulScalar: (k: number) => void; /** * Divides each component of this Ellipse by the specified scalar. */ divScalar: (k: number) => void; /** * Checks if each component of this Ellipse is exactly equal to that of the other Ellipse. */ equals: (other: EllipseLike) => boolean; /** * Checks if each component of this Ellipse is exactly equal to the specified scalar. */ equalsScalar: (k: number) => boolean; /** * Checks if each component of this Ellipse is approximately equal to that of the other Ellipse. */ epsilonEquals: (other: EllipseLike, e: number) => boolean; /** * Checks if each component of this Ellipse is approximately equal to the specified scalar. */ epsilonEqualsScalar: (k: number, e: number) => boolean; /** * Returns a string representation of this Ellipse. */ toString: () => string; /** * The semi x axis of this ellipse, that is, the distance from the center of this ellipse to its left and right vertices. */ /** * The semi x axis of this ellipse, that is, the distance from the center of this ellipse to its left and right vertices. */ rx: number; /** * The semi y axis of this ellipse, that is, the distance from the center of this ellipse to its top and bottom vertices. */ /** * The semi y axis of this ellipse, that is, the distance from the center of this ellipse to its top and bottom vertices. */ ry: number; /** * The X coordinate of the point at the center of this ellipse. */ /** * The X coordinate of the point at the center of this ellipse. */ cx: number; /** * The Y coordinate of the point at the center of this ellipse. */ /** * The Y coordinate of the point at the center of this ellipse. */ cy: number; /** * Gets the number of properties in a Ellipse, namely 4. */ structLength(): number; /** * Gets the components of the Ellipse at the specified position of this buffer. */ aget(position: number, dst?: EllipseLike): EllipseLike; /** * Gets the components of the current Ellipse, then moves to the next position of this buffer. */ rget(dst?: EllipseLike): EllipseLike; /** * Sets each component of the Ellipse at the specified position to that of the src Ellipse. */ aset(position: number, src: EllipseLike): void; /** * Sets each component of the Ellipse at the specified position. */ aset$(position: number, rx: number, ry: number, cx: number, cy: number): void; /** * Sets each component of the current Ellipse to that of the src Ellipse, then moves to the next position of this buffer. */ rset(src: EllipseLike): void; /** * Sets each component of the current Ellipse, then moves to the next position of this buffer. */ rset$(rx: number, ry: number, cx: number, cy: number): void; }