import type { Matrix2d } from "../math/matrix2d.ts"; import { Vector2d } from "../math/vector2d.ts"; import { Bounds } from "../physics/bounds.ts"; import { Polygon } from "./polygon.ts"; /** * an ellipse Object * @category Geometry */ export declare class Ellipse { /** * the center coordinates of the ellipse */ pos: Vector2d; /** * The bounding rectangle for this shape */ _bounds: Bounds; /** * Maximum radius of the ellipse */ radius: number; /** * Pre-scaled radius vector for ellipse */ radiusV: Vector2d; /** * Radius squared, for pythagorean theorem */ private radiusSq; /** * x/y scaling ratio for ellipse */ ratio: Vector2d; /** * the internal rotation angle of the ellipse in radians */ private _angle; /** * cached cosine of the current angle */ private _cos; /** * cached sine of the current angle */ private _sin; /** * cached polygon approximation, invalidated when shape changes */ private _polygon; /** * the rotation angle of the ellipse in radians */ get angle(): number; set angle(value: number); /** * the shape type (used internally) */ type: string; /** * @param x - the center x coordinate of the ellipse * @param y - the center y coordinate of the ellipse * @param w - width (diameter) of the ellipse * @param h - height (diameter) of the ellipse */ constructor(x: number, y: number, w: number, h: number); /** * set new value to the Ellipse shape * @param x - the center x coordinate of the ellipse * @param y - the center y coordinate of the ellipse * @param w - width (diameter) of the ellipse * @param h - height (diameter) of the ellipse * @returns this instance for object chaining */ setShape(x: number, y: number, w: number, h: number): this; /** * update the bounding box for this ellipse, taking rotation into account */ private updateBounds; /** * Rotate this Ellipse (counter-clockwise) by the specified angle (in radians). * @param angle - The angle to rotate (in radians) * @param [v] - an optional point to rotate around * @returns Reference to this object for method chaining */ rotate(angle: number, v?: Vector2d): this; /** * Scale this Ellipse by the specified scalar. * @param x - the scale factor along the x-axis * @param [y=x] - the scale factor along the y-axis * @returns Reference to this object for method chaining */ scale(x: number, y?: number): this; /** * Scale this Ellipse by the specified vector. * @param v - Scaling vector. * @returns Reference to this object for method chaining */ scaleV(v: Vector2d): this; /** * apply the given transformation matrix to this ellipse * @param m - the transformation matrix * @returns Reference to this object for method chaining */ transform(m: Matrix2d): this; /** * translate the circle/ellipse by the specified offset * @param x - x coordinate or a vector point to translate by * @param [y] - y offset * @returns this ellipse * @example * ellipse.translate(10, 10); * // or * ellipse.translate(myVector2d); */ translate(x: number, y: number): Ellipse; translate(vector: Vector2d): Ellipse; /** * check if this circle/ellipse contains the specified point * @param x - x coordinate or a vector point to check * @param [y] - y coordinate * @param args * @returns true if contains * @example * if (circle.contains(10, 10)) { * // do something * } * // or * if (circle.contains(myVector2d)) { * // do something * } */ contains(x: number, y: number): boolean; contains(vector: Vector2d): boolean; /** * returns the bounding box for this shape, the smallest Rectangle object completely containing this shape. * @returns this shape bounding box Rectangle object */ getBounds(): Bounds; /** * Returns a polygon approximation of this ellipse. * The polygon is cached and only recomputed when the ellipse shape changes. * @param [segments=16] - the number of segments to use for the approximation * @returns a Polygon representing this ellipse */ toPolygon(segments?: number): Polygon; /** * clone this Ellipse * @returns new Ellipse */ clone(): Ellipse; } export declare const ellipsePool: import("../system/pool.ts").Pool; //# sourceMappingURL=ellipse.d.ts.map