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.

TIP
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 exportDescription
AttributesThe Attributes constructor
DesignThe Design constructor
PatternThe Pattern constructor
PointThe Point constructor
PathThe Path constructor
PartThe Part constructor
SnippetThe Snippet constructor
StoreThe Store constructor

Constants

Named exportDescription
cbqcThe cubic Bézier quarter circle constant: 0.55191502449351
hidePresetsPresets you can use to configure your part hide option.
goldenRatioThe golden ratio constant: 1.618034
versionThe version of @freesewing/core
RELATED

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

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

Utilities

Named exportDescription
beamIntersectsCircleSee the beamIntersectsCircle documentation
beamIntersectsCurveSee the beamIntersectsCurve documentation
beamIntersectsXSee the beamIntersectsX documentation
beamIntersectsYSee the beamIntersectsY documentation
beamsIntersectSee the beamsIntersect documentation
BezierA re-export of the bezier-js dependency
capitalizeSee the capitalize documentation
circlesIntersectSee the circlesIntersect documentation
curveEdgeSee the curveEdge documentation
curveIntersectsXSee the curveIntersectsX documentation
curveIntersectsYSee the curveIntersectsY documentation
curvesIntersectSee the curvesIntersect documentation
deg2radSee the deg2rad documentation
generateStackTransformSee the generateStackTransform documentation
getTransformedBoundsSee the getTransformedBounds documentation
lineIntersectsCircleSee the lineIntersectsCircle documentation
lineIntersectsCurveSee the lineIntersectsCurve documentation
linesIntersectSee the linesIntersect documentation
mergeIi18nSee the mergeI18n documentation
mergeOptionsSee the mergeOptions documentation
pctBasedOnSee the pctBasedOn documentation
pointOnBeamSee the pointOnBeam documentation
pointOnCurveSee the pointOnCurve documentation
pointOnLineSee the pointOnLine documentation
rad2degSee the rad2deg documentation
roundSee the round documentation
splitCurveSee the splitCurve documentation
stretchToScaleSee the stretchToScale documentation
unitsSee the units documentation