https://github.com/lizainslie/line.js
A library making line collisions easy
https://github.com/lizainslie/line.js
Last synced: 8 months ago
JSON representation
A library making line collisions easy
- Host: GitHub
- URL: https://github.com/lizainslie/line.js
- Owner: LizAinslie
- License: mit
- Created: 2019-08-21T20:52:49.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-21T01:17:33.000Z (about 6 years ago)
- Last Synced: 2024-12-27T20:33:54.047Z (9 months ago)
- Language: JavaScript
- Size: 16.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Line.js
A library making line collisions easy**Functions**
``Line.newPoint (x, y)``
Returns a new point with the properties of `x` and `y```Line.newLine (x1, y1, x2, y2)``
Returns an object with two points in the properties of `start` and `end```Line.newCircle (x, y, radius)``
Returns an object with its location point under `point` and its radius under `r```Line.newLineFromPoints (point1, point2)``
Returns a line using two points``Line.newCircleFromPoint (point, radius)``
Creates a circle from a point with a radius``Line.getPointDistance (point1, point2)``
Returns the ditance between two points``Line.getLineLength (line)``
Returns the distance of a line``Line.getLineMidpoint (line)``
Returns the point in the middle of a line``Line.getPointAngle (point1, point2)``
Returns the angle in radians between two points``Line.getLineAngle (line)``
Returns the angle in radians of a line``Line.lineLineCollision (line1, line2)``
Returns the point where two lines intersect``Line.pointLineCollision (point, line)``
Returns `true` if the point is on the line, and returns `false` if it is not``Line.pointCircleCollision (point, circle)``
Returns `true` if a point is touching a circle, and returns `false` if it is not``Line.circleCircleCollision (circle1, circle2)``
Returns `true` if a circle is touching another circle, and returns `false` if it is not