starling-framework
Version:
A fast, productive library for 2D cross-platform development.
58 lines • 2.21 kB
TypeScript
import Vector3D from "openfl/geom/Vector3D";
import Point from "openfl/geom/Point";
declare namespace starling.utils {
/**
* A utility class containing methods you might need for math problems.
*/
export class MathUtil {
/**
* Calculates the intersection point between the xy-plane and an infinite line
* * that is defined by two 3D points in the same coordinate system.
*/
static intersectLineWithXYPlane(pointA: Vector3D, pointB: Vector3D, out?: Point): Point;
/**
* Calculates if the point <code>p</code> is inside the triangle <code>a-b-c</code>.
*/
static isPointInTriangle(p: Point, a: Point, b: Point, c: Point): boolean;
/**
* Moves a radian angle into the range [-PI, +PI], while keeping the direction intact.
*/
static normalizeAngle(angle: number): number;
/**
* Returns the next power of two that is equal to or bigger than the specified number.
*/
static getNextPowerOfTwo(number: number): number;
/**
* Indicates if two float (Number) values are equal, give or take <code>epsilon</code>.
*/
static isEquivalent(a: number, b: number, epsilon?: number): boolean;
/**
* Returns the larger of the two values. Different to the native <code>Math.max</code>,
* * this doesn't create any temporary objects when using the AOT compiler.
*/
static max(a: number, b: number): number;
/**
* Returns the smaller of the two values. Different to the native <code>Math.min</code>,
* * this doesn't create any temporary objects when using the AOT compiler.
*/
static min(a: number, b: number): number;
/**
* Moves <code>value</code> into the range between <code>min</code> and <code>max</code>.
*/
static clamp(value: number, min: number, max: number): number;
/**
* Returns the smallest value in an array.
*/
static minValues(values: Array<number>): number;
/**
* Converts an angle from degrees into radians.
*/
static deg2rad(deg: number): number;
/**
* Converts an angle from radians into degrees.
*/
static rad2deg(rad: number): number;
static toFixed(value: number, precision: number): string;
}
}
export default starling.utils.MathUtil;