What is Chaikin's algorithm?

Chaikin's algorithm is a method used in computer graphics to create smooth curves from a given set of points or a polyline. The algorithm works by making new points on the line which form a smoother curve.

How does it work

Chaikin's algorithm is quite simple and produces the results based on the number of iterations performed.

  • Draw a line to represent the polygon (open or closed) to encapsulate the curve.

  • Generate the new sequence of control points at a ratio of 25%25\%and 75%75\% of the size of the line segment.

The above equations represent the control points on a line segment as shown below.

Control points on a line segment
Control points on a line segment
  • Connect the points so that the second point of a segment connects to the first control point of the next segment.

  • Repeat the process to get a smoother curve.

Matrix form

The matrix representation of Chaikin's algorithm is given below.

  • The above representation shows the new control points (Qi,RiQ_i , R_i) and their respective sizes (34\frac{3}{4} , 14\frac{1}{4} ).

  • The left column matrix represents the new points QiQ_i and RiR_i obtained when the algorithm is applied to the original control points.

  • The matrix on the right side is a constant coefficient matrix used in Chaikin's algorithm. It scales and combines adjacent control points to generate new points on a smoother curve.

  • The matrix is multiplied by 14\frac{1}{4} to scale down the effect of Chaikin's algorithm.

    • It ensures that the new points QiQ_i and RiR_i, generated by applying the algorithm to the original control points, are scaled down by a factor of 14\frac{1}{4}.

    • It helps to control the level of smoothness in the resulting curve.

Note: The smaller the scaling factor, the smoother the curve will be, and vice versa.

Demonstration

Polygon encapsulating the curve
1 of 6

Continue reading

Copyright ©2024 Educative, Inc. All rights reserved