Math
Functions related to mathematics and algebra operations.
normalizeRect()
Returns an equivalent rectangle with angle in the range [-45, 45] degrees.
function normalizeRect(rect: Rect2d): Rect2d;
normalizeEllipse()
Returns an equivalent ellipse with angle in the range [-45, 45] degrees.
function normalizeEllipse(ellipse: Ellipse2d): Ellipse2d;
normalizeVector()
Returns a new vector with norm equal to 1, with the same direction as the input vector.
function normalizeVector(vector: Vector2d): Vector2d;
addVectors()
Returns the sum of two vectors as a new vector.
function addVectors(vector1: Vector2d, vector2: Vector2d): Vector2d;
addPoints()
Returns the sum of two points as a new point.
function addPoints(point1: Point2d, point2: Point2d): Point2d;
subVectors()
Returns the subtraction of two vectors as a new vector.
function subVectors(vector1: Vector2d, vector2: Vector2d): Vector2d;
subPoints()
Returns the subtraction of two points as a new point.
function subPoints(point1: Point2d, point2: Point2d): Point2d;
dotProduct()
Returns the dot product of two vectors.
function dotProduct(vector1: Vector2d, vector2: Vector2d): number;
crossProduct()
Returns the norm of the cross product of two vectors. The norm is positive if the cross product is in the direction of the z-axis, negative if it is in the opposite direction, and zero if the vectors are parallel or anti-parallel
function crossProduct(vector1: Vector2d, vector2: Vector2d): number;
roundDecimal()
Rounds a floating point number to a given number of decimal places
function roundDecimal(value: number, decimalPlaces: number): number;
roundDecimalPath()
Rounds the coordinates of the every point in the path
function roundDecimalPath(path: Path2d, decimalPlaces: number): void;