1
0
Fork 0
freesewing/markdown/dev/reference/api/en.md

5.3 KiB

title
Core API

This is the documentation for FreeSewing's core library, published as @freesewing/core on NPM. It's a complete toolbox for parametric design with a primary focus on sewing patterns, but can be utilized for a variety of similar 2D design tasks.

Looking to get started?

You are currently browsing the reference documentation. Please refer to our tutorials to get started.

Core API Documentation

Named exports

In general, software published under the FreeSewing namespaces prefers named exports over default exports, and the @freesewing/core package provides several of them. I have grouped them below in different categories:

Constructors

Named export Description
Attributes The Attributes constructor
Design The Design constructor
Pattern The Pattern constructor
Point The Point constructor
Path The Path constructor
Part The Part constructor
Snippet The Snippet constructor
Store The Store constructor

Constants

Named export Description
cbqc The cubic Bézier quarter circle constant: 0.55191502449351
hidePresets Presets you can use to configure your part hide option.
goldenRatio The golden ratio constant: 1.618034
version The version of @freesewing/core

The cbqc cubic Bézier quarter circle constant is used to draw circles using Bézier curves. An approximate quarter circle curve is:

const quarterCircle = new Path()
  .move(new Point(0, radius))
  .curve(new Point(cbqc, radius),
    new Point(radius, cbqc),
    new Point(radius, 0))

Utilities

Named export Description
beamIntersectsCircle See the beamIntersectsCircle documentation
beamIntersectsCurve See the beamIntersectsCurve documentation
beamIntersectsX See the beamIntersectsX documentation
beamIntersectsY See the beamIntersectsY documentation
beamsIntersect See the beamsIntersect documentation
Bezier A re-export of the bezier-js dependency
capitalize See the capitalize documentation
circlesIntersect See the circlesIntersect documentation
curveEdge See the curveEdge documentation
curveIntersectsX See the curveIntersectsX documentation
curveIntersectsY See the curveIntersectsY documentation
curvesIntersect See the curvesIntersect documentation
deg2rad See the deg2rad documentation
generateStackTransform See the generateStackTransform documentation
getTransformedBounds See the getTransformedBounds documentation
lineIntersectsCircle See the lineIntersectsCircle documentation
lineIntersectsCurve See the lineIntersectsCurve documentation
linesIntersect See the linesIntersect documentation
mergeIi18n See the mergeI18n documentation
mergeOptions See the mergeOptions documentation
pctBasedOn See the pctBasedOn documentation
pointOnBeam See the pointOnBeam documentation
pointOnCurve See the pointOnCurve documentation
pointOnLine See the pointOnLine documentation
rad2deg See the rad2deg documentation
round See the round documentation
splitCurve See the splitCurve documentation
stretchToScale See the stretchToScale documentation
units See the units documentation