Getting issue to remove sharp edge/angle while connecting last point with first one while drawing shape using Custom Painter.
I am trying to create custom shape using CustomPainter. I have created Path using some points. And for drawing path, I am using Bezier. My Code is as per below. But when last point connects to first one, it creates sharp angle. How I can avoid it?
// preparing path points for shape.
for (int i = 0; i < steps; i++) {
borderPoints.add(BorderPoint(xPoint, yPoint, radian, randomRadius, MovementDirection.INWARD));
}
borderPoints.add(borderPoints[0]);
// here, we are creating path for our shape.
jellyPath.moveTo(borderPoints[0].dx, borderPoints[0].dy);
int i = 1;
for (i = 1; i < borderPoints.length - 2; i++) {
var xc = (borderPoints[i].dx + borderPoints[i + 1].dx) / 2;
var yc = (borderPoints[i].dy + borderPoints[i + 1].dy) / 2;
jellyPath.quadraticBezierTo(
borderPoints[i].dx, borderPoints[i].dy, xc, yc);
}
jellyPath.quadraticBezierTo(borderPoints[i].dx, borderPoints[i].dy, borderPoints[i + 1].dx, borderPoints[i + 1].dy);
Expecting smooth curve while joining end part in Path.