Twinside / Rasterific

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

Possible bug in dashedStroke #4

Closed jeffreyrosenbluth closed 10 years ago

jeffreyrosenbluth commented 10 years ago

In the following image the straight line coming out of the top does not belong there. It seems like a numerical instability since it does not occur if I change the image size.

http://i.imgur.com/3OniKGh.png

If you want I can give you the diagrams code that generated it, but I'm not sure how to isolate the problem

Twinside commented 10 years ago

Yes please, if you could dump the Rasterific geometry for the whole circle, it would be even better.

Is the "big" dashing on the middle right of the circle normal?

jeffreyrosenbluth commented 10 years ago

I'm not sure how to dump the geometry of the whole circle. But if you have a way let me know and i'll do it. The "big" dashing on the middle right of the circle is a diagrams problem - not rasterifice. Here is a link to the code:

https://github.com/diagrams/diagrams-share/blob/master/Diagrams/gears.hs

The offending fucntion is galaxy.

Twinside commented 10 years ago

I think I'm going to add a dumping function around Drawing, it should help reproduce bad cases like that

jeffreyrosenbluth commented 10 years ago

That would be great. Are you able to run the diagrams program? The latest version of the rasterific backend needs to be built with the HEAD branches of diagrams-core and diagrams-lib. I made a small change diagrams-lib that is only in HEAD, but used in diagrams-rasteriric.

On Thu, Mar 20, 2014 at 9:17 AM, Vincent notifications@github.com wrote:

I think I'm going to add a dumping function around Drawing, it should help reproduce bad cases like that

Reply to this email directly or view it on GitHubhttps://github.com/Twinside/Rasterific/issues/4#issuecomment-38164931 .

jeffreyrosenbluth commented 10 years ago

Sorry to bombard you, but this code also produced a funny result. The circle is deformed.

{-# LANGUAGE NoMonomorphismRestriction #-} import Diagrams.Prelude import Diagrams.Backend.Rasterific.CmdLine

example :: Diagram B R2 example = hcat [ unitSquare # fc blue , unitCircle # fc green , unitSquare # fc teal ]

main :: IO () main = defaultMain example

On Thu, Mar 20, 2014 at 9:19 AM, Jeffrey Rosenbluth < jeffrey.rosenbluth@gmail.com> wrote:

That would be great. Are you able to run the diagrams program? The latest version of the rasterific backend needs to be built with the HEAD branches of diagrams-core and diagrams-lib. I made a small change diagrams-lib that is only in HEAD, but used in diagrams-rasteriric.

On Thu, Mar 20, 2014 at 9:17 AM, Vincent notifications@github.com wrote:

I think I'm going to add a dumping function around Drawing, it should help reproduce bad cases like that

Reply to this email directly or view it on GitHubhttps://github.com/Twinside/Rasterific/issues/4#issuecomment-38164931 .

Twinside commented 10 years ago

I don't have diagrams hackage nor HEAD installed yet, and I'm at work so I cannot check right now :]

jeffreyrosenbluth commented 10 years ago

No worries, maybe we can talk on irc later

Twinside commented 10 years ago

Hmm I don't see the problem with the circle, but I'm approximating with bezier curve, would it be a rendering error.

jeffreyrosenbluth commented 10 years ago

take a look at:

http://i.imgur.com/zBtXgVO.png

this is what i'm getting

On Thu, Mar 20, 2014 at 5:59 PM, Vincent notifications@github.com wrote:

Hmm I don't see the problem with the circle, but I'm approximating with bezier curve, would it be a rendering error.

Reply to this email directly or view it on GitHubhttps://github.com/Twinside/Rasterific/issues/4#issuecomment-38226193 .

Twinside commented 10 years ago

Hmm the image border are not the same, I'll have to try when reducing the image size, there may be a problem with clipping

Twinside commented 10 years ago

Could you retry the circle? I can't reproduce the problem.

jeffreyrosenbluth commented 10 years ago

I don't get the funny line anymore but some of the dashes are too short or missing.

http://i.imgur.com/jmEuHIh.png

On Fri, Mar 21, 2014 at 3:37 PM, Vincent notifications@github.com wrote:

Could you retry the circle? I can't reproduce the problem.

Reply to this email directly or view it on GitHubhttps://github.com/Twinside/Rasterific/issues/4#issuecomment-38314697 .

Twinside commented 10 years ago

Hmm I need to tweak some constants

Twinside commented 10 years ago

It should be OK with the new constants, is there still a problem with http://i.imgur.com/zBtXgVO.png ? (I cannot reproduce it :-/)

jeffreyrosenbluth commented 10 years ago

The dashing works now with the new constraints. But I still get get a deformed circle like http://i.imgur.com/zBtXgVO.png and I'm running a fresh pull of the code on a different machine - still OSX 10.9.1 though.

On Fri, Mar 21, 2014 at 4:48 PM, Vincent notifications@github.com wrote:

It should be OK with the new constants, is there still a problem with http://i.imgur.com/zBtXgVO.png ? (I cannot reproduce it :-/)

Reply to this email directly or view it on GitHubhttps://github.com/Twinside/Rasterific/issues/4#issuecomment-38322471 .

jeffreyrosenbluth commented 10 years ago

It's very strange when I add 1 percent padding around the diagram the problme goes away. It looks like a diagrams bug, but it doesn't occur in other backends.

main = defaultMain $ pad 1.01 example

On Fri, Mar 21, 2014 at 5:09 PM, Jeffrey Rosenbluth < jeffrey.rosenbluth@gmail.com> wrote:

The dashing works now with the new constraints. But I still get get a deformed circle like http://i.imgur.com/zBtXgVO.png and I'm running a fresh pull of the code on a different machine - still OSX 10.9.1 though.

On Fri, Mar 21, 2014 at 4:48 PM, Vincent notifications@github.com wrote:

It should be OK with the new constants, is there still a problem with http://i.imgur.com/zBtXgVO.png ? (I cannot reproduce it :-/)

Reply to this email directly or view it on GitHubhttps://github.com/Twinside/Rasterific/issues/4#issuecomment-38322471 .

Twinside commented 10 years ago

Are you on GHC 32 or 64 bits? If you're on 64 bits I got an idea (and the implications would not be pleasant for me)

jeffreyrosenbluth commented 10 years ago

Sorry to say but I'm on 64 bits - hope that isn't really bad news

On Fri, Mar 21, 2014 at 5:52 PM, Vincent notifications@github.com wrote:

Are you on GHC 32 or 64 bits? If you're on 64 bits I got an idea (and the implications would not be pleasant for me)

Reply to this email directly or view it on GitHubhttps://github.com/Twinside/Rasterific/issues/4#issuecomment-38328274 .