MaLiang icon indicating copy to clipboard operation
MaLiang copied to clipboard

Smaller brush is darker than larger brush

Open ulitiy opened this issue 4 years ago • 3 comments

Some significant issue with opacity calculation, blending mode or overlapping? It should be exactly the same color.

related #82

ulitiy avatar Sep 22 '20 02:09 ulitiy

https://www.wolframalpha.com/input/?i=area+of+symmetric+lens

probably this should help with calculating overlaps

ulitiy avatar Sep 22 '20 03:09 ulitiy

        let n = Int(brush!.pointSize / brush!.pointStep)
        let overlapMultiplier = Array(1...n).map { (el: Int) -> CGFloat in
            let d = brush!.pointStep * CGFloat(el) / brush!.pointSize // normalised distance between point centers
            let gendia = sqrt(4.0 - d*d )
            return CGFloat.pi - d/2.0 * gendia - 2.0 * atan(d/gendia)
        }.reduce(0, +)

@Harley-xk I used this code and it seems to provide more consistent result.

ulitiy avatar Sep 25 '20 13:09 ulitiy

Nevermind, my bad, it's pretty much the same.

ulitiy avatar Sep 25 '20 14:09 ulitiy