Skip to main content

Sketcher

The FaceSketcher allows you to sketch on a plane.

Implements

Constructors

constructor

new Sketcher(plane)

The sketcher can be defined by a plane, or a simple plane definition, with either a point of origin, or the position on the normal axis from the coordinates origin

Parameters

NameType
planePlane

Defined in

Sketcher.ts:42

new Sketcher(plane?, origin?)

Parameters

NameType
plane?PlaneName
origin?number | Point

Defined in

Sketcher.ts:43

Methods

bezierCurveTo

bezierCurveTo(end, controlPoints): Sketcher

Draws a generic bezier curve to the end point, going using a set of control points.

This is the generic definition of a bézier curve, you might want to use either the quadratic or cubic (most common) version, unless you know exactly what you are aiming at.

Parameters

NameType
endPoint2D
controlPointsPoint2D | Point2D[]

Returns

Sketcher

Implementation of

GenericSketcher.bezierCurveTo

Defined in

Sketcher.ts:343


bulgeArc

bulgeArc(xDist, yDist, bulge): Sketcher

Draws an arc of circle by defining its end point and the bulge - the maximum distance between the arc and the straight line going from start to end point in units of half the chord. The end point is defined by its horizontal and vertical distances from the start point.

Parameters

NameType
xDistnumber
yDistnumber
bulgenumber

Returns

Sketcher

Implementation of

GenericSketcher.bulgeArc

Defined in

Sketcher.ts:217


bulgeArcTo

bulgeArcTo(end, bulge): Sketcher

Draws an arc of circle by defining its end point and the bulge - the maximum distance between the arc and the straight line going from start to end point.

Parameters

NameType
endPoint2D
bulgenumber

Returns

Sketcher

Implementation of

GenericSketcher.bulgeArcTo

Defined in

Sketcher.ts:208


close

close(): Sketch

Stop drawing, make sure the sketch is closed (by adding a straight line to from the last point to the first) and returns the sketch.

Returns

Sketch

Implementation of

GenericSketcher.close

Defined in

Sketcher.ts:483


closeWithMirror

closeWithMirror(): Sketch

Stop drawing, make sure the sketch is closed (by mirroring the lines between the first and last points drawn) and returns the sketch.

Returns

Sketch

Implementation of

GenericSketcher.closeWithMirror

Defined in

Sketcher.ts:488


cubicBezierCurveTo

cubicBezierCurveTo(end, startControlPoint, endControlPoint): Sketcher

Draws a cubic bezier curve to the end point, using the start and end control point to define its shape. This corresponds to the most commonly used bezier curve.

If you are struggling setting your control points, the smoothSpline might be better for your needs.

Parameters

NameType
endPoint2D
startControlPointPoint2D
endControlPointPoint2D

Returns

Sketcher

Implementation of

GenericSketcher.cubicBezierCurveTo

Defined in

Sketcher.ts:366


delete

delete(): void

Returns

void

Defined in

Sketcher.ts:55


done

done(): Sketch

Stop drawing and returns the sketch.

Returns

Sketch

Implementation of

GenericSketcher.done

Defined in

Sketcher.ts:475


ellipse

ellipse(xDist, yDist, horizontalRadius, verticalRadius, rotation?, longAxis?, sweep?): Sketcher

Draws an arc of ellipse by defining its end point and an ellipse. The end point is defined by distances from he start point.

The shape of the ellipse is defined by both its radiuses, its angle relative to the current coordinat system, as well as the long and sweep flags (as defined for SVG paths)

Parameters

NameTypeDefault value
xDistnumberundefined
yDistnumberundefined
horizontalRadiusnumberundefined
verticalRadiusnumberundefined
rotationnumber0
longAxisbooleanfalse
sweepbooleanfalse

Returns

Sketcher

Implementation of

GenericSketcher.ellipse

Defined in

Sketcher.ts:292


ellipseTo

ellipseTo(end, horizontalRadius, verticalRadius, rotation?, longAxis?, sweep?): Sketcher

Draws an arc of ellipse by defining its end point and an ellipse.

The shape of the ellipse is defined by both its radiuses, its angle relative to the current coordinat system, as well as the long and sweep flags (as defined for SVG paths)

Parameters

NameTypeDefault value
endPoint2Dundefined
horizontalRadiusnumberundefined
verticalRadiusnumberundefined
rotationnumber0
longAxisbooleanfalse
sweepbooleanfalse

Returns

Sketcher

Implementation of

GenericSketcher.ellipseTo

Defined in

Sketcher.ts:230


hBulgeArc

hBulgeArc(distance, bulge): Sketcher

Draws an horizontal arc of circle by defining its end point and the bulge

  • the maximum distance between the arc and the straight line going from start to end point in units of half the chord. The end point is defined by its horizontal distance from the start point.

Parameters

