{"_id":"cubic2quad","_rev":"2864789","name":"cubic2quad","description":"Approximate cubic Bezier curve with a number of quadratic ones","dist-tags":{"latest":"1.2.1"},"maintainers":[{"name":"vitaly","email":"vitaly@rcdesign.ru"}],"time":{"modified":"2022-09-14T03:08:35.000Z","created":"2015-10-27T18:53:46.076Z","1.2.1":"2021-05-20T17:34:19.143Z","1.2.0":"2021-05-19T15:44:42.523Z","1.1.1":"2017-05-08T10:01:10.266Z","1.1.0":"2016-10-26T16:35:59.715Z","1.0.0":"2015-10-27T18:53:46.076Z"},"users":{},"repository":{"type":"git","url":"git+https://github.com/fontello/cubic2quad.git"},"versions":{"1.2.1":{"name":"cubic2quad","version":"1.2.1","description":"Approximate cubic Bezier curve with a number of quadratic ones","keywords":["cubic","quad","bezier"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fontello/cubic2quad.git"},"scripts":{"lint":"standardx -v .","benchmark":"npm run lint && ./benchmark/benchmark.js","test":"npm run lint && nyc mocha","covreport":"nyc report --reporter html && nyc report --reporter lcov"},"devDependencies":{"ansi":"^0.3.1","benchmark":"^2.1.4","mocha":"^8.4.0","nyc":"^15.1.0","standardx":"^7.0.0"},"gitHead":"828cff43e0ba6171eac049e94acaa85a0fa1c23c","bugs":{"url":"https://github.com/fontello/cubic2quad/issues"},"homepage":"https://github.com/fontello/cubic2quad#readme","_id":"cubic2quad@1.2.1","_nodeVersion":"14.16.1","_npmVersion":"6.14.12","dist":{"shasum":"2442260b72c02ee4b6a2fe998fcc1c4073622286","size":7644,"noattachment":false,"key":"/cubic2quad/-/cubic2quad-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/cubic2quad/download/cubic2quad-1.2.1.tgz"},"_npmUser":{"name":"vitaly","email":"vitaly@rcdesign.ru"},"directories":{},"maintainers":[{"name":"vitaly","email":"vitaly@rcdesign.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cubic2quad_1.2.1_1621532058919_0.0028648226939724797"},"_hasShrinkwrap":false,"publish_time":1621532059143,"_cnpm_publish_time":1621532059143,"_cnpmcore_publish_time":"2021-12-16T21:11:11.020Z"},"1.2.0":{"name":"cubic2quad","version":"1.2.0","description":"Approximate cubic Bezier curve with a number of quadratic ones","keywords":["cubic","quad","bezier"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fontello/cubic2quad.git"},"scripts":{"lint":"eslint .","benchmark":"npm run lint && ./benchmark/benchmark.js","test":"npm run lint && mocha","coverage":"rm -rf coverage && istanbul cover _mocha","report-coveralls":"istanbul cover _mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage"},"devDependencies":{"ansi":"*","benchmark":"*","coveralls":"~2.11.2","eslint":"^3.8.1","istanbul":"^0.4.5","mocha":"^3.1.2"},"gitHead":"0dd53740504f65e6f15ccce85a256ea4b4186725","bugs":{"url":"https://github.com/fontello/cubic2quad/issues"},"homepage":"https://github.com/fontello/cubic2quad#readme","_id":"cubic2quad@1.2.0","_nodeVersion":"14.16.1","_npmVersion":"6.14.12","dist":{"shasum":"170861c650982caf1dcffffa05232e3fa93c4584","size":7497,"noattachment":false,"key":"/cubic2quad/-/cubic2quad-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/cubic2quad/download/cubic2quad-1.2.0.tgz"},"_npmUser":{"name":"vitaly","email":"vitaly@rcdesign.ru"},"directories":{},"maintainers":[{"name":"vitaly","email":"vitaly@rcdesign.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cubic2quad_1.2.0_1621439082405_0.046189294536881365"},"_hasShrinkwrap":false,"publish_time":1621439082523,"_cnpm_publish_time":1621439082523,"_cnpmcore_publish_time":"2021-12-16T21:11:11.209Z"},"1.1.1":{"name":"cubic2quad","version":"1.1.1","description":"Approximate cubic Bezier curve with a number of quadratic ones","keywords":["cubic","quad","bezier"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fontello/cubic2quad.git"},"scripts":{"lint":"eslint .","benchmark":"npm run lint && ./benchmark/benchmark.js","test":"npm run lint && mocha","coverage":"rm -rf coverage && istanbul cover _mocha","report-coveralls":"istanbul cover _mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage"},"files":["index.js","lib/"],"devDependencies":{"ansi":"*","benchmark":"*","coveralls":"~2.11.2","eslint":"^3.8.1","istanbul":"^0.4.5","mocha":"^3.1.2"},"gitHead":"7f3f6b6fd36231084561fb9825a14458a8cdd67c","bugs":{"url":"https://github.com/fontello/cubic2quad/issues"},"homepage":"https://github.com/fontello/cubic2quad#readme","_id":"cubic2quad@1.1.1","_shasum":"69b19c61a3f5b41ecf2f1d5fae8fb03415aa8b15","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.8.0","_npmUser":{"name":"vitaly","email":"vitaly@rcdesign.ru"},"maintainers":[{"name":"vitaly","email":"vitaly@rcdesign.ru"}],"dist":{"shasum":"69b19c61a3f5b41ecf2f1d5fae8fb03415aa8b15","size":6499,"noattachment":false,"key":"/cubic2quad/-/cubic2quad-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/cubic2quad/download/cubic2quad-1.1.1.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/cubic2quad-1.1.1.tgz_1494237668482_0.27662964700721204"},"directories":{},"publish_time":1494237670266,"_hasShrinkwrap":false,"_cnpm_publish_time":1494237670266,"_cnpmcore_publish_time":"2021-12-16T21:11:11.409Z"},"1.1.0":{"name":"cubic2quad","version":"1.1.0","description":"Approximate cubic Bezier curve with a number of quadratic ones","keywords":["cubic","quad","bezier"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fontello/cubic2quad.git"},"scripts":{"lint":"eslint .","benchmark":"npm run lint && ./benchmark/benchmark.js","test":"npm run lint && mocha","coverage":"rm -rf coverage && istanbul cover _mocha","report-coveralls":"istanbul cover _mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage"},"files":["index.js","lib/"],"devDependencies":{"ansi":"*","benchmark":"*","coveralls":"~2.11.2","eslint":"^3.8.1","istanbul":"^0.4.5","mocha":"^3.1.2"},"gitHead":"8ed61586cd9f541338312f9c271a6d5358bfa426","bugs":{"url":"https://github.com/fontello/cubic2quad/issues"},"homepage":"https://github.com/fontello/cubic2quad#readme","_id":"cubic2quad@1.1.0","_shasum":"78abec71b1b0244fdca863910ced8e07446a90e7","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.8.1","_npmUser":{"name":"vitaly","email":"vitaly@rcdesign.ru"},"maintainers":[{"name":"vitaly","email":"vitaly@rcdesign.ru"}],"dist":{"shasum":"78abec71b1b0244fdca863910ced8e07446a90e7","size":6444,"noattachment":false,"key":"/cubic2quad/-/cubic2quad-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/cubic2quad/download/cubic2quad-1.1.0.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/cubic2quad-1.1.0.tgz_1477499757891_0.630244127009064"},"directories":{},"publish_time":1477499759715,"_hasShrinkwrap":false,"_cnpm_publish_time":1477499759715,"_cnpmcore_publish_time":"2021-12-16T21:11:11.622Z"},"1.0.0":{"name":"cubic2quad","version":"1.0.0","description":"Approximate cubic Bezier curve with a number of quadratic ones","keywords":["cubic","quad","bezier"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fontello/cubic2quad.git"},"scripts":{"test":"make test"},"files":["index.js","lib/"],"devDependencies":{"ansi":"*","benchmark":"*","coveralls":"~2.11.2","eslint":"0.19.0","eslint-plugin-nodeca":"~1.0.3","istanbul":"*","mocha":"*"},"gitHead":"317f8d4e80fadcd72dc0525f016e988a7dc3443a","bugs":{"url":"https://github.com/fontello/cubic2quad/issues"},"homepage":"https://github.com/fontello/cubic2quad#readme","_id":"cubic2quad@1.0.0","_shasum":"c9bdfac62bad1b807547897ca6d1998ca29199d4","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.1","_npmUser":{"name":"vitaly","email":"vitaly@rcdesign.ru"},"maintainers":[{"name":"vitaly","email":"vitaly@rcdesign.ru"}],"dist":{"shasum":"c9bdfac62bad1b807547897ca6d1998ca29199d4","size":5567,"noattachment":false,"key":"/cubic2quad/-/cubic2quad-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/cubic2quad/download/cubic2quad-1.0.0.tgz"},"directories":{},"publish_time":1445972026076,"_hasShrinkwrap":false,"_cnpm_publish_time":1445972026076,"_cnpmcore_publish_time":"2021-12-16T21:11:11.815Z"}},"readme":"cubic2quad\n==========\n\n[![CI](https://github.com/fontello/cubic2quad/actions/workflows/ci.yml/badge.svg)](https://github.com/fontello/cubic2quad/actions/workflows/ci.yml)\n[![NPM version](https://img.shields.io/npm/v/cubic2quad.svg?style=flat)](https://www.npmjs.org/package/cubic2quad)\n[![Coverage Status](https://img.shields.io/coveralls/fontello/cubic2quad/master.svg?style=flat)](https://coveralls.io/r/fontello/cubic2quad?branch=master)\n\n> Aproximates cubic Bezier curves with quadratic ones.\n\nThis package was done to create TTF fonts (those support quadratic curves only).\nGenerated curves have the same tangents angles at the ends. That's important to\nkeep result visually smooth.\n\n\nAlgorithm\n---------\n\nLogic is similar to one from [FontForge](https://fontforge.github.io/bezier.html).\n\nSteps:\n\n1. Split quadratic curve into _k_ segments (from 2 at start, to 8 max).\n2. Approximate each segment with tangents intersection approach (see\n   [picture](http://www.timotheegroleau.com/Flash/articles/cubic_bezier/quadratic_on_cubic_1.gif) in [article](http://www.timotheegroleau.com/Flash/articles/cubic_bezier_in_flash.htm)).\n3. Measure approximation error and increase splits count if needed (and max not reached).\n   - set 10 points on each interval & calculate minimal distance to created\n     quadratic curve.\n\nUsage\n-----\n\n```js\nvar cubic2quad = require('cubic2quad');\n// Input: (px1, py1, cx1, cy1, cx2, cy2, px2, py2, precision)\nvar quads = cubic2quad(0, 0, 10, 9, 20, 11, 30, 0, 0.1);\n```\n\nIt converts given quadratic curve to a number of quadratic ones. Result is:\n\n    [ P1x, P1y, C1x, C1y, P2x, P2y, C2x, C2y, ..., Cnx, Cny, P{n+1}x, P{n+1}y ]\n\nwhere _Pi_ are base points and _Ci_ are control points.\n\n\nAuthors\n-------\n\n- Alexander Rodin - [@a-rodin](https://github.com/a-rodin)\n- Vitaly Puzrin - [@puzrin](https://github.com/puzrin)\n\n\nLicense\n-------\n\n[MIT](https://github.com/fontello/cubic2quad/blob/master/LICENSE)\n","_attachments":{},"homepage":"https://github.com/fontello/cubic2quad#readme","bugs":{"url":"https://github.com/fontello/cubic2quad/issues"},"license":"MIT"}