Giter Club home page Giter Club logo

compare-angle's Introduction

compare-angle

Let A, B, C and D be four points in the plan. Then of the pair of angles ABC and ABD, determine which is larger.

  C
  *      D
   \     *
    \ABC/
     \ / ABD
      *-------------*
      B             A

Example

var compareAngle = require("compare-angle")

var A = [2, 0]
var B = [0, 0]
var C = [-1, 2]
var D = [1, 1]

console.log(compareAngle(A, B, C, D),  compareAngle(A, B, D, C))

Output:

1   -1

Install

npm install compare-angle

API

require("compare-angle")(a, b, c, d)

Compares the angles ABC and ABD to determine which is greater.

  • a, b are the base points of the angle
  • c is the end of the first angle
  • d is the end of the second angle

Returns A number indicating which angle is larger

  • +1 if angle ABC is greater than angle ABD
  • 0 if the angles are equal
  • -1 if angle ABD is greater than angle ABC

Credits

(c) 2014 Mikola Lysenko. MIT License

compare-angle's People

Contributors

mikolalysenko avatar

Watchers

James Drew avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.