documentationfor yFiles for HTML 2.6

CurveFittingLayoutStage

CurveFittingLayoutStage fits a piecewise cubic bezier curve to given arbitrary edge paths.

Inheritance Hierarchy
LayoutStageBase
CurveFittingLayoutStage
Implemented Interfaces

Remarks

Concept

The path of an edge, i.e., its start and end point as well as the intermediate control points, are interpreted as the set of input points. A cubic bezier curve is then fitted to these points.

After the fitting, the points of the processed edges can be interpreted as cubic bezier control points. Each four consecutive points form a bezier curve, where the first and last of the four points represent the start and end of the curve and the second and third point are the control points defining how the curve looks. The second and third point do not necessarily lie on the actual curve.

There are two exceptions to the stated rules:

  • If an input edge only consists of a source and a target point, it will be ignored by this stage.
  • Self-loop edges with only one intermediate control point are also ignored. Note that self-loops with more control points are, however, handled by this stage.

Features

The maximum allowed error for the fitting process can be selected to control how high the precision should be. A high allowed error means that the approximation process has a lot of freedom. Curves are only loosely bound to the original edge path. If this is not desired, e.g., because no new intersection with other graph elements should be introduced, then a rather low error value should be specified. The lower the error value, the larger the number of bend points of an approximated edge will be.

It is possible to define the set of edges that should be processed by this layout stage. Therefore, only paths of a sub-set of edges can be changed. Use a IDataProvider registered with the specified selection key to mark edges which should be part of the considered sub-set.

Default Values of Properties

affectedEdgesDpKeyDEFAULT_AFFECTED_EDGES_DP_KEY
maximumError4.0
straightControlPointRatio0.33

Type Details

yfiles module
layout-core
yfiles-umd modules
All layout modules, view-layout-bridge
Legacy UMD name
yfiles.layout.CurveFittingLayoutStage
The application of CurveFittingLayoutStage is useful if curved edge paths were modeled using a large number of bends which are then connected by straight lines - as, for example, produced by RadialLayout. Applying this stage can drastically reduce the number of necessary bends in such cases.
If more than three consecutive points of an edge path are collinear, the stage always fits a bezier piece configured such that it represents a straight line to the collinear points (without the first and last point of the collinear part).

Constructors

Properties

Methods

Constants