1.0.0 • Published 6 years ago

arc-points v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Generate arcs routes as lines that does not coincide between to points.

Install

npm

npm i arc-points -S

or yarn

yarn add arc-points

Usage

Require the library in node.js like:

var arc = require('arc-points');
arc.arcPoints.methodName()

Use in the browser like:

<script src="./arc-points.js"></script>
arc.arcPoints.methodName()

ES2015:

import { arcPoints } from '../lib/arc-points'
arcPoints.methodName()

API

Methods:

  • generateBezierPoints(start, end, npoints, options) => array

    Generate arcs routes as lines that does not coincide between to points.

    • start: Start point like x, y. Note: x and y are both numbers. If in a map, x denotes a longitude, y denotes a latitude.
    • end: End point. The format is like start.
    • npoints: The number of points to be generated.
    • options: An object with three properties of cph,cpv,direction.
    • options.cph: Horizontal position ratio of control point. Default: 0.5
    • options.cpv: Vertical position ratio of control point. Default: 0.2
    • options.direction: The location of the generated arc with respect to the two-point connection. It could be up, down or ring. ring indicates that the generated arc direction is clockwise. Default: up
  • filterCoordinates

  • getTheSameTrailVectorTimes
  • getCphvFromIdenticTrailVectorTimes

Example

You can download it and

cd example
yarn
yarn start
1.0.0

6 years ago