NameType
distancenumber
bulgenumber

Returns

Sketcher

Implementation of

GenericSketcher.hBulgeArc

Defined in

Sketcher.ts:226


hLine

hLine(distance): Sketcher

Draws an horizontal line of length distance from the current point

Parameters

NameType
distancenumber

Returns

Sketcher

Implementation of

GenericSketcher.hLine

Defined in

Sketcher.ts:89


hLineTo

hLineTo(xPos): Sketcher

Draws an horizontal line to the x coordinate

Parameters

NameType
xPosnumber

Returns

Sketcher

Implementation of

GenericSketcher.hLineTo

Defined in

Sketcher.ts:98


hSagittaArc

hSagittaArc(distance, sagitta): Sketcher

Draws an horizontal arc of circle by defining its end point and the sagitta - the maximum distance between the arc and the straight line going from start to end point.The end point is defined by its horizontal distance from the start point.

Parameters

NameType
distancenumber
sagittanumber

Returns

Sketcher

Implementation of

GenericSketcher.hSagittaArc

Defined in

Sketcher.ts:204


halfEllipse

halfEllipse(xDist, yDist, verticalRadius, sweep?): Sketcher

Draws an arc as half an ellipse, defined by the sagitta of the ellipse (which corresponds to the radius in the axe orthogonal to the straight line).The end point is defined by distances from he start point.

The sweep flag is to be understood as defined for SVG paths.

Parameters

NameTypeDefault value
xDistnumberundefined
yDistnumberundefined
verticalRadiusnumberundefined
sweepbooleanfalse

Returns

Sketcher

Implementation of

GenericSketcher.halfEllipse

Defined in

Sketcher.ts:329


halfEllipseTo

halfEllipseTo(end, verticalRadius, sweep?): Sketcher

Draws an arc as half an ellipse, defined by the sagitta of the ellipse (which corresponds to the radius in the axe orthogonal to the straight line).

The sweep flag is to be understood as defined for SVG paths.

Parameters

NameTypeDefault value
endPoint2Dundefined
verticalRadiusnumberundefined
sweepbooleanfalse

Returns

Sketcher

Implementation of

GenericSketcher.halfEllipseTo

Defined in

Sketcher.ts:312


line

line(xDist, yDist): Sketcher

Draws a line at the horizontal distance xDist and the vertical distance yDist of the current point

Parameters

NameType
xDistnumber
yDistnumber

Returns

Sketcher

Implementation of

GenericSketcher.line

Defined in

Sketcher.ts:80


lineTo

lineTo(«destructured»): Sketcher

Draws a line from the current point to the point given in argument

Parameters

NameType
«destructured»Point2D

Returns

Sketcher

Implementation of

GenericSketcher.lineTo

Defined in

Sketcher.ts:73


movePointerTo

movePointerTo(«destructured»): Sketcher

Changes the point to start your drawing from

Parameters

NameType
«destructured»Point2D

Returns

Sketcher

Implementation of

GenericSketcher.movePointerTo

Defined in

Sketcher.ts:63


polarLine

polarLine(distance, angle): Sketcher

Draws a line from the current point to the point defined in polar coordiates, of radius r and angle theta (in degrees) from the current point

Parameters

NameType
distancenumber
anglenumber

Returns

Sketcher

Implementation of

GenericSketcher.polarLine

Defined in

Sketcher.ts:103


polarLineTo

polarLineTo(«destructured»): Sketcher

Draws a line from the current point to the point defined in polar coordiates, of radius r and angle theta (in degrees) from the origin

Parameters

NameType
«destructured»[number, number]

Returns

Sketcher

Implementation of

GenericSketcher.polarLineTo

Defined in

Sketcher.ts:109


quadraticBezierCurveTo

quadraticBezierCurveTo(end, controlPoint): Sketcher

Draws a quadratic bezier curve to the end point, using the single control point.

Parameters

NameType
endPoint2D
controlPointPoint2D

Returns

Sketcher

Implementation of

GenericSketcher.quadraticBezierCurveTo

Defined in

Sketcher.ts:362


sagittaArc

sagittaArc(xDist, yDist, sagitta): Sketcher

Draws an arc of circle by defining its end point and the sagitta - the maximum distance between the arc and the straight line going from start to end point.The end point is defined by its horizontal and vertical distances from the start point.

Parameters

NameType
xDistnumber
yDistnumber
sagittanumber

Returns

Sketcher

Implementation of

GenericSketcher.sagittaArc

Defined in

Sketcher.ts:195


sagittaArcTo

sagittaArcTo(end, sagitta): Sketcher

Draws an arc of circle by defining its end point and the sagitta - the maximum distance between the arc and the straight line going from start to end point.

Parameters

NameType
endPoint2D
sagittanumber

Returns

Sketcher

Implementation of

