dimensional
Version:
Dimensional analysis and unit conversions
39 lines (38 loc) • 1.37 kB
TypeScript
import { Compound } from './compound';
import { Dimension } from './dimension';
import { Prefix } from './prefix';
/**
* Represents a measurable unit.
*/
export declare class Unit extends Compound<Unit> {
private readonly allowPrefix;
/**
* The scale factor of this unit relative to the base unit of this dimension.
*/
private readonly scale;
/**
* The base dimensions of this unit.
*/
readonly dimensions: Dimension;
/**
* Define a new named unit.
* @param LaTeXsymbol The LaTeX code for this unit
* @param base The base dimension or makeup of unit(s)
* @param scale The scale factor of this unit relative to the units in `base`
* @param allowPrefix Whether or not this unit can have a prefix applied
*/
constructor(LaTeXsymbol?: string | Map<Unit, number>, base?: Dimension | Unit, scale?: number, allowPrefix?: boolean);
/**
* Scale this unit by applying a prefix.
* @param prefix The prefix to apply
* @returns A properly scaled unit
*/
prefix(prefix: Prefix): Unit;
/**
* Calculate the conversion factor between this unit and another unit.
* @param other Another unit to convert to
* @returns The conversion factor between this unit and another
*/
to(other: Unit): number;
protected fromMap(factors: Map<Unit, number>): Unit;
}