Twinside / Rasterific

A drawing engine in Haskell
BSD 3-Clause "New" or "Revised" License
140 stars 11 forks source link

Cubic bezier renders incorrectly when control points 1 & 2 are equal #17

Closed jeffreyrosenbluth closed 9 years ago

jeffreyrosenbluth commented 9 years ago
module Main where

import Codec.Picture (PixelRGBA8 (..), writePng)
import Graphics.Rasterific
import Graphics.Rasterific.Texture

main :: IO ()
main = do
  let white = PixelRGBA8 255 255 255 255
      drawColor = PixelRGBA8 0 0x86 0xc1 255
      recColor = PixelRGBA8 0xFF 0x53 0x73 255
      img = renderDrawing 400 200 white $
        withTexture (uniformTexture drawColor) $ do
          stroke 4 JoinRound (CapRound, CapRound) $
            [CubicBezierPrim $ CubicBezier (V2 10 10) (V2 210 210)
            --- XXX Compare with replacing 210.1 with 210 below.
            (V2 210 210.1) (V2 10 410)]

  writePng "bezier.png" img

There should be no perceptible difference between the following 2 curves. 210.1 image 210 image

Twinside commented 9 years ago

What was I thinking

Context Context2

I'll fix it tomorrow

jeffreyrosenbluth commented 9 years ago

thanks

On Tue, Oct 14, 2014 at 3:35 PM, Vincent notifications@github.com wrote:

What was I thinking https://github.com/Twinside/Rasterific/blob/477c8bdc3075d6a87ef45c96662f9216af807a8d/src/Graphics/Rasterific/CubicBezier.hs#L343

I'll fix it tomorrow

— Reply to this email directly or view it on GitHub https://github.com/Twinside/Rasterific/issues/17#issuecomment-59103164.

Twinside commented 9 years ago

Fixed in last commit