GenericSketcher.sagittaArcTo

Defined in

Sketcher.ts:175


smoothSpline

smoothSpline(xDist, yDist, splineConfig?): Sketcher

Draws a cubic bezier curve to the end point, attempting to make the line smooth with the previous segment. The end point is defined by its distance to the first point.

It will base its first control point so that its tangent is the same than the previous segment. You can force another tangent by defining startTangent.

You can configure the tangent of the end point by configuring the endTangent, either as "symmetric" to reproduce the start angle, as an angle from the X axis (in the coordinate system) or a 2d direction (still in the coordinate system.

The start- and end- factors decide on how far the control point is from the start and end point. At a factor of 1, the distance corresponds to a quarter of the straight line distance.

Parameters

NameType
xDistnumber
yDistnumber
splineConfigSplineConfig

Returns

Sketcher

Implementation of

GenericSketcher.smoothSpline

Defined in

Sketcher.ts:432


smoothSplineTo

smoothSplineTo(end, config?): Sketcher

Draws a cubic bezier curve to the end point, attempting to make the line smooth with the previous segment.

It will base its first control point so that its tangent is the same than the previous segment.

The control point relative to the end is by default set to be in the direction of the straight line between start and end. You can specifiy the endSkew either as an angle (in degrees) to this direction, or as an absolute direction in the coordinate system (a Point).

The start- and end- factors decide on how far the control point is from the start and end point. At a factor of 1, the distance corresponds to a quarter of the straight line distance.

Parameters

NameType
endPoint2D
config?SplineConfig

Returns

Sketcher

Implementation of

GenericSketcher.smoothSplineTo

Defined in

Sketcher.ts:374


tangentArc

tangentArc(xDist, yDist): Sketcher

Draws an arc of circle from the current point as a tangent to the previous part of curve drawn.The end point is defined by its horizontal and vertical distances from the start point.

Parameters

NameType
xDistnumber
yDistnumber

Returns

Sketcher

Implementation of

GenericSketcher.tangentArc

Defined in

Sketcher.ts:170


tangentArcTo

tangentArcTo(end): Sketcher

Draws an arc of circle from the current point as a tangent to the previous part of curve drawn.

Parameters

NameType
endPoint2D

Returns

Sketcher

Implementation of

GenericSketcher.tangentArcTo

Defined in

Sketcher.ts:158


tangentLine

tangentLine(distance): Sketcher

Draws a line from the current point as a tangent to the previous part of curve drawn. The distance defines how long the line will be.

Parameters

NameType
distancenumber

Returns

Sketcher

Implementation of

GenericSketcher.tangentLine

Defined in

Sketcher.ts:115


threePointsArc

threePointsArc(xDist, yDist, viaXDist, viaYDist): Sketcher

Draws an arc of circle by defining its end point and a third point through which the arc will pass. Both poinats are defined in horizontal (x) and vertical (y) distances from the start point.

Parameters

NameType
xDistnumber
yDistnumber
viaXDistnumber
viaYDistnumber

Returns

Sketcher

Implementation of

GenericSketcher.threePointsArc

Defined in

Sketcher.ts:145


threePointsArcTo

threePointsArcTo(end, innerPoint): Sketcher

Draws an arc of circle by defining its end point and a third point through which the arc will pass.

Parameters

NameType
endPoint2D
innerPointPoint2D

Returns

Sketcher

Implementation of

GenericSketcher.threePointsArcTo

Defined in

Sketcher.ts:135


vBulgeArc

vBulgeArc(distance, bulge): Sketcher

Draws a vertical arc of circle by defining its end point and the bulge

  • the maximum distance between the arc and the straight line going from start to end point in units of half the chord. The end point is defined by its vertical distance from the start point.

Parameters

NameType
distancenumber
bulgenumber

Returns

Sketcher

Implementation of

GenericSketcher.vBulgeArc

Defined in

Sketcher.ts:222


vLine

vLine(distance): Sketcher

Draws a vertical line of length distance from the current point

Parameters

NameType
distancenumber

Returns

Sketcher

Implementation of

GenericSketcher.vLine

Defined in

Sketcher.ts:85


vLineTo

vLineTo(yPos): Sketcher

Draws a vertical line to the y coordinate

Parameters

NameType
yPosnumber

Returns

Sketcher

Implementation of

GenericSketcher.vLineTo

Defined in

Sketcher.ts:93


vSagittaArc

vSagittaArc(distance, sagitta): Sketcher

Draws a vertical arc of circle by defining its end point and the sagitta

  • the maximum distance between the arc and the straight line going from start to end point.The end point is defined by its vertical distance from the start point.

Parameters

NameType
distancenumber
sagittanumber

Returns

Sketcher

Implementation of

GenericSketcher.vSagittaArc

Defined in

Sketcher.ts:200