Skip to main content

Home > @jsplumb/connector-bezier

connector-bezier package#

This package contains the Bezier and StateMachine connectors. Prior to version 5.x these connectors were shipped along with the core.




bezierLineIntersection(x1, y1, x2, y2, curve)Calculates all intersections of the given line with the given curve.
boundingBoxIntersection(boundingBox, curve)Calculates all intersections of the given bounding box with the given curve.
boxIntersection(x, y, w, h, curve)Calculates all intersections of the given box with the given curve.
dist(p1, p2)
distanceFromCurve(point, curve)Calculates the distance that the given point lies from the given Bezier. Note that it is computed relative to the center of the Bezier, so if you have stroked the curve with a wide pen you may wish to take that into account! The distance returned is relative to the values of the curve and the point - it will most likely be pixels.
gradientAtPoint(curve, location)Calculates the gradient at the point on the given curve at the given location
gradientAtPointAlongPathFrom(curve, location, distance)Returns the gradient of the curve at the point which is 'distance' from the given location. if this point is greater than location 1, the gradient at location 1 is returned. if this point is less than location 0, the gradient at location 0 is returned.
locationAlongCurveFrom(curve, location, distance)finds the location that is 'distance' along the path from 'location'.
nearestPointOnCurve(point, curve)Calculates the nearest point to the given point on the given curve. The return value of this is a JS object literal, containing both the point's coordinates and also the 'location' of the point (see above).
perpendicularToPathAt(curve, location, length, distance)calculates a line that is 'length' pixels long, perpendicular to, and centered on, the path at 'distance' pixels from the given location. if distance is not supplied, the perpendicular for the given location is computed (ie. we set distance to zero).
pointAlongCurveFrom(curve, location, distance)finds the point that is 'distance' along the path from 'location'.
pointAlongPath(curve, location, distance)finds the point that is 'distance' along the path from 'location'. this method returns both the x,y location of the point and also its 'location' (proportion of travel along the path); the method below - _pointAlongPathFrom - calls this method and just returns the point.TODO The compute length functionality was made much faster recently, using a lookup table. is it possible to use that lookup table find a value for the point some distance along the curve from somewhere?
pointOnCurve(curve, location)calculates a point on the curve, for a Bezier of arbitrary order.


AbstractBezierOptionsBase options interface for StateMachine and Bezier connectors.
BezierConnectorGeometryThe bezier connector's internal representation of a path.
BezierOptionsOptions for the Bezier connector.

Type Aliases#

Type AliasDescription