0.1.1 • Published 1 year ago

ml-directional-distribution v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

ml-directional-distribution

NPM version build status Test coverage npm download

Calculate the directional distribution from points.

Installation

$ npm i ml-directional-distribution

Usage

You can call getDirectionalEllipse on two arrays x and y containing the x and y coordinates of the points for which you want to find the directional ellipse. It is also possible to specify the number of standard deviations nbSD. If nbSD is 1, the ellipse will cover about 68% of the points, if nbSD is 2, the ellipse will cover about 95% of the points and if nbSD is 3, the ellipse will cover about 99% of the points.

The return type contains the following data:

  • rMajor is the radius of the major axis
  • rMinor is the radius of the minor axis
  • (position.x, position.y) are the coordinates of the center of the ellipse
  • majorAxis.point1 and majorAxis.point2 are the coordinates of the extremities of the major axis
  • minorAxis.point1 and minorAxis.point2 are the coordinates of the extremities of the minor axis
import { getDirectionalEllipse } from 'ml-directional-distribution';

let { rMajor, rMinor, position, majorAxis, minorAxis } = getDirectionalEllipse(
  {
    x: [1, 2, 3, 4, 5, 6],
    y: [1, 4, 2, 5, 3, 6],
  },
  { nbSD: 3 },
);

License

MIT