UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

95 lines 2.31 kB
/** * Represents a direction vector+angle * Mainly used inside particle systems for pick a motion direction at spawn * * @author Alex Goldring * @copyright Company Named Limited (c) 2025 */ export class ConicRay { /** * * @param {number} x * @param {number} y * @param {number} z * @param {number} half_angle * @returns {ConicRay} */ static fromScalars(x: number, y: number, z: number, half_angle: number): ConicRay; /** * Must be normalized * @readonly * @type {Vector3} */ readonly direction: Vector3; /** * Half-angle of the cone that is the angle between the center axis and the edge of the cone * * @type {number} In radians */ angle: number; toJSON(): { direction: { x: number; y: number; z: number; }; angle: number; }; fromJSON(json: any): void; /** * * @param {BinaryBuffer} buffer */ toBinaryBuffer(buffer: BinaryBuffer): void; /** * * @param {BinaryBuffer} buffer */ fromBinaryBuffer(buffer: BinaryBuffer): void; /** * * @param {ConicRay} other * @returns {boolean} */ equals(other: ConicRay): boolean; /** * * @param {ConicRay} other * @param {number} [tolerance] * @returns {boolean} */ roughlyEquals(other: ConicRay, tolerance?: number): boolean; /** * * @return {number} */ hash(): number; /** * * @param {ConicRay} other */ copy(other: ConicRay): void; /** * Includes boundary matches * @param {Vector3} v3 * @returns {boolean} */ containsDirectionVector(v3: Vector3): boolean; /** * NOTE: Heavily based on a stackoverflow answer * @see https://stackoverflow.com/questions/38997302/create-random-unit-vector-inside-a-defined-conical-region/39003745#39003745 * @param {function} random * @param {Vector3} result */ sampleRandomDirection(random: Function, result: Vector3): void; /** * @readonly * @type {boolean} */ readonly isConicRay: boolean; } export namespace ConicRay { let typeName: string; } import Vector3 from "./Vector3.js"; //# sourceMappingURL=ConicRay.d.ts.map