{"id":22917411,"url":"https://github.com/mrfarhadir/equationjs","last_synced_at":"2025-04-01T12:45:54.864Z","repository":{"id":57226506,"uuid":"178139024","full_name":"mrfarhadir/equationjs","owner":"mrfarhadir","description":"line equations methods","archived":false,"fork":false,"pushed_at":"2019-04-16T05:12:22.000Z","size":75,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-08T23:18:18.609Z","etag":null,"topics":["algebra","equation","line"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrfarhadir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-28T06:19:35.000Z","updated_at":"2019-04-16T05:12:24.000Z","dependencies_parsed_at":"2022-08-24T11:00:58.528Z","dependency_job_id":null,"html_url":"https://github.com/mrfarhadir/equationjs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrfarhadir%2Fequationjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrfarhadir%2Fequationjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrfarhadir%2Fequationjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrfarhadir%2Fequationjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrfarhadir","download_url":"https://codeload.github.com/mrfarhadir/equationjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246642345,"owners_count":20810583,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algebra","equation","line"],"created_at":"2024-12-14T06:17:51.200Z","updated_at":"2025-04-01T12:45:54.849Z","avatar_url":"https://github.com/mrfarhadir.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Equation\n\nPackage includes equations of:\n[Line](#line)\n\n### Installation:\n```\nnpm install equationjs --save\n```\n### Test:\n```\nnpm run test\n```\n# Line\n\n$$\n y=mx+b \n$$\n#### Methods:\n- **`crossTwoPoint`**\n\u003e This method creates line equation which is crossing from two point that is given as two parameter for function.\n\n**Example:**\n```javascript\n\tlet Line = require('equationjs').Line\n    let line = new Line()\n    let A = {x: 0, y: 0}\n    let B = {x: 2, y: 2}\n    let  y  =  line.crossTwoPoint(A, B)\n    console.log(line) // Line { m: 3, b: -2 }\n    console.log(y(5)) // 5\n```\n- **`distanceFromPoint`**\n\u003e This method calculates created line distance from a given point.\n\u003e this function also has a static version that takes point, m and b\n\n**Example:**\n```javascript\n\t//we could created line in different methods\n\t//here we create line from two point and then calculate line distance from point C\n\tlet Line = require('equationjs').Line\n    let line = new Line()\n    let A = {x: 0, y: 0}\n    let B = {x: 2, y: 2}\n    let C = {x: 16, y: 4}\n    line.crossTwoPoint(A, B)\n    let d = line.distanceFromPoint(C)\n    console.log(d) // 6\n```\n**Example:**\n```javascript\n\t//here we create line from with known m and b and then calculate line distance from point C\n\tlet Line = require('equationjs').Line\n    let line = new Line()\n    line.create(1, 0)\n    let C = {x: 16, y: 4}\n    let d = line.distanceFromPoint(C)\n    console.log(d) // 6\n```\n- **`angle`**\n```static method```\n\u003e This method takes two created instance of line class and returns angle between them in degree\n\n**Example:**\n```javascript\n\tlet Line = require('equationjs').Line\n    let  line1  =  new  Line()\n\tline1.create(1, 0)\n\tlet  line2  =  new  Line()\n\tline2.create(-1, 0)\n\tlet t = Line.angle(line1, line2)\n\tconsole.log(t) //90\n```\n- **`twoLineDistance`**\n```static method```\n\u003e This method takes two created instance of line class and returns distance between them\n\n**Example:**\n```javascript\n\tlet Line = require('equationjs').Line\n\tlet  line1  =  new  Line()\n\tline1.create(4, -3)\n\tlet  line2  =  new  Line()\n\tline2.create(4, 10)\n\tlet  d  =  Line.twoLineDistance(line1, line2)\n\tconsole.log(d) //4.913538149119954\n```\n- **`neighbors`**\n\u003e This method takes array of points around line and calculates their distance from line and average of all neighbors\n\n**Example:**\n```javascript\n\tlet Line = require('equationjs').Line\n\tlet  line  =  new  Line()\n\tline.create(4, -3)\n\tlet  points  = [\n\t\t{x:  1, y:  3},\n\t\t{x:  4, y:  -2},\n\t\t{x:  -3, y:  0},\n\t\t{x:  3, y:  1},\n\t\t{x:  6, y:  6},\n\t]\n\tlet  result  =  line.neighboors(points)\n\tconsole.log(result)\n\t/*\n\t{  \n\t\tlist:[  \n\t\t\t\t-0.7559289460184544,  \n\t\t\t\t5.669467095138408,  \n\t\t\t\t-5.669467095138408,  \n\t\t\t\t3.0237157840738176,  \n\t\t\t\t5.669467095138408  \n\t\t\t],  \n\t\tsum: 7.937253933193771,  \n\t\taverage: 1.5874507866387542  \n\t}\n\t*/\n```\n### road map for classes:\n - [x] Line\n - [ ] Quadratic\n - [ ] Polynomial\n\n\nany question ?\n[Ask It :)](http://mrfarhad.ir/#!/contact)\n\nmade with :heart: for you","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrfarhadir%2Fequationjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrfarhadir%2Fequationjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrfarhadir%2Fequationjs/lists"}