math-utils
library add new mathematical functions and constants.
npm i @suns-echoes/math-utils
// Import full library minimized distribution file:
import MathUtils from '@suns-echoes/math-utils';
// Import library from source:
import MathUtils from '@suns-echoes/math-utils/cjs';
// or named:
import { MathUtils } from '@suns-echoes/math-utils/cjs/math-utils';
// Import single util:
import { sagitta } from '@suns-echoes/math-utils/cjs/utils/geometry-2d/calculate/sagitta';
// Import library from source:
import MathUtils from '@suns-echoes/math-utils/esm/index.js';
// or named:
import { MathUtils } from '@suns-echoes/math-utils/esm/math-utils.js';
// Import single util:
import { sagitta } from '@suns-echoes/math-utils/esm/utils/geometry-2d/calculate/sagitta.js';
- ORIGIN_0x0 - Origin of the coordinate system
- FIX_FLOAT - Default and maximum precision of fixFloat method
- isPoint - check if the thing is a Point
- isVector - check if the thing is a Vector
- pointEqualPoint - check if two points have the same coordinates
-
Calculation
- distance - calculate distance from point to origin
- sagitta - calculate sagitta from radius and segment width
- sagittaFromAngle - calculate sagitta from radius and angle
-
Transformation
- reflect - reflect point over origin point
- reflectOverLine - reflect point over line plotted by two points
- reflectX - reflect point x coordinate over origin point
- reflectY - reflect point y coordinate over origin point
- rotate - rotate point around origin point
- scale - scale point x and y coordinates
- scaleX - scales point x coordinate
- scaleY - scales point y coordinate
- translate - translate point coordinates by vector
- translateX - translate point x coordinate by vector
- translateY - translate point y coordinate by vector
- angleBetweenTreePoints - calculate angle between 3 points
- cos - calculate cosine value
- sin - calculate sine value
- tan - calculate tangent value
- versin - versus sine value
- fixFloat - fix float rounding precision error
- setFixFloatPrecision - set precision for fixFloat method
Licensed under MIT
Copyright (c) 2020 Aneta Suns