feat(core): Add cbqc
named export
This exports the constant `0.55342686` which is the value to best approximate a (quarter) circle with a cubic Bézier curve. See: https://spencermortensen.com/articles/bezier-circle/
This commit is contained in:
parent
e808375b60
commit
49618755be
4 changed files with 14 additions and 0 deletions
|
@ -136,6 +136,7 @@
|
|||
#### Added
|
||||
|
||||
- Allow plugins to provide their own packing implementation
|
||||
- Added named export `cbqc` which exports the constant to approximate a circle with Cubic Bézier curves
|
||||
|
||||
#### Fixed
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ Unreleased:
|
|||
Added:
|
||||
core:
|
||||
- Allow plugins to provide their own packing implementation
|
||||
- Added named export `cbqc` which exports the constant to approximate a circle with Cubic Bézier curves
|
||||
plugin-bin-pack:
|
||||
- First release of the plugin providing the default packing implementation
|
||||
plugin-ringsector:
|
||||
|
|
|
@ -15,6 +15,7 @@ import {
|
|||
beamsIntersect,
|
||||
beamIntersectsCurve,
|
||||
capitalize,
|
||||
cbqc,
|
||||
circlesIntersect,
|
||||
curveEdge,
|
||||
curveIntersectsX,
|
||||
|
@ -62,6 +63,7 @@ export {
|
|||
beamsIntersect,
|
||||
beamIntersectsCurve,
|
||||
capitalize,
|
||||
cbqc,
|
||||
circlesIntersect,
|
||||
curveEdge,
|
||||
curveIntersectsX,
|
||||
|
|
|
@ -2,8 +2,18 @@ import { Bezier } from 'bezier-js'
|
|||
import { Path } from './path.mjs'
|
||||
import { Point } from './point.mjs'
|
||||
|
||||
/*
|
||||
* See: https://en.wikipedia.org/wiki/Golden_ratio
|
||||
*/
|
||||
export const goldenRatio = 1.618034
|
||||
|
||||
/*
|
||||
* cbqc = Cubic Bezier Quarter Circle
|
||||
* The value to best approximate a (quarter) circle with cubic Bézier curves
|
||||
* See: https://spencermortensen.com/articles/bezier-circle/
|
||||
*/
|
||||
export const cbqc = 0.55191502449351
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// PUBLIC METHODS //
|
||||
//////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue