ngx-trend
Version:
ngx-trend Angular component
57 lines (56 loc) • 2.32 kB
TypeScript
/** normalize
* This lets us translate a value from one scale to another.
*
* @param value - Our initial value to translate
* @param min - the current minimum value possible
* @param max - the current maximum value possible
* @param scaleMin - the min value of the scale we're translating to
* @param scaleMax - the max value of the scale we're translating to
* @returns the value on its new scale
*/
export declare function normalize(value: number, min: number, max: number, scaleMin?: number, scaleMax?: number): number;
export interface Point {
x: number;
y: number;
}
/** moveTo
* the coordinate that lies at a midpoint between 2 lines, based on the radius
*
* @param to - Our initial point
* @param to.x - The x value of our initial point
* @param to.y - The y value of our initial point
* @param from - Our final point
* @param from.x - The x value of our final point
* @param from.y - The y value of our final point
* @param radius - The distance away from the final point
* @returns an object holding the x/y coordinates of the midpoint.
*/
export declare function moveTo(to: Point, from: Point, radius: number): Point;
/** getDistanceBetween
* Simple formula derived from pythagoras to calculate the distance between
* 2 points on a plane.
*
* @param p1 - Our initial point
* @param p1.x - The x value of our initial point
* @param p1.y - The y value of our initial point
* @param p2 - Our final point
* @param p2.x - The x value of our final point
* @param p2.y - The y value of our final point
* @returns the distance between the points.
*/
export declare const getDistanceBetween: (p1: Point, p2: Point) => number;
/** checkForCollinearPoints
* Figure out if the midpoint fits perfectly on a line between the two others.
*
* @param p1 - Our initial point
* @param p1.x - The x value of our initial point
* @param p1.y - The y value of our initial point
* @param p2 - Our mid-point
* @param p2.x - The x value of our mid-point
* @param p2.y - The y value of our mid-point
* @param p3 - Our final point
* @param p3.x - The x value of our final point
* @param p3.y - The y value of our final point
* @returns whether or not p2 sits on the line between p1 and p3.
*/
export declare const checkForCollinearPoints: (p1: Point, p2: Point, p3: Point) => boolean;