 import UIKit
 
 final class SmoothLine: Line {
+    var velocityFilterWeight: CGFloat = 0.7
+    var minWidth: CGFloat = 0.5
+    var maxWidth: CGFloat = 2.5
+    
     private var points: [Point] = []
     private var end = false
+
+    private var lastVelocity: CGFloat = 0
+    private var lastWidth: CGFloat = (0.5 + 2.5) / 2
 
     func start(context: CGContext, point: Point) {
         guard points.count == 0 else {

        points.removeFirst()
    }

    // Calculate Bezier curve control points for given 3 points
    // implementation references to
    // https://github.com/szimek/signature_pad/blob/master/src/signature_pad.js#L267-L292
    static func calculateCurveControlPoints(s1: CGPoint, s2: CGPoint, s3: CGPoint) -> (CGPoint, CGPoint) {
        let dx1 = s1.x - s2.x

            s3: points[3].position
        ).0

        let widths = calculateCurveWidths(startPoint: points[1], endPoint: points[2])
        // TODO: implement custom Bezier drawing method that supports width changing over time
        context.setLineWidth(widths.1)
        
        context.move(to: points[1].position)
        context.addCurve(to: points[2].position, control1: c2, control2: c3)
        context.strokePath